MySQL 5.6 supports deferred replication and can Specify a deferred value on the Slave server. The default value is 0 seconds. Use the Master_delay option to set the N -second delay for change masterto .
1. following the actual demo , the normal operation from the node execution, set the delay of two seconds
STOP SLAVE; Change MASTER to Master_delay = 100; START SLAVE; Show SLAVE status\g; display sql_delay:100--delay 100S Sql_remaining_delay:null
2. Set up cancel deferred replication
STOP SLAVE; Change MASTER to Master_delay=0; START SLAVE; SHOW SLAVE Status\g; sql_delay:0--Cancel delay Sql_remaining_delay:null
3. Testing
Master node creation library CREATE database TEST; View show SLAVE status\g from node; sql_delay:100 sql_remaining_delay:83 slave_sql_running_state:waiting until master_delay seconds after Mas ter executed event ....
4. Reference website Documentation
Https://dev.mysql.com/doc/refman/5.6/en/replication-delayed.html
This article is from the "ROIDBA" blog, make sure to keep this source http://roidba.blog.51cto.com/12318731/1893340
MySQL 5.6 Delayed replication, database recovery after mis-operation