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
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
dans Eole avec des fonctionalitées avancées du type
mise en clustter

View File

@ -2,39 +2,38 @@
<files>
<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='dbTunning' name='/etc/mysql/conf.d/tunning.cnf' rm='True' mkdir='True'/>
<service servicelist='bdd'>mariadb</service>
<service_access service='mariadb'>
<port service_accesslist='mariadb' protocol='tcp'>3306</port>
<tcpwrapper service_accesslist='mariadb'>mariadb</tcpwrapper>
<port protocol='tcp'>3306</port>
<tcpwrapper>mariadb</tcpwrapper>
</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'>
<ip interface='ifMariaDBLimit' interface_type="SymLinkOption" netmask='maskMariaDBLimit' netmask_type='SymLinkOption' ip_type='SymLinkOption'>ipMariaDBLimit</ip>
</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'>
<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>
</files>
<variables>
<family name="Services">
<variable name="dbEnable" type='oui/non' description='Activer le serveur de base de données MariaDB'>
<value>non</value>
<value>oui</value>
</variable>
<variable name="dbEnableBackup" type='oui/non' description='Activer la sauvegarde sur le serveur de base de données MariaDB'>
<value>non</value>
</variable>
</family>
<family name="Database">
<family name="MariaDB" icon='mysql-alt'>
<variable name='dbEnableCluster' type='oui/non' description="Activer la mise en grappe MariaDB Galera ?">
<value>non</value>
</variable>
@ -51,13 +50,10 @@
</variable>
<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>
<!-- 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">
<value>20</value>
</variable>
@ -114,18 +110,15 @@
</variable>
</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='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'>
<value>galera_cluster</value>
</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'>
<value>ROW</value>
</variable>
@ -135,7 +128,7 @@
<variable name='dbSSTMethod' type='string' mode='expert' description='Méthode SST'>
<value>rsync</value>
</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>
</variable>
<!-- End -->
@ -145,14 +138,17 @@
</separators>
</variables>
<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'>
<param>['eth0', 'eth1', 'eth2', 'eth3', 'eth4']</param>
</check>
<group master='dbClusterMember'>
<slave>dbClusterMemberIP</slave>
</group>
<check name='valid_enum' target='accLimits'>
<param>['Default','Custom']</param>
</check>
@ -180,13 +176,12 @@
<condition name='disabled_if_in' source="dbEnable">
<param>non</param>
<target type='family'>Database</target>
<target type='family'>Database Cluster</target>
<target type='family'>Database Tunning</target>
<target type='service_accesslist'>dbCluster</target>
<target type='family'>MariaDB</target>
<!--target type='family'>Grappe MariaDB</target-->
<target type='family'>MariaDB Tunning</target>
<target type='filelist'>dbTunning</target>
<target type='filelist'>dbMariaDB</target>
<target type='filelist'>dbCluster</target>
<!--target type='filelist'>dbCluster</target-->
<target type='servicelist'>bdd</target>
</condition>
@ -199,7 +194,7 @@
<condition name='disabled_if_in' source="dbEnableCluster">
<param>non</param>
<target type='family'>Database Cluster</target>
<target type='family'>Grappe MariaDB</target>
<target type='service_accesslist'>dbCluster</target>
<target type='filelist'>dbCluster</target>
</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>
<variables>
<family name="mysql" description="Exportation des bases de données MySQL">
<variable name="description" type="string" hidden="True"><value>Exportation des bases MySQL</value></variable>
<family name="mariadb" description="Exportation des bases de données MariaDB">
<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="mode" type="schedulemod" hidden="True"><value>pre</value></variable>
</family>
</variables>
<constraints>
<fill name='calc_multi_condition' target='schedule.mysql.day'>
<fill name='calc_multi_condition' target='schedule.mariadb.day'>
<param>non</param>
<param type='eole' name='condition_1'>dbEnableBackup</param>
<param name='match'>none</param>

View File

@ -2,7 +2,7 @@
set -e
DESC="Exportation des bases MySQL"
DESC="Exportation des bases MariaDB"
. /usr/share/eole/schedule/config.sh
@ -12,7 +12,7 @@ OPTION="--lock-tables"
rm -f $MYSQLSAVDIR/*.sql
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)
for databasename in $DATABASES; do
case "$databasename" in
@ -20,7 +20,7 @@ for databasename in $DATABASES; do
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
;;
esac

View File

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