Friday, November 24, 2023

.::: How to SwitchOver Master Slave GTID Replication MariaDB Using MaxScale :::.

 A. check status before swo

1. query to cek master
mysql -uroot -p -e "select @@hostname,@@version";
mysql -uroot -p -e "show master status";
mysql -uroot -p -e "show slave status\G" | grep -i -E "Slave_IO_State:| Master_Host:| Master_User:| Master_Port:| Relay_Master_Log_File:| Exec_Master_Log_Pos:| Seconds_Behind_Master:| Master_Server_Id:| Using_Gtid:| Gtid_IO_Pos:| Slave_SQL_Running_State:";


 

2. query to cek slave/secondary
mysql -uroot -p -e "select @@hostname,@@version";
mysql -uroot -p -e "show master status";
mysql -uroot -p -e "show slave status\G" | grep -i -E "Slave_IO_State:| Master_Host:| Master_User:| Master_Port:| Relay_Master_Log_File:| Exec_Master_Log_Pos:| Seconds_Behind_Master:| Master_Server_Id:| Using_Gtid:| Gtid_IO_Pos:| Slave_SQL_Running_State:";

 


B. swo with maxscale
 
maxctrl call command mariadbmon switchover MariaDB-Monitor-gtid gtid03-v33 gtid01-v31
 
maxctrl call command mariadbmon switchover MariaDB-Monitor-gtid gtid01-v31 gtid03-v33 

maxctrl call command mariadbmon switchover MariaDB-Monitor-gtid gtid02-v32 gtid01-v31
maxctrl call command mariadbmon switchover MariaDB-Monitor-gtid gtid01-v31 gtid02-v32 

 


C. check status after swo

1. query to cek master
mysql -uroot -p -e "select @@hostname,@@version";
mysql -uroot -p -e "show master status";
mysql -uroot -p -e "show slave status\G" | grep -i -E "Slave_IO_State:| Master_Host:| Master_User:| Master_Port:| Relay_Master_Log_File:| Exec_Master_Log_Pos:| Seconds_Behind_Master:| Master_Server_Id:| Using_Gtid:| Gtid_IO_Pos:| Slave_SQL_Running_State:";

 

2. query to cek slave/secondary
mysql -uroot -p -e "select @@hostname,@@version";
mysql -uroot -p -e "show master status";
mysql -uroot -p -e "show slave status\G" | grep -i -E "Slave_IO_State:| Master_Host:| Master_User:| Master_Port:| Relay_Master_Log_File:| Exec_Master_Log_Pos:| Seconds_Behind_Master:| Master_Server_Id:| Using_Gtid:| Gtid_IO_Pos:| Slave_SQL_Running_State:";

 

No comments:

Post a Comment

Popular Posts