随笔 - 746  文章 - 0  评论 - 39  阅读 - 79万

Mysql:How do I force the master to block updates until the slave catches up?

 

A.14.4.

How do I force the master to block updates until the slave catches up?

 

Use the following procedure:

  1. On the master, execute these statements:

    FLUSH TABLES WITH READ LOCK;
    SHOW MASTER STATUS;

    Record the replication coordinates (the current binary log file name and position) from the output of the SHOW statement.

  2. On the slave, issue the following statement, where the arguments to the MASTER_POS_WAIT() function are the replication coordinate values obtained in the previous step:

    SELECT MASTER_POS_WAIT('log_name', log_pos);
    log_name
    log_pos

    The SELECT statement blocks until the slave reaches the specified log file and position. At that point, the slave is in synchrony with the master and the statement returns.

  3. On the master, issue the following statement to enable the master to begin processing updates again:

    mysql> UNLOCK TABLES;
    
posted on   jinzhenshui  阅读(164)  评论(0编辑  收藏  举报
编辑推荐:
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 【杭电多校比赛记录】2025“钉耙编程”中国大学生算法设计春季联赛(1)
历史上的今天:
2009-03-25 Linux (转)解析 xinetd.conf
2009-03-25 Linux 架设telnet服务器

点击右上角即可分享
微信分享提示