Compare commits
20 Commits
7a99473352
...
03ce27c7f2
Author | SHA1 | Date |
---|---|---|
Philippe Caseiro | 03ce27c7f2 | |
Philippe Caseiro | d0284ccbe4 | |
vfebvre | 38de7274ba | |
Emmanuel Garette | 44629b4587 | |
Emmanuel Garette | b1bcd05792 | |
Emmanuel Garette | efc3f5848c | |
Emmanuel Garette | d19bfdebf9 | |
Emmanuel Garette | a199b9182d | |
Emmanuel Garette | d87c9ee307 | |
Teddy Cornaut | 0327098015 | |
Emmanuel Garette | 4ee18114f4 | |
Emmanuel Garette | 796b71a992 | |
vincent | 921e6b01a1 | |
Emmanuel Garette | 94fc8c2411 | |
Emmanuel Garette | 7800e9e20a | |
Emmanuel Garette | 5817d9aee4 | |
vincent | be45f4e3fa | |
vincent | f65fc17332 | |
vincent | d84efbfaa4 | |
vincent | 4dd7e78f7c |
4
Makefile
4
Makefile
|
@ -4,8 +4,8 @@
|
|||
|
||||
SOURCE=eole-mariadb
|
||||
VERSION=0.0.1
|
||||
EOLE_VERSION=2.6
|
||||
EOLE_RELEASE=2.6.2
|
||||
EOLE_VERSION=2.7
|
||||
EOLE_RELEASE=2.7.1
|
||||
PKGAPPS=non
|
||||
#FLASK_MODULE=<APPLICATION>
|
||||
|
||||
|
|
53
README.md
53
README.md
|
@ -1,5 +1,58 @@
|
|||
# eole-mariadb
|
||||
|
||||
Paquet porté pour la 2.7.1. 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.1 :
|
||||
|
||||
## 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.1-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
|
||||
|
||||
#######################################################################
|
||||
|
||||
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
|
||||
|
|
|
@ -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>
|
||||
|
@ -50,14 +49,17 @@
|
|||
<value>Default</value>
|
||||
</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 name="create_db" type='oui/non' description="Créer des bases de données">
|
||||
<value>non</value>
|
||||
</variable>
|
||||
</family>
|
||||
<family name="MariaDB Databases">
|
||||
<variable name="db_name" type='string' description='Nom de la base de donnée' multi="True"/>
|
||||
<variable name="db_admin_user" type='string' description="Nom de l'utilisateur gestionnaire de la base de données"/>
|
||||
</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 +116,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,24 +134,28 @@
|
|||
<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 -->
|
||||
</family>
|
||||
<separators>
|
||||
<separator name='dbCreateFixAdmin'>Comptes d'administration supplémentaires</separator>
|
||||
<separator name='create_db'>Ajouter des bases de données</separator>
|
||||
</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>
|
||||
|
@ -171,6 +174,10 @@
|
|||
<slave>ifMariaDBLimit</slave>
|
||||
</group>
|
||||
|
||||
<group master='db_name'>
|
||||
<slave>db_admin_user</slave>
|
||||
</group>
|
||||
|
||||
<fill name='calc_multi_condition' target='accLimitTarget'>
|
||||
<param>Default</param>
|
||||
<param type='eole' name='condition_1'>accLimits</param>
|
||||
|
@ -180,16 +187,20 @@
|
|||
|
||||
<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>
|
||||
|
||||
<condition name='disabled_if_in' source='create_db'>
|
||||
<param>non</param>
|
||||
<target type='family'>MariaDB Databases</target>
|
||||
</condition>
|
||||
|
||||
<condition name='disabled_if_in' source="dbCreateFixAdmin">
|
||||
<param>non</param>
|
||||
<target type='variable'>accName</target>
|
||||
|
@ -199,7 +210,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>
|
||||
|
|
|
@ -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
|
|
@ -28,6 +28,8 @@ then
|
|||
|
||||
previousUsers=($(awk -F ':' '{print $1}' ${readerfile} ))
|
||||
|
||||
index=0
|
||||
|
||||
for user in ${accounts[@]}
|
||||
do
|
||||
PASS=$(awk -F ':' "/${user}:/ {print \$2}" ${readerfile})
|
||||
|
@ -54,7 +56,6 @@ then
|
|||
done
|
||||
fi
|
||||
|
||||
index=0
|
||||
for hst in ${hostsList[@]}
|
||||
do
|
||||
SQL="DROP USER IF EXISTS '${user}'@'${hst}';"
|
||||
|
@ -86,4 +87,3 @@ then
|
|||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
|
|
|
@ -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
|
|
@ -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>
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
DESC="Exportation des bases MariaDB"
|
||||
|
||||
. /usr/share/eole/schedule/config.sh
|
||||
|
||||
MYSQLSAVDIR=$SAVDIR/sql
|
||||
OPTION="--lock-tables"
|
||||
|
||||
if [[ -d ${MYSQLSAVDIR} ]]
|
||||
then
|
||||
rm -rf ${MYSQLSAVDIR}
|
||||
mkdir -p ${MYSQLSAVDIR}
|
||||
fi
|
||||
|
||||
mariabackup --defaults-file=/etc/mysql/debian.cnf --backup --target-dir=$MYSQLSAVDIR
|
||||
exit $?
|
|
@ -1,7 +0,0 @@
|
|||
# Configuration commune aux scripts schedule
|
||||
# Configuration de base modifiée pour copier dans le partage nfs plutôt que /home
|
||||
|
||||
SAVDIR=/mnt/sauvegardes/
|
||||
# pour que l'affichage de [ ok ] soit ok
|
||||
export TERM='dumb'
|
||||
umask 0077
|
|
@ -1,27 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
DESC="Exportation des bases MySQL"
|
||||
|
||||
. /usr/share/eole/schedule/config.sh
|
||||
|
||||
MYSQLSAVDIR=$SAVDIR/sql
|
||||
OPTION="--lock-tables"
|
||||
|
||||
rm -f $MYSQLSAVDIR/*.sql
|
||||
mkdir -p $MYSQLSAVDIR
|
||||
|
||||
CMD="mysql --defaults-file=/etc/mysql/mariadb.cnf -e 'show databases' | grep -v '^Database$'"
|
||||
DATABASES=$(CreoleRun "$CMD" mysql)
|
||||
for databasename in $DATABASES; do
|
||||
case "$databasename" in
|
||||
information_schema|performance_schema|bareos)
|
||||
continue
|
||||
;;
|
||||
*)
|
||||
CMD="mysqldump --defaults-file=/etc/mysql/mariadb.cnf --databases $databasename --flush-privileges --create-options -Q -c $OPTION 2>/dev/null"
|
||||
CreoleRun "$CMD" mysql > $MYSQLSAVDIR/$databasename.sql
|
||||
;;
|
||||
esac
|
||||
done
|
|
@ -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]
|
||||
|
|
Loading…
Reference in New Issue