File tree 2 files changed +52
-2
lines changed
2 files changed +52
-2
lines changed Original file line number Diff line number Diff line change 1
1
#! /bin/bash -x
2
2
3
- curl -o /tmp/provisioningVars.sh ${FILE_SERVER} /pod_${POD} _variables.sh
4
- . /tmp/provisioningVars.sh
3
+ mkdir /usr/local/siwapp
4
+ curl -o /usr/local/siwapp/provisioningVars.sh ${FILE_SERVER} /pod_${POD} _variables.sh
5
+ . /usr/local/siwapp/provisioningVars.sh
5
6
6
7
su -c " cat <<EOF > /etc/yum.repos.d/MariaDB.repo
7
8
[mariadb]
@@ -234,3 +235,11 @@ else
234
235
systemctl start mariadb
235
236
fi
236
237
fi
238
+
239
+ mkdir /usr/share/systemd/siwapp
240
+ wget ${FILE_SERVER} /siwapp-galera-fixup.sh -P /usr/share/systemd/siwapp
241
+ mkdir /usr/lib/systemd/system/mariadb.service.d
242
+ cat > /usr/lib/systemd/system/mariadb.service.d/10-siwapp-edits.conf << EOF
243
+ [Service]
244
+ ExecStartPre=/usr/bin/bash /usr/share/systemd/siwapp/siwapp-galera-fixup.sh
245
+ EOF
Original file line number Diff line number Diff line change
1
+ #! /bin/bash -x
2
+
3
+ . /usr/local/siwapp/provisioningVars.sh
4
+
5
+ temp_ifs=${IFS}
6
+ IFS=' ,'
7
+ dbHosts=(${DB_TIER_HOSTNAMES} ) # Array of nodes in my tier.
8
+ dbIps=(${DB_TIER_IPS} ) # Array of IPs in my tier.
9
+ master=${dbHosts[0]} # Let the first node in the service tier be the master.
10
+ master_addr=${dbIps[0]} # Let the first node in the service tier be the master.
11
+
12
+ IFS=${temp_ifs}
13
+
14
+ if [ " ${master} " == " ${HOSTNAME} " ]; then
15
+ sed -i " s/safe_to_bootstrap.*/safe_to_bootstrap: 1/" /var/lib/mysql/grastate.dat
16
+ systemctl set-environment _WSREP_NEW_CLUSTER=' --wsrep-new-cluster'
17
+
18
+ else
19
+ echo " Waiting for master node to be initialized..."
20
+ COUNT=0
21
+ MAX=50
22
+ SLEEP_TIME=5
23
+ ERR=0
24
+
25
+ # Keep checking for port 3306 on the master to be open
26
+ until $( mysql -h $master_addr -u root -p" ${GALERA_DB_ROOT_PWD} " -e " " ) ; do
27
+ sleep ${SLEEP_TIME}
28
+ let " COUNT++"
29
+ echo ${COUNT}
30
+ if [ ${COUNT} -gt ${MAX} ]; then
31
+ ERR=1
32
+ break
33
+ fi
34
+ done
35
+ if [ ${ERR} -ne 0 ]; then
36
+ echo " Failed to find port 3306 open on master node, so guessing something is wrong."
37
+ exit 1
38
+ else
39
+ echo " starting slave"
40
+ fi
41
+ fi
You can’t perform that action at this time.
0 commit comments