SHUTDOWN MARIADB CLUSTER NODES

PREREQUISITES

check out selinux, set to permissive if enforced

$ sudo sestatus
$ sudo enforce 0

 

 

IF EVERY NODE SHUTDOWNS

check grastate of each node, the highest seq. is the latest node you should initialize from

$ sudo tail -100 /var/lib/mysql/grastate.dat

initialize the highest node

$ sudo service mysql start –wsrep-new-cluster

if you see -1 in each node’s seqno you can recover the node by running

$ sudo /usr/sbin/mysqld -u root –wsrep-recover

hard to know which node has the latest when all nodes have -1, then you need to make a guess and must pick up the node and initialize the cluster

$ sudo service mysql start –wsrep-new-cluster

 

IF TWO NODES SHUTDOWN, ONE IS OK

try first to make join the 2 nodes to the existing cluster one by one

$ sudo service mysql start

if doesn’t start, try to recover each node to get its position internally

$ sudo /usr/sbin/mysqld -u root –wsrep-recover
$ sudo service mysql start

then run other nodes the same way

$ sudo service mysql start
Starting MySQL…SST in progress, setting sleep higher………………………………………….. SUCCESS!

 

TURN OF a SINGLE NODE

let’s turn off a single node, start from the latest i.e. db3

$ sudo service mysql stop

to make sure all mysql processes are shutdown

$ ps -ef | grep mysql

or

$ sudo pidof mysqld

if any mysql still running, then kill it

$ sudo kill -9 pid

on db2 or db1 check out cluster size

mysql>show status like ‘wsrep%’;

 

STOP THE ENTIRE GELARA CLUSTER (NOT RECOMMENDED)

mysql>show status like ‘wsrep_local_state%’;

if Synced then it is OK to start the shutdown node procedure. If the node is non-synchronized, you may shut it down anyway, but avoid to start a new cluster from this node in the future

mysql> set global wsrep_on=‘OFF’

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s