simplication déclaration des noeuds + ajustement règle de firewall + démarrer mariadb en postservice

This commit is contained in:
Emmanuel Garette 2019-03-04 09:54:28 +01:00
parent 921e6b01a1
commit 796b71a992
4 changed files with 24 additions and 39 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

@ -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://%%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]