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 master-slave delayed replication

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

Share

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

Master-slave replication of MySQL is the foundation of MySQL large-scale cluster, and it is widely used in daily production environment. After MySQL5.6 began to reconstruct and improve the underlying code of MySQL, master-slave replication of MySQL has made great progress, and master-slave multithreaded replication (https://blog.51cto.com/jim123/1961241) was introduced in version 5.7. Since version 5.6, master-slave replication of MySQL supports delayed replication of master on slave without the need for third-party tools. Master-slave replication delay can quickly recover deleted data after a certain time delay in slave after master mistakenly deleted data. As for the setting, you can simply add a parameter when connecting to the master database from the slave database:

CHANGE MASTER TO MASTER_DELAY = 3600th # the unit here is 3600 seconds, that is, an hour.

When slave is enabled, and if you look at the status of slave at this time, there are two parameters:

SQL_Delay: displays the set delay time of master / slave (in seconds); SQL_Remaining_Delay: displays the remaining delay time of master / slave (in seconds)

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