Requirements such as the need to switch between the normal one and the primary from the main cascade from each other
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/71/4C/wKioL1XLAYnyTndVAAEbhAbwKyY248.jpg "title=" 20150812_2.png "alt=" Wkiol1xlaynytndvaaebhabwkyy248.jpg "/>
Here's the command for start slave until.
First, from left to right to do the conversion adjustment, a main two from the conversion to cascade from, first stop slave to the left is from the machine, we temporarily called S1 after, we need to operate on the right of the slave S2, it is best to use script execution, to ensure that does not affect online business, execute the statement as follows
Mysql-uroot-p "Password"-e "stop slave;"
Mysql-uroot-p "Password"-e "show Master Status\g" >/home/liuminkun/master.info
Mysql-uroot-p "Password"-e "show slave status\g" >/home/liuminkun/slave.info
Mysql-uroot-p "Password"-e "start slave;"
so we get in the text, the host m and a slave binlog and Pos letter, while confirmed that the Binlog file for M has a corresponding relationship to the Binlog file for S2
at this point we need to execute the start slave on the S1 of the cascade from which we need to convert until master_log_file = ' Log_name ', master_log_pos = Log_pos; The Binlog name and Log_pos here use the slave status that you just got in the text .
Information, the SQL thread stops automatically when you run to the POS point of the Binlog file and the IO thread continues to run, as long as the change master to the master status information in the text just before start Slave View the synchronization status of the S1.
And vice versa, such operations can avoid the reconfiguration of the schema by re-doing MySQL, and can also solve the data consistency problem after switching.
This article from "Cloud Light Breeze Light" blog, declined reprint!
MySQL master-slave relationship switching