MySQL 5.7 延迟复制
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MySQL 5.7 延迟复制相关的知识,希望对你有一定的参考价值。
mysql 5.7延迟复制是通过设置复制参数MASTER_DELAY实现(单位为秒,就是从库延迟多少秒后执行这条SQL)
例如:
mysql> show slave statusG
*************************** 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 statusG
*************************** 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)
以上是关于MySQL 5.7 延迟复制的主要内容,如果未能解决你的问题,请参考以下文章