Browse Source

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

tags/pkg/staging/eole-2.7.0/0.1.0-0
Emmanuel Garette 5 months ago
parent
commit
796b71a992
4 changed files with 22 additions and 37 deletions
  1. 9
    15
      dicos/25_bdd_server.xml
  2. 11
    0
      postservice/00-bdd-cluster
  3. 0
    20
      posttemplate/25-bdd-cluster
  4. 2
    2
      tmpl/galera.cnf

+ 9
- 15
dicos/25_bdd_server.xml View File

@@ -2,25 +2,24 @@
2 2
     <files>
3 3
         <file filelist='dbMariaDB' name='/etc/mysql/conf.d/mariadb.cnf' rm='True' mkdir='True'/>
4 4
         <file filelist='dbCluster' name='/etc/mysql/conf.d/galera.cnf'  rm='True' mkdir='True'/>
5
-
6 5
         <file filelist='dbTunning' name='/etc/mysql/conf.d/tunning.cnf' rm='True' mkdir='True'/>
6
+
7 7
         <service servicelist='bdd'>mariadb</service>
8 8
         <service_access service='mariadb'>
9
-            <port service_accesslist='mariadb' protocol='tcp'>3306</port>
10
-            <tcpwrapper service_accesslist='mariadb'>mariadb</tcpwrapper>
9
+            <port protocol='tcp'>3306</port>
10
+            <tcpwrapper>mariadb</tcpwrapper>
11 11
         </service_access>
12
+        <service_restriction service='mariadb'>
13
+           <ip interface='ifMariaDBLimit' interface_type="SymLinkOption" netmask='maskMariaDBLimit' netmask_type='SymLinkOption' ip_type='SymLinkOption'>ipMariaDBLimit</ip>
14
+        </service_restriction>
15
+
12 16
         <service_access service='galera'>
17
+            <port service_accesslist='dbCluster' protocol='tcp'>3306</port>
13 18
             <port service_accesslist='dbCluster' protocol='tcp'>4444</port>
14 19
             <port service_accesslist='dbCluster' protocol='tcp'>4567</port>
15 20
             <port service_accesslist='dbCluster' protocol='tcp'>4568</port>
16 21
             <port service_accesslist='dbCluster' protocol='udp'>4567</port>
17
-            <tcpwrapper service_accesslist='mariadb'>mariadb</tcpwrapper>
18 22
         </service_access>
19
-
20
-        <service_restriction service='mariadb'>
21
-           <ip interface='ifMariaDBLimit' interface_type="SymLinkOption" netmask='maskMariaDBLimit' netmask_type='SymLinkOption' ip_type='SymLinkOption'>ipMariaDBLimit</ip>
22
-        </service_restriction>
23
-
24 23
         <service_restriction service='galera'>
25 24
            <ip interface='ifDBCluster' interface_type="SymLinkOption" netmask='255.255.255.255' ip_type='SymLinkOption'>dbClusterMember</ip>
26 25
         </service_restriction>
@@ -117,9 +116,8 @@
117 116
                <value>galera_cluster</value>
118 117
             </variable>
119 118
             <variable name='ifDBCluster' type='string' description="Interface réseau dédiée à la grappe BDD" mandatory='True'/>
120
-            <variable name='nodeName' type='domain' description="Nom de domaine du noeud" mandatory='True'/>
121
-
122 119
             <variable name='dbClusterMember' type='domain' description="Nom de domaine des membres de la grappe" multi="True" mandatory='True'/>
120
+            <variable name="dbClusterMemberIndex" description="Index du serveur dans la liste des membres de la grappe" type="number" mandatory="True"/>
123 121
             <!-- Expert Variables -->
124 122
             <variable name='dbBinLogFormat' type='string' mode='expert' description='Format du binlog'>
125 123
                <value>ROW</value>
@@ -169,9 +167,6 @@
169 167
            <slave>ifMariaDBLimit</slave>
170 168
         </group>
171 169
 
172
-        <fill name='calc_val' target='nodeName'>
173
-            <param type='eole'>nom_domaine_machine</param>
174
-        </fill>
175 170
         <fill name='calc_multi_condition' target='accLimitTarget'>
176 171
             <param>Default</param>
177 172
             <param type='eole' name='condition_1'>accLimits</param>
@@ -184,7 +179,6 @@
184 179
             <target type='family'>MariaDB</target>
185 180
             <!--target type='family'>Grappe MariaDB</target-->
186 181
             <target type='family'>MariaDB Tunning</target>
187
-            <!--target type='service_accesslist'>dbCluster</target-->
188 182
             <target type='filelist'>dbTunning</target>
189 183
             <target type='filelist'>dbMariaDB</target>
190 184
             <!--target type='filelist'>dbCluster</target-->

+ 11
- 0
postservice/00-bdd-cluster View File

@@ -0,0 +1,11 @@
1
+#!/bin/bash
2
+
3
+set -e
4
+
5
+if [[ "$1" == "instance" ]] && [[ "$(CreoleGet dbEnable)" == "oui" ]] && [[ "$(CreoleGet dbEnableCluster)" == "oui" ]] && [[ "$(CreoleGet dbClusterPosition)" == "Leader" ]]
6
+then
7
+    service mariadb stop
8
+    galera_new_cluster
9
+fi
10
+
11
+exit 0

+ 0
- 20
posttemplate/25-bdd-cluster View File

@@ -1,20 +0,0 @@
1
-#!/bin/bash
2
-
3
-db=$(CreoleGet dbEnable non)
4
-cluster=$(CreoleGet dbEnableCluster non)
5
-role=$(CreoleGet dbClusterPosition 'Node')
6
-gstateFile="/var/lib/mysql/grastate.dat"
7
-
8
-if [[ ${db} == "oui" ]]
9
-then
10
-    if [[ ${cluster} == "oui" ]]
11
-    then
12
-		if [[ ${role} == "Leader"  ]]
13
-		then
14
-			service mariadb stop
15
-		    galera_new_cluster
16
-		fi
17
-    fi
18
-fi
19
-
20
-exit 0

+ 2
- 2
tmpl/galera.cnf View File

@@ -8,7 +8,7 @@ wsrep_on=ON
8 8
 wsrep_provider=/usr/lib/galera/libgalera_smm.so
9 9
 # Galera Cluster Configuration
10 10
 wsrep_cluster_name="%%dbClusterName"
11
-wsrep_cluster_address="gcomm://%%nodeName,%%custom_join(%%dbClusterMember, ',')"
11
+wsrep_cluster_address="gcomm://%%dbClusterMember
12 12
 
13 13
 # Tunning
14 14
 wsrep_provider_options="gcache.size=%%dbClusterGcacheSizeMb"
@@ -18,4 +18,4 @@ wsrep_sst_method=%%dbSSTMethod
18 18
 
19 19
 # Galera Node Configuration
20 20
 wsrep_node_address="%%getVar('adresse_ip_' + %%ifDBCluster)"
21
-wsrep_node_name="%%nodeName"
21
+wsrep_node_name="%%dbClusterMember[%%dbClusterMemberIndex]

Loading…
Cancel
Save