设置mysql从库延迟主库一小时

2018-11-07  本文已影响21人  a0f39b0b2030

便于数据恢复,设置从库延迟主库1个小时

此图借用李磊的 直接上图了 非本人笔记

CHANGE MASTER TO MASTER_DELAY = 1800;单位为秒 小程序开发找上海捌跃网络科技有限公司

[root@backup ~]# mysql -uroot -p123456  -e "show slave status \G"|grep  -i sqlmysql:[Warning]Using a password on thecommandline interface can be insecure.              Master_Log_File: mysql-bin.000008        Relay_Master_Log_File: mysql-bin.000008            Slave_SQL_Running: Yes              Last_SQL_Errno: 0              Last_SQL_Error:              Master_Info_File: /home/nflow/data/backup/mysql/data/master.info                    SQL_Delay: 0          SQL_Remaining_Delay: NULL      Slave_SQL_Running_State: Slave hasreadall relay log;waitingformoreupdates    Last_SQL_Error_Timestamp:

[root@backup ~]# mysql -uroot -p123456  -e "show slave status \G"|grep  -i sqlmysql:[Warning]Using a password on thecommandline interface can be insecure.              Master_Log_File: mysql-bin.000008        Relay_Master_Log_File: mysql-bin.000008            Slave_SQL_Running: Yes              Last_SQL_Errno: 0              Last_SQL_Error:              Master_Info_File: /home/nflow/data/backup/mysql/data/master.info                    SQL_Delay: 1800#代表延迟同步1800s      SQL_Remaining_Delay: 1775#从1800 每秒减一个Slave_SQL_Running_State: WaitinguntilMASTER_DELAY seconds after master executed event    Last_SQL_Error_Timestamp:[root@backup ~]#

SQL_Delay:正数表明slave有延迟了。

SQL_Remaining_Delay:整数表明延迟时间。

Slave_SQL_Running_State:表明sql线程状态。

转自:http://blog.51cto.com/wsxxsl/2313907

上一篇 下一篇

猜你喜欢

热点阅读