Pacemaker Corosync: различия между версиями
Sirmax (обсуждение | вклад) (Новая страница: «Категория:Pacemaker Категория:Corosync Категория:Устаревшее Категория:OpenStack Категория...») |
Sirmax (обсуждение | вклад) |
||
Строка 4: | Строка 4: | ||
[[Категория:OpenStack]] |
[[Категория:OpenStack]] |
||
[[Категория:Fuel]] |
[[Категория:Fuel]] |
||
+ | [[Категория:MySQL]] |
||
+ | [[Категория:Galera]] |
||
=Восстановление Galera запущенной под PCS= |
=Восстановление Galera запущенной под PCS= |
||
Это заметка о том как восстанавливать разваленный кластер, что бы не потерять если еще раз понадобится. |
Это заметка о том как восстанавливать разваленный кластер, что бы не потерять если еще раз понадобится. |
||
Строка 15: | Строка 17: | ||
pcs status resources |
pcs status resources |
||
On every controller in the cluster remove content of MySQL data directory (or move it to a different place): |
On every controller in the cluster remove content of MySQL data directory (or move it to a different place): |
||
+ | <PRE> |
||
mv /var/lib/mysql/* /tmp/mysql/ |
mv /var/lib/mysql/* /tmp/mysql/ |
||
+ | </PRE> |
||
Choose one of controllers that you are going to restore first. As an example, we will choose controller node named as controller-x |
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: |
Copy database backup to MySQL data directory on controller-x: |
||
+ | <PRE> |
||
cp -R /ext-volume/mysql-backup/* /var/lib/mysql/ |
cp -R /ext-volume/mysql-backup/* /var/lib/mysql/ |
||
+ | </PRE> |
||
Change the owner of MySQL data directory on controller-x: |
Change the owner of MySQL data directory on controller-x: |
||
+ | <PRE> |
||
chown -R mysql:mysql /var/lib/mysql |
chown -R mysql:mysql /var/lib/mysql |
||
+ | </PRE> |
||
Export variables for mysql-wss and start mysqld on controller-x: |
Export variables for mysql-wss and start mysqld on controller-x: |
||
+ | <PRE> |
||
export OCF_RESOURCE_INSTANCE=p_mysqld |
export OCF_RESOURCE_INSTANCE=p_mysqld |
||
export OCF_ROOT=/usr/lib/ocf |
export OCF_ROOT=/usr/lib/ocf |
||
Строка 30: | Строка 39: | ||
export OCF_RESKEY_additional_parameters="--wsrep-new-cluster" |
export OCF_RESKEY_additional_parameters="--wsrep-new-cluster" |
||
/usr/lib/ocf/resource.d/fuel/mysql-wss start |
/usr/lib/ocf/resource.d/fuel/mysql-wss start |
||
+ | </PRE> |
||
Execute monitor operation on controller-x to update Galera GTID in Pacemaker cluster configuration: |
Execute monitor operation on controller-x to update Galera GTID in Pacemaker cluster configuration: |
||
+ | <PRE> |
||
/usr/lib/ocf/resource.d/fuel/mysql-wss monitor |
/usr/lib/ocf/resource.d/fuel/mysql-wss monitor |
||
+ | </PRE> |
||
Export variables for mysql-wss and start mysqld on all other controllers: |
Export variables for mysql-wss and start mysqld on all other controllers: |
||
+ | <PRE> |
||
export OCF_RESOURCE_INSTANCE=p_mysqld |
export OCF_RESOURCE_INSTANCE=p_mysqld |
||
export OCF_ROOT=/usr/lib/ocf |
export OCF_ROOT=/usr/lib/ocf |
||
Строка 40: | Строка 53: | ||
export OCF_RESKEY_test_user=`crm_resource -r p_mysqld -g test_user` |
export OCF_RESKEY_test_user=`crm_resource -r p_mysqld -g test_user` |
||
/usr/lib/ocf/resource.d/fuel/mysql-wss start |
/usr/lib/ocf/resource.d/fuel/mysql-wss start |
||
+ | </PRE> |
||
From any controller in the cluster, enable MySQL resource in Pacemaker by running the following command: |
From any controller in the cluster, enable MySQL resource in Pacemaker by running the following command: |
||
+ | <PRE> |
||
pcs resource enable clone_p_mysqld |
pcs resource enable clone_p_mysqld |
||
+ | </PRE> |
||
Verify that clone set clone_p_mysqld is running on all controllers: |
Verify that clone set clone_p_mysqld is running on all controllers: |
||
pcs status resources |
pcs status resources |
Версия 09:58, 7 февраля 2024
Восстановление 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