You can stop and start the replication of statements on the
slave using the STOP SLAVE
and
START SLAVE
statements.
To stop execution of the binary log from the master, use
STOP SLAVE
:
mysql> STOP SLAVE;
When execution is stopped, the slave does not read the binary
log from the master (the IO_THREAD
) and stops
processing events from the relay log that have not yet been
executed (the SQL_THREAD
). You can pause
either the IO or SQL threads individually by specifying the
thread type. For example:
mysql> STOP SLAVE IO_THREAD;
Stopping the SQL thread can be useful if you want to perform a backup or other task on a slave that only processes events from the master. The IO thread will continue to be read from the master, but not executed, which will make it easier for the slave to catch up when you start slave operations again.
Stopping the IO thread will allow the statements in the relay log to be executed up until the point where the relay log has ceased to receive new events. Using this option can be useful when you want to pause execution to allow the slave to catch up with events from the master, when you want to perform administration on the slave but also ensure you have the latest updates to a specific point. This method can also be used to pause execution on the slave while you conduct administration on the master while ensuring that there is not a massive backlog of events to be executed when replication is started again.
To start execution again, use the START
SLAVE
statement:
mysql> START SLAVE;
If necessary, you can start either the
IO_THREAD
or SQL_THREAD
threads individually.
User Comments
Add your own comment.