Pacemaker Corosync
Восстановление Galera запущенной под PCS
Это заметка о том как восстанавливать разваленный кластер, что бы не потерять если еще раз понадобится.
From any controller in the cluster, disable MySQL resource in Pacemaker by running the following command:
pcs resource disable clone_p_mysqld
Wait a certain amount of time for MySQL to shut down. Verify that clone set clone_p_mysql is stopped on all controllers: pcs status resources On every controller in the cluster remove content of MySQL data directory (or move it to a different place):
mv /var/lib/mysql/* /tmp/mysql/
Choose one of controllers that you are going to restore first. As an example, we will choose controller node named as controller-x Copy database backup to MySQL data directory on controller-x:
cp -R /ext-volume/mysql-backup/* /var/lib/mysql/
Change the owner of MySQL data directory on controller-x:
chown -R mysql:mysql /var/lib/mysql
Export variables for mysql-wss and start mysqld on controller-x:
export OCF_RESOURCE_INSTANCE=p_mysqld export OCF_ROOT=/usr/lib/ocf export OCF_RESKEY_socket=/var/run/mysqld/mysqld.sock export OCF_RESKEY_master_timeout=10 export OCF_RESKEY_test_passwd=`crm_resource -r p_mysqld -g test_passwd` export OCF_RESKEY_test_user=`crm_resource -r p_mysqld -g test_user` export OCF_RESKEY_additional_parameters="--wsrep-new-cluster" /usr/lib/ocf/resource.d/fuel/mysql-wss start
Execute monitor operation on controller-x to update Galera GTID in Pacemaker cluster configuration:
/usr/lib/ocf/resource.d/fuel/mysql-wss monitor
Export variables for mysql-wss and start mysqld on all other controllers:
export OCF_RESOURCE_INSTANCE=p_mysqld export OCF_ROOT=/usr/lib/ocf export OCF_RESKEY_socket=/var/run/mysqld/mysqld.sock export OCF_RESKEY_master_timeout=10 export OCF_RESKEY_test_passwd=`crm_resource -r p_mysqld -g test_passwd` export OCF_RESKEY_test_user=`crm_resource -r p_mysqld -g test_user` /usr/lib/ocf/resource.d/fuel/mysql-wss start
From any controller in the cluster, enable MySQL resource in Pacemaker by running the following command:
pcs resource enable clone_p_mysqld
Verify that clone set clone_p_mysqld is running on all controllers: pcs status resources