Wednesday 6 March 2013

MySQL Safe Slave Replication Stop

If you are using MySQL mixed-format replication, in which Temporary tables are used for to process statements.
Temporary Tables are used to replicate the statement based data, they replicates data until you shutdown the Server (both SLAVE SQL_RUNNING & SLAVE IO RUNNING) using STOP SLAVE; command. Because if some updates are in temp tables and they are waiting to be execute. They will no longer be available in the Temp table after Slave Start. You can avoid this issue using following steps :
1) mysql> STOP SLAVE SQL_THREAD;
It will stop only the SQL Thread not The IO Thread.
2) mysql  > SHOW STATUS ;
Check here the value of "Slave_open_temp_tables"
3) If it is 0 , then you can go ahead and issue the mysql stop command. 
 If it's not 0 Start SLAVE_SQL_THREAD and repeat the same process from 1-2-3 after some time.

No comments:

Post a Comment