Compare commits
9 Commits
pkg/stable
...
pkg/dev/eo
Author | SHA1 | Date | |
---|---|---|---|
21b93a3462 | |||
7800e9e20a | |||
5817d9aee4 | |||
c540b65e08 | |||
be45f4e3fa | |||
f65fc17332 | |||
5e9eae5c13 | |||
d84efbfaa4 | |||
4dd7e78f7c |
27
README.md
27
README.md
@ -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
|
||||
|
@ -22,19 +22,19 @@
|
||||
</service_restriction>
|
||||
|
||||
<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 +51,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 +111,16 @@
|
||||
</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"/>
|
||||
<variable name='nodeName' type='domain' description="Nom de domaine du noeud"/>
|
||||
|
||||
<variable name='dbClusterMember' type='domain' description="Nom de domaine des membres de la grappe" multi="True"/>
|
||||
<!-- Expert Variables -->
|
||||
<variable name='dbBinLogFormat' type='string' mode='expert' description='Format du binlog'>
|
||||
<value>ROW</value>
|
||||
</variable>
|
||||
@ -135,7 +130,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 +140,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>
|
||||
@ -171,6 +169,9 @@
|
||||
<slave>ifMariaDBLimit</slave>
|
||||
</group>
|
||||
|
||||
<fill name='calc_val' target='nodeName'>
|
||||
<param type='eole'>nom_domaine_machine</param>
|
||||
</fill>
|
||||
<fill name='calc_multi_condition' target='accLimitTarget'>
|
||||
<param>Default</param>
|
||||
<param type='eole' name='condition_1'>accLimits</param>
|
||||
@ -180,13 +181,13 @@
|
||||
|
||||
<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='service_accesslist'>dbCluster</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 +200,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>
|
||||
|
66
posttemplate/25-mariadb-passwd
Executable file
66
posttemplate/25-mariadb-passwd
Executable file
@ -0,0 +1,66 @@
|
||||
#!/bin/bash
|
||||
|
||||
systemctl stop mariadb
|
||||
|
||||
mariadb_cfdir=/etc/mysql/
|
||||
dc=$mysql_cfgdir/mariadbBackup.cnf
|
||||
mariadb_rundir=/var/run/mysqld/
|
||||
mariadb_statedir=/var/lib/mysql
|
||||
|
||||
if [ -e "$dc" -a -n "`fgrep mysql_upgrade $dc 2>/dev/null`" ]; then
|
||||
pass="`sed -n 's/^[ ]*password *= *// p' $dc | head -n 1`"
|
||||
# Basedir is deprecated. Remove the option if it's in an existing mariadbBackup.cnf
|
||||
sed -i '/basedir/d' "$dc"
|
||||
else
|
||||
pass=`perl -e 'print map{("a".."z","A".."Z",0..9)[int(rand(62))]}(1..16)'`;
|
||||
if [ ! -d "$mariadb_cfdir" ]; then
|
||||
then install -o 0 -g 0 -m 0755 -d $mariadb_cfdir
|
||||
fi
|
||||
umask 066
|
||||
cat /dev/null > $dc
|
||||
umask 022
|
||||
echo "# Automatically generated DONT'T TOUCH !!!!!!" >>$dc
|
||||
echo "[client]" >>$dc
|
||||
echo "host = localhost" >>$dc
|
||||
echo "user = maria-sys-maint" >>$dc
|
||||
echo "password = $pass" >>$dc
|
||||
echo "socket = $mariadb_rundir/mysqld.sock" >>$dc
|
||||
echo "[mysql_upgrade]" >>$dc
|
||||
echo "host = localhost" >>$dc
|
||||
echo "user = maria-sys-maint" >>$dc
|
||||
echo "password = $pass" >>$dc
|
||||
echo "socket = $mariadb_rundir/mysqld.sock" >>$dc
|
||||
fi
|
||||
|
||||
# If this dir chmod go+w then the admin did it. But this file should not.
|
||||
chown 0:0 $dc
|
||||
chmod 0600 $dc
|
||||
|
||||
# If database doesn't exist we create it.
|
||||
mkdir /var/lib/mariadb-files
|
||||
mariadb_filesdir=/var/lib/mariadb-files
|
||||
|
||||
if [ ! "$(ls -A "${mariadb_statedir}")" ] && [ -d "${mariadb_filesdir}" ]; then
|
||||
existingdatabase=0
|
||||
initfile=`mktemp --tmpdir=/var/lib/mariadb-files/`
|
||||
touch "$initfile"
|
||||
chmod 600 "$initfile"
|
||||
chown mysql:mysql "$initfile"
|
||||
echo "USE mysql; " >> "$initfile"
|
||||
db_get mysql-server/root_password && rootpw="$RET"
|
||||
if [ ! -z "$rootpw" ]; then
|
||||
rootpw=$(printf %q "${rootpw}")
|
||||
echo "ALTER USER 'root'@'localhost' IDENTIFIED BY '$rootpw';" >> "$initfile"
|
||||
fi
|
||||
echo "CREATE USER IF NOT EXISTS 'maria-sys-maint'@'localhost' IDENTIFIED BY '$pass';" >> "$initfile"
|
||||
echo "GRANT ALL ON *.* TO 'maria-sys-maint'@'localhost' WITH GRANT OPTION;" >> "$initfile"
|
||||
echo "SHUTDOWN;" >> "$initfile"
|
||||
mysqld --initialize-insecure --user=mysql --init-file="$initfile"> /dev/null 2>&1 || true
|
||||
rm "$initfile"
|
||||
else
|
||||
existingdatabase=1
|
||||
fi
|
||||
|
||||
systemctl start mariadb
|
||||
|
||||
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>
|
@ -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
|
@ -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://%%nodeName,%%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="%%nodeName"
|
||||
|
Reference in New Issue
Block a user