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

This commit is contained in:
vincent 2019-03-11 09:45:26 +01:00
commit 997e33daf2
5 changed files with 24 additions and 105 deletions

View File

@ -2,25 +2,24 @@
<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'>dbClusterMember</ip> <ip interface='ifDBCluster' interface_type="SymLinkOption" netmask='255.255.255.255' ip_type='SymLinkOption'>dbClusterMember</ip>
</service_restriction> </service_restriction>
@ -117,9 +116,8 @@
<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='ifDBCluster' type='string' description="Interface réseau dédiée à la grappe BDD" mandatory='True'/>
<variable name='nodeName' type='domain' description="Nom de domaine du noeud" mandatory='True'/>
<variable name='dbClusterMember' type='domain' description="Nom de domaine des membres de la grappe" multi="True" 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 --> <!-- 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>
@ -169,9 +167,6 @@
<slave>ifMariaDBLimit</slave> <slave>ifMariaDBLimit</slave>
</group> </group>
<fill name='calc_val' target='nodeName'>
<param type='eole'>nom_domaine_machine</param>
</fill>
<fill name='calc_multi_condition' target='accLimitTarget'> <fill name='calc_multi_condition' target='accLimitTarget'>
<param>Default</param> <param>Default</param>
<param type='eole' name='condition_1'>accLimits</param> <param type='eole' name='condition_1'>accLimits</param>
@ -184,7 +179,6 @@
<target type='family'>MariaDB</target> <target type='family'>MariaDB</target>
<!--target type='family'>Grappe MariaDB</target--> <!--target type='family'>Grappe MariaDB</target-->
<target type='family'>MariaDB 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-->

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

@ -1,66 +0,0 @@
#!/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
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

View File

@ -8,7 +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"
wsrep_cluster_address="gcomm://%%nodeName,%%custom_join(%%dbClusterMember, ',')" wsrep_cluster_address="gcomm://%%custom_join(%%dbClusterMember, ',')"
# Tunning # Tunning
wsrep_provider_options="gcache.size=%%dbClusterGcacheSizeMb" wsrep_provider_options="gcache.size=%%dbClusterGcacheSizeMb"
@ -18,4 +18,4 @@ wsrep_sst_method=%%dbSSTMethod
# Galera Node Configuration # Galera Node Configuration
wsrep_node_address="%%getVar('adresse_ip_' + %%ifDBCluster)" wsrep_node_address="%%getVar('adresse_ip_' + %%ifDBCluster)"
wsrep_node_name="%%nodeName" wsrep_node_name="%%dbClusterMember[%%dbClusterMemberIndex]