O'Reilly logo

MySQL 8 Cookbook by Karthik Appigatla

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to do it...

  1. Stop the slave:
mysql> STOP SLAVE;Query OK, 0 rows affected (0.06 sec)
  1. Execute CHANGE MASTER TO MASTER_DELAY = and start the slave. Suppose you want a 1-hour delay, you can set MASTER_DELAY to 3600 seconds:
mysql> CHANGE MASTER TO MASTER_DELAY = 3600;Query OK, 0 rows affected (0.04 sec)mysql> START SLAVE;Query OK, 0 rows affected (0.00 sec)
  1. Check for the following in the slave status: SQL_Delay: Number of seconds by which the slave must lag the master. SQL_Remaining_Delay: Number of seconds left of the delay. This is NULL when there is delay is maintained. Slave_SQL_Running_State: The state of the SQL thread.
mysql> SHOW SLAVE STATUS\G*************************** 1. row *************************** Slave_IO_State: Waiting ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required