From c1ff249d3e7b0e6eb7866cf2b61a815ff1ff36ca Mon Sep 17 00:00:00 2001 From: Philippe Caseiro Date: Thu, 12 Apr 2018 10:38:53 +0200 Subject: [PATCH 1/2] Adding mariadb service management --- creolefuncs/mariadb.py | 4 ++-- dicos/25_bdd_server.xml | 16 +++++++++------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/creolefuncs/mariadb.py b/creolefuncs/mariadb.py index 688e696..0351e9c 100644 --- a/creolefuncs/mariadb.py +++ b/creolefuncs/mariadb.py @@ -6,8 +6,8 @@ def getMemoryPercentage(percent): percent = int(percent) totalMemory = os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') memoryToUse = (totalMemory*percent)/100 - memoryMb = memoryToUse/(1024.**2) - return "{0}M".format(int(memoryMb)) + memoryMb = int(memoryToUse/(1024.**2)) + return "{0}M".format(memoryMb) except: return "Error during memory percentage calculation" diff --git a/dicos/25_bdd_server.xml b/dicos/25_bdd_server.xml index 8e966ff..5b16317 100644 --- a/dicos/25_bdd_server.xml +++ b/dicos/25_bdd_server.xml @@ -2,6 +2,7 @@ + mariadb 3306 mariadb @@ -153,6 +154,14 @@ "" + + non + Database Cluster + Database + dbCluster + bdd + + non accName @@ -167,13 +176,6 @@ dbCluster - - non - Database Cluster - Database - dbCluster - - non dbQueryCacheLimit From 92080c49f2817c5d34843f29a5c0fa6227bab5cf Mon Sep 17 00:00:00 2001 From: Philippe Caseiro Date: Thu, 12 Apr 2018 10:50:35 +0200 Subject: [PATCH 2/2] Adding Cluster bootstraping on first run. --- posttemplate/25-bdd-cluster | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 posttemplate/25-bdd-cluster diff --git a/posttemplate/25-bdd-cluster b/posttemplate/25-bdd-cluster new file mode 100755 index 0000000..d588519 --- /dev/null +++ b/posttemplate/25-bdd-cluster @@ -0,0 +1,18 @@ +#!/bin/bash + +db=$(CreoleGet dbEnable non) +cluster=$(CreoleGet dbEnableCluster non) +gstateFile="/var/lib/mysql/grastate.dat" + +if [[ ${db} == "oui" ]] +then + if [[ ${cluster} == "oui" ]] + then + if [[ ! -e ${gstateFile} ]] + then + galera_new_cluster + fi + fi +fi + +exit 0 \ No newline at end of file