One, normal switching
1) Check the output of the show Processlist statement from the server until you see have read all relaylogwaiting for the slave I/O thread to update it
2) Ensure that all statements in the log have been processed from the server. mysql> STOP SLAVE Io_thread
When these are done from the server, they can be reconfigured to a new setting.
3) on the slave server that is promoted to the primary server, issue the STOP slave and reset master and reset slave operations.
4) Then restart the MySQL service.
5) Create user grant replication Slave on * * [email protected] ' IP of A ' identified by ' replpwd ' in the standby server (new primary server)
Grant Allprivileges on * * to ' Repdcs ' @ ' IPs ' identified by REPLPWD;
6) Reset master on the primary server. Then change MASTER tomaster_host= ' original from server IP ', master_user= ' username ', master_password= ' password ', master_log_file= ' Master-bin.000015 ';
7) View status show slave status \g;
Show Master Status \g;
If not, restart the main library again and perform the change Master tomaster_host= ' 192.168.0.110 ', master_user= ' Repdcs ', master_password= ' 111111 ' on the standby, master_log_file= ' mysqlbin.000002 ';
8) Modify the app's connection address to the new main library
Switch is complete.
Second, host direct downtime
1> to perform stop SLAVE and reset MASTER on the standby machine
2> view show slave status \g;
3> then modifies the app's connection address.
Most of the switching to direct down the mainframe has been unable to provide services
MySQL Note Master-slave switch