Mysql master-slave switchover steps
1> normal switchover
1) Check the output of the show processlist statement from the server until you see Has read all relaylogwaiting for the slave I/O thread to update it
2) Make sure that the slave server has processed all the statements in the log. Mysql> stop slave IO_THREAD
After the slave server completes these operations, they can be reconfigured as a new setting.
3) The stop slave, reset master, and reset slave operations are performed on the SLAVE server promoted to the MASTER server.
4) Then restart the mysql service.
5) create A user grant replication slave on *. * torepdcs @ 'IP of a' identified by 'replpwd' on the slave server (new master server'
Grant allprivileges on *. * to 'repdcs '@ 'IP' identified by replpwd;
6) RESET the MASTER on the MASTER server. Then change master TOMASTER_HOST = 'original slave server IP ', MASTER_USER = 'username', MASTER_PASSWORD = 'Password', master_log_file = 'master-bin.000015 ';
7) view the status show slave status \ G;
Show master status \ G;
If not, restart the MASTER database again and execute change master TOMASTER_HOST = '2017. 168.0.110 ', MASTER_USER = 'repdcs', MASTER_PASSWORD = '000000', master_log_file = 'mysqlbin. 000002 ';
8) modify the application connection address to the new master database.
Switch complete.
2> direct host downtime
1> execute stop slave and reset master on the SLAVE machine
2> View show slave status \ G;
3> modify the connection address of the application.
Generally, most of the switches to direct down hosts are unable to provide services.