Categories
linux pengkalan data

Apabila semua nod kluster Galera MariaDB shutdown

Tambah atau benarkan “enable_autorecovery=0” pada /etc/cmon.cnf pada nod ClusterControl.

Mulakan semula cmon

admin@cc:~$ sudo service cmon restart

Perhatikan perbezaan nombor “Recovered position” selepas tanda kolon.

admin@db2:~$ sudo mysqld_safe --wsrep-recover
150408 09:38:59 mysqld_safe Logging to '/var/log/mysql.log'.
150408 09:38:59 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
150408 09:38:59 mysqld_safe WSREP: Running position recovery with --log_error='/var/lib/mysql/wsrep_recovery.x2Epct' --pid-file='/var/lib/mysql/db2-recover.pid'
150408 09:39:25 mysqld_safe WSREP: Recovered position 00000000-0000-0000-0000-000000000000:-1
150408 09:39:34 mysqld_safe mysqld from pid file /var/lib/mysql/mysqld.pid ended

admin@db1:~$ sudo mysqld_safe --wsrep-recover
150408 09:40:22 mysqld_safe Logging to '/var/log/mysql.log'.
150408 09:40:22 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
150408 09:40:22 mysqld_safe WSREP: Running position recovery with --log_error='/var/lib/mysql/wsrep_recovery.ISjnrN' --pid-file='/var/lib/mysql/db1-recover.pid'
150408 09:40:32 mysqld_safe WSREP: Recovered position 1f6e96d3-dd06-11e4-a086-1a4287304197:92216

Berdasarkan situasi diatas, data db1 lebih terkini, jadi kita bootstrap db1.

admin@db1:~$ sudo mysqld --wsrep_cluster_address=gcomm://

admin@db1:~$ sudo tailf /var/log/mysql.log

Tunggu sampai ada mesej berikut di dalam /var/log/mysql.log

[Note] mysqld: ready for connections.

admin@db2:~$ sudo service mysql start

Tunggu sampai ada mesej berikut di dalam /var/log/mysql.log

[Note] /usr/sbin/mysqld: ready for connections.

Buang tetapan “enable_autorecovery=0” pada /etc/cmon.cnf pada nod ClusterControl.

Mulakan semula cmon

Siap.