MySQL 5.7延迟复制是通过设置复制参数MASTER_DELAY实现(单位为秒,就是从库延迟多少秒后执行这条SQL)
例如:
mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 10.10.1.101
.....
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
......
Seconds_Behind_Master: 0
.....
SQL_Delay: 0
SQL_Remaining_Delay: 0
......
Channel_Name: master
Master_TLS_Version:
1 row in set (0.00 sec)
配置复制master延迟14400秒
mysql> stop slave;
Query OK, 0 rows affected (0.00 sec)
mysql> CHANGE MASTER TO MASTER_DELAY=14400 for channel 'master';
Query OK, 0 rows affected (0.01 sec)`1q
mysql> start slave;
Query OK, 0 rows affected (0.01 sec)
查看结果
mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Opening tables
Master_Host: 10.10.1.101
.....
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
.....
Seconds_Behind_Master: 12
.......
SQL_Delay: 14400
SQL_Remaining_Delay: 12
........
Channel_Name: master
Master_TLS_Version:
1 row in set (0.00 sec)
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。