Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

MySQL 5.6 delayed replication, database recovery after misoperation

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

MySQL 5.6supports deferred replication, and you can specify a value for latency on the Slave server. The default value is 0 seconds. Use the MASTER_DELAY option to set the N-second delay for CHANGE MASTERTO.

1. The following is an actual demonstration, which is executed normally from the slave node, and the setting delay is 100 seconds.

STOP SLAVE;CHANGE MASTER TO MASTER_DELAY = 100s start SLAVE;SHOW SLAVE STATUS\ G; display SQL_Delay: 100s-delay 100s SQL_Remaining_Delay: NULL

two。 Set to cancel delayed replication

STOP SLAVE; CHANGE MASTER TO MASTER_DELAY=0;START SLAVE;SHOW SLAVE STATUS\ G; SQL_Delay: 0-cancel delay SQL_Remaining_Delay: NULL

3. test

The master node creates a library CREATE DATABASE TEST; from the slave node to view the SHOW SLAVE STATUS\ Ghost. SQL_Delay: 100 SQL_Remaining_Delay: 83 Slave_SQL_Running_State: Waiting until MASTER_DELAY seconds after master executed event.

4. Refer to the official website documentation

Https://dev.mysql.com/doc/refman/5.6/en/replication-delayed.html

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report