Merge branch 'master' into dist/eole/2.7.0/master

This commit is contained in:
vincent 2019-03-11 10:03:31 +01:00
commit bbc87b8656
7 changed files with 79 additions and 71 deletions

View File

@ -1,5 +1,32 @@
# eole-mariadb # eole-mariadb
Paquet porté pour la 2.7.0. Les tests n'ont été réalisé que sur un Eolebase.
La version utilisé est mariadb 10.3
Ajout de ce paquet sur une 2.7.0 :
## Add the Cadoles repository on all the nodes and the Leader
GenConfig [Mode Expert] -> Dépôts Tiers
* Libellé du dépôt : Cadoles dev
* Déclaration du dépôt : deb [ arch=all ] https://vulcain.cadoles.com 2.7.0-dev main
* Méthode de récupération de la clé publique du dépôt : URL de la clé
* URL de la clé : https://vulcain.cadoles.com/cadoles.gpg
## Add the MariaDB repository on all the nodes and the Leader
GenConfig (Mode Expert) -> Dépôt tiers :
* Libellé du dépôt : MariaDB
* Déclaration du dépôt : deb [ arch=amd64 ] http://mariadb.mirrors.ovh.net/MariaDB/repo/10.3/ubuntu bionic main
* Méthode de récupération de la clé publique du dépôt : serveur de clés
* URL du serveur de clés : hkp://keyserver.ubuntu.com:80
* Empreinte de la clé : 0xF1656F24C74CD1D8
#######################################################################
Début des travaux pour l'utilisation de mariadb Début des travaux pour l'utilisation de mariadb
dans Eole avec des fonctionalitées avancées du type dans Eole avec des fonctionalitées avancées du type
mise en clustter mise en clustter

View File

@ -2,39 +2,38 @@
<files> <files>
<file filelist='dbMariaDB' name='/etc/mysql/conf.d/mariadb.cnf' rm='True' mkdir='True'/> <file filelist='dbMariaDB' name='/etc/mysql/conf.d/mariadb.cnf' rm='True' mkdir='True'/>
<file filelist='dbCluster' name='/etc/mysql/conf.d/galera.cnf' rm='True' mkdir='True'/> <file filelist='dbCluster' name='/etc/mysql/conf.d/galera.cnf' rm='True' mkdir='True'/>
<file filelist='dbTunning' name='/etc/mysql/conf.d/tunning.cnf' rm='True' mkdir='True'/> <file filelist='dbTunning' name='/etc/mysql/conf.d/tunning.cnf' rm='True' mkdir='True'/>
<service servicelist='bdd'>mariadb</service> <service servicelist='bdd'>mariadb</service>
<service_access service='mariadb'> <service_access service='mariadb'>
<port service_accesslist='mariadb' protocol='tcp'>3306</port> <port protocol='tcp'>3306</port>
<tcpwrapper service_accesslist='mariadb'>mariadb</tcpwrapper> <tcpwrapper>mariadb</tcpwrapper>
</service_access> </service_access>
<service_access service='galera'>
<port service_accesslist='dbCluster' protocol='tcp'>4444</port>
<port service_accesslist='dbCluster' protocol='tcp'>4567</port>
<port service_accesslist='dbCluster' protocol='tcp'>4568</port>
<port service_accesslist='dbCluster' protocol='udp'>4567</port>
<tcpwrapper service_accesslist='mariadb'>mariadb</tcpwrapper>
</service_access>
<service_restriction service='mariadb'> <service_restriction service='mariadb'>
<ip interface='ifMariaDBLimit' interface_type="SymLinkOption" netmask='maskMariaDBLimit' netmask_type='SymLinkOption' ip_type='SymLinkOption'>ipMariaDBLimit</ip> <ip interface='ifMariaDBLimit' interface_type="SymLinkOption" netmask='maskMariaDBLimit' netmask_type='SymLinkOption' ip_type='SymLinkOption'>ipMariaDBLimit</ip>
</service_restriction> </service_restriction>
<service_access service='galera'>
<port service_accesslist='dbCluster' protocol='tcp'>3306</port>
<port service_accesslist='dbCluster' protocol='tcp'>4444</port>
<port service_accesslist='dbCluster' protocol='tcp'>4567</port>
<port service_accesslist='dbCluster' protocol='tcp'>4568</port>
<port service_accesslist='dbCluster' protocol='udp'>4567</port>
</service_access>
<service_restriction service='galera'> <service_restriction service='galera'>
<ip interface='ifDBCluster' interface_type="SymLinkOption" netmask='255.255.255.255' ip_type='SymLinkOption'>dbClusterMemberIP</ip> <ip interface='ifDBCluster' interface_type="SymLinkOption" netmask='255.255.255.255' ip_type='SymLinkOption'>dbClusterMember</ip>
</service_restriction> </service_restriction>
</files> </files>
<variables> <variables>
<family name="Services"> <family name="Services">
<variable name="dbEnable" type='oui/non' description='Activer le serveur de base de données MariaDB'> <variable name="dbEnable" type='oui/non' description='Activer le serveur de base de données MariaDB'>
<value>non</value> <value>oui</value>
</variable> </variable>
<variable name="dbEnableBackup" type='oui/non' description='Activer la sauvegarde sur le serveur de base de données MariaDB'> <variable name="dbEnableBackup" type='oui/non' description='Activer la sauvegarde sur le serveur de base de données MariaDB'>
<value>non</value> <value>non</value>
</variable> </variable>
</family> </family>
<family name="Database"> <family name="MariaDB" icon='mysql-alt'>
<variable name='dbEnableCluster' type='oui/non' description="Activer la mise en grappe MariaDB Galera ?"> <variable name='dbEnableCluster' type='oui/non' description="Activer la mise en grappe MariaDB Galera ?">
<value>non</value> <value>non</value>
</variable> </variable>
@ -51,13 +50,10 @@
</variable> </variable>
<variable name="accLimitTarget" type="string" description="Restriction d'accès à ces IP/noms d'hôtes (liste séparateur séparateur ',')" /> <variable name="accLimitTarget" type="string" description="Restriction d'accès à ces IP/noms d'hôtes (liste séparateur séparateur ',')" />
<variable name="dbClusterGcacheSizeMb" type="number" description="FIXME Gcachesize">
<value>128</value>
</variable>
</family> </family>
<!-- Tunning --> <!-- Tunning -->
<family name="Database Tunning" mode="expert"> <family name="MariaDB Tunning" mode="expert" icon='mysql-alt'>
<variable name="dbInnoDBBufferPoolPercentage" type="number" description="Pourcentage de mémoire à dédier à MariaDB"> <variable name="dbInnoDBBufferPoolPercentage" type="number" description="Pourcentage de mémoire à dédier à MariaDB">
<value>20</value> <value>20</value>
</variable> </variable>
@ -114,18 +110,15 @@
</variable> </variable>
</family> </family>
<family name="Database Cluster"> <family name="Grappe MariaDB" icon='mysql-alt'>
<variable name='dbClusterPosition' type='string' description="Rôle dans la grappe" mandatory='True'/> <variable name='dbClusterPosition' type='string' description="Rôle dans la grappe" mandatory='True'/>
<variable name='ifDBCluster' type='string' description="Interface réseau dédiée à la grappe BDD"/>
<!-- FIXME : Fill this variable with nom_machine -->
<variable name='nodeName' type='string' description="Nom du noeud local"/>
<variable name='dbClusterMember' type='string' description="Membre de la grappe BDD" multi='True'/>
<variable name='dbClusterMemberIP' type='ip' description="Adresse IP"/>
<!-- Expert Variables -->
<variable name='dbClusterName' type='string' description='Nom de la grappe'> <variable name='dbClusterName' type='string' description='Nom de la grappe'>
<value>galera_cluster</value> <value>galera_cluster</value>
</variable> </variable>
<variable name='ifDBCluster' type='string' description="Interface réseau dédiée à la grappe BDD" mandatory='True'/>
<variable name='dbClusterMember' type='domain' description="Nom de domaine des membres de la grappe" multi="True" mandatory='True'/>
<variable name="dbClusterMemberIndex" description="Index du serveur dans la liste des membres de la grappe" type="number" mandatory="True"/>
<!-- Expert Variables -->
<variable name='dbBinLogFormat' type='string' mode='expert' description='Format du binlog'> <variable name='dbBinLogFormat' type='string' mode='expert' description='Format du binlog'>
<value>ROW</value> <value>ROW</value>
</variable> </variable>
@ -135,7 +128,7 @@
<variable name='dbSSTMethod' type='string' mode='expert' description='Méthode SST'> <variable name='dbSSTMethod' type='string' mode='expert' description='Méthode SST'>
<value>rsync</value> <value>rsync</value>
</variable> </variable>
<variable name='dbClusterGcacheSize' type='number' mode='expert' description="Write-set Cache Size (gcache.size)"> <variable name='dbClusterGcacheSizeMb' type='number' mode='expert' description="Write-set Cache Size (gcache.size)">
<value>128</value> <value>128</value>
</variable> </variable>
<!-- End --> <!-- End -->
@ -145,14 +138,17 @@
</separators> </separators>
</variables> </variables>
<constraints> <constraints>
<check name="valid_ipnetmask" target="maskMariaDBLimit" level="warning">
<param type='eole'>ipMariaDBLimit</param>
</check>
<check name='valid_enum' target='dbBinLogFormat'>
<param>['ROW', 'STATEMENT', 'MIXED', 'NONE']</param>
</check>
<check name='valid_enum' target='ifDBCluster'> <check name='valid_enum' target='ifDBCluster'>
<param>['eth0', 'eth1', 'eth2', 'eth3', 'eth4']</param> <param>['eth0', 'eth1', 'eth2', 'eth3', 'eth4']</param>
</check> </check>
<group master='dbClusterMember'>
<slave>dbClusterMemberIP</slave>
</group>
<check name='valid_enum' target='accLimits'> <check name='valid_enum' target='accLimits'>
<param>['Default','Custom']</param> <param>['Default','Custom']</param>
</check> </check>
@ -180,13 +176,12 @@
<condition name='disabled_if_in' source="dbEnable"> <condition name='disabled_if_in' source="dbEnable">
<param>non</param> <param>non</param>
<target type='family'>Database</target> <target type='family'>MariaDB</target>
<target type='family'>Database Cluster</target> <!--target type='family'>Grappe MariaDB</target-->
<target type='family'>Database Tunning</target> <target type='family'>MariaDB Tunning</target>
<target type='service_accesslist'>dbCluster</target>
<target type='filelist'>dbTunning</target> <target type='filelist'>dbTunning</target>
<target type='filelist'>dbMariaDB</target> <target type='filelist'>dbMariaDB</target>
<target type='filelist'>dbCluster</target> <!--target type='filelist'>dbCluster</target-->
<target type='servicelist'>bdd</target> <target type='servicelist'>bdd</target>
</condition> </condition>
@ -199,7 +194,7 @@
<condition name='disabled_if_in' source="dbEnableCluster"> <condition name='disabled_if_in' source="dbEnableCluster">
<param>non</param> <param>non</param>
<target type='family'>Database Cluster</target> <target type='family'>Grappe MariaDB</target>
<target type='service_accesslist'>dbCluster</target> <target type='service_accesslist'>dbCluster</target>
<target type='filelist'>dbCluster</target> <target type='filelist'>dbCluster</target>
</condition> </condition>

11
postservice/00-bdd-cluster Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
set -e
if [[ "$1" == "instance" ]] && [[ "$(CreoleGet dbEnable)" == "oui" ]] && [[ "$(CreoleGet dbEnableCluster)" == "oui" ]] && [[ "$(CreoleGet dbClusterPosition)" == "Leader" ]]
then
service mariadb stop
galera_new_cluster
fi
exit 0

View File

@ -1,20 +0,0 @@
#!/bin/bash
db=$(CreoleGet dbEnable non)
cluster=$(CreoleGet dbEnableCluster non)
role=$(CreoleGet dbClusterPosition 'Node')
gstateFile="/var/lib/mysql/grastate.dat"
if [[ ${db} == "oui" ]]
then
if [[ ${cluster} == "oui" ]]
then
if [[ ${role} == "Leader" ]]
then
service mariadb stop
galera_new_cluster
fi
fi
fi
exit 0

View File

@ -2,14 +2,14 @@
<creole> <creole>
<variables> <variables>
<family name="mysql" description="Exportation des bases de données MySQL"> <family name="mariadb" description="Exportation des bases de données MariaDB">
<variable name="description" type="string" hidden="True"><value>Exportation des bases MySQL</value></variable> <variable name="description" type="string" hidden="True"><value>Exportation des bases MariaDB</value></variable>
<variable name="day" type="schedule" description="Périodicité d'exécution"><value>daily</value></variable> <variable name="day" type="schedule" description="Périodicité d'exécution"><value>daily</value></variable>
<variable name="mode" type="schedulemod" hidden="True"><value>pre</value></variable> <variable name="mode" type="schedulemod" hidden="True"><value>pre</value></variable>
</family> </family>
</variables> </variables>
<constraints> <constraints>
<fill name='calc_multi_condition' target='schedule.mysql.day'> <fill name='calc_multi_condition' target='schedule.mariadb.day'>
<param>non</param> <param>non</param>
<param type='eole' name='condition_1'>dbEnableBackup</param> <param type='eole' name='condition_1'>dbEnableBackup</param>
<param name='match'>none</param> <param name='match'>none</param>

View File

@ -2,7 +2,7 @@
set -e set -e
DESC="Exportation des bases MySQL" DESC="Exportation des bases MariaDB"
. /usr/share/eole/schedule/config.sh . /usr/share/eole/schedule/config.sh
@ -12,7 +12,7 @@ OPTION="--lock-tables"
rm -f $MYSQLSAVDIR/*.sql rm -f $MYSQLSAVDIR/*.sql
mkdir -p $MYSQLSAVDIR mkdir -p $MYSQLSAVDIR
CMD="mysql --defaults-file=/etc/mysql/mariadb.cnf -e 'show databases' | grep -v '^Database$'" CMD="mysql --defaults-file=/etc/mysql/mariadbBackup.cnf -e 'show databases' | grep -v '^Database$'"
DATABASES=$(CreoleRun "$CMD" mysql) DATABASES=$(CreoleRun "$CMD" mysql)
for databasename in $DATABASES; do for databasename in $DATABASES; do
case "$databasename" in case "$databasename" in
@ -20,7 +20,7 @@ for databasename in $DATABASES; do
continue continue
;; ;;
*) *)
CMD="mysqldump --defaults-file=/etc/mysql/mariadb.cnf --databases $databasename --flush-privileges --create-options -Q -c $OPTION 2>/dev/null" CMD="mysqldump --defaults-file=/etc/mysql/mariadbBackup.cnf --databases $databasename --flush-privileges --create-options -Q -c $OPTION 2>/dev/null"
CreoleRun "$CMD" mysql > $MYSQLSAVDIR/$databasename.sql CreoleRun "$CMD" mysql > $MYSQLSAVDIR/$databasename.sql
;; ;;
esac esac

View File

@ -8,12 +8,7 @@ wsrep_on=ON
wsrep_provider=/usr/lib/galera/libgalera_smm.so wsrep_provider=/usr/lib/galera/libgalera_smm.so
# Galera Cluster Configuration # Galera Cluster Configuration
wsrep_cluster_name="%%dbClusterName" wsrep_cluster_name="%%dbClusterName"
%set %%nodeIP = %%getVar('adresse_ip_' + %%ifDBCluster, '') wsrep_cluster_address="gcomm://%%custom_join(%%dbClusterMember, ',')"
wsrep_cluster_address="gcomm://%%nodeIP%slurp
%for %%node in %%dbClusterMember
,%%node.dbClusterMemberIP%slurp
%end for
"
# Tunning # Tunning
wsrep_provider_options="gcache.size=%%dbClusterGcacheSizeMb" wsrep_provider_options="gcache.size=%%dbClusterGcacheSizeMb"
@ -22,5 +17,5 @@ wsrep_provider_options="gcache.size=%%dbClusterGcacheSizeMb"
wsrep_sst_method=%%dbSSTMethod wsrep_sst_method=%%dbSSTMethod
# Galera Node Configuration # Galera Node Configuration
wsrep_node_address="%%nodeIP" wsrep_node_address="%%getVar('adresse_ip_' + %%ifDBCluster)"
wsrep_node_name="%%nodeName" wsrep_node_name="%%dbClusterMember[%%dbClusterMemberIndex]