Deprecated: Optional parameter $keys declared before required parameter $cms_id is implicitly treated as a required parameter in /home/www/dev/work/class/blog/CmsKey.php on line 75

Deprecated: Creation of dynamic property lvesu\lvesu\controller\blog\main::$outlink is deprecated in /home/www/dev/work/website/lvesu/template/blog/cms/cms.tpl on line 2

Deprecated: Creation of dynamic property lvesu\lvesu\controller\blog\main::$status is deprecated in /home/www/dev/work/website/lvesu/template/blog/index.head.php on line 2
mysql设置延时从库 - 互联网笔记

略微加速

略速 - 互联网笔记

mysql设置延时从库

2021-03-30 leiting (3485阅读)

标签 MySql

CHANGE MASTER TO MASTER_DELAY = 1800;单位为秒

一行:

stop slave;CHANGE MASTER TO MASTER_DELAY = 1800;start slave;show SLAVE status;


[root@backup ~]# mysql -uroot -p123456  -e "show slave status \G"|grep  -i sqlmysql: [Warning] Using a password on the command line 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 has read all relay log; waiting for more updates
     Last_SQL_Error_Timestamp:



[root@backup ~]# mysql -uroot -p123456  -e "show slave status \G"|grep  -i sqlmysql: [Warning] Using a password on the command line 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: Waiting until MASTER_DELAY seconds after master executed event
     Last_SQL_Error_Timestamp: 
[root@backup ~]#



SQL_Delay:正数表明slave有延迟了。
SQL_Remaining_Delay:整数表明延迟时间。
Slave_SQL_Running_State:表明sql线程状态。


北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3