ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
ALTER DATABASE FAILOVER TO stb;
ALTER DATABASE OPEN;
https://qiita.com/shotaTsuge/items/83e4387d6c8488677e17
(5.6)
--現マスターで実施
SHOW PROCESSLIST;
FLUSH TABLES WITH READ LOCK;
SHOW MASTER STATUS\G
SHOW STATUS LIKE 'Key_blocks_not_flushed';
\! mysql -u root -p -e "SHOW ENGINE INNODB STATUS\G" | grep -e "Log sequence number" -e "Log flushed up to"
--現スレーブで実施
STOP SLAVE IO_THREAD;
SHOW SLAVE STATUS\G
SHOW PROCESSLIST;
STOP SLAVE;
SHOW SLAVE STATUS\G
Master_Log_File,Read_Master_Log_Posがマスターと一致を確認
--現マスターで実施
RESET SLAVE ALL;
RESET MASTER;
SHOW MASTER STATUS\G
--現スレーブで実施
RESET SLAVE ALL;
RESET MASTER;
SHOW SLAVE STATUS\G
--新スレーブ(現マスター)で実施
CHANGE MASTER TO
MASTER_HOST='192.168.137.53',
MASTER_USER='repl',
MASTER_PASSWORD='repl',
MASTER_LOG_FILE='mysqld-bin.000001',
MASTER_LOG_POS=120;
start slave;
SHOW SLAVE STATUS\G
UNLOCK TABLES;
--新マスター(現スレーブ)で実施
SHOW MASTER STATUS\G
SHOW SLAVE HOSTS\G
SHOW SLAVE STATUS\G
-----------------------------------------------
MySQL Utilitiesのmysqlrpladminで実行可能
mysqlrpladmin -vv --slave=root:'Aaa!1234'@mmm053 failover
/usr/pgsql-9.4/bin/pg_ctl promote
(2019)
--スイッチオーバー先で実行する
use master
go
ALTER AVAILABILITY GROUP ag1 force_failover_allow_data_loss;
GO