mysql 主从错误处理:unblock with ‘mysqladmin flush-hosts‘ 和 Slave has more GTIDs than the master has

文章描述了一个MySQL主从复制过程中遇到的问题,包括因大量连接错误导致的主机被封锁以及GTID不匹配的错误。通过执行`mysqladminflush-hosts`和调整`max_connect_errors`参数尝试解决连接问题,但最终发现是主服务器的二进制日志问题。通过重置主从配置并指定新的日志文件和位置,成功恢复了同步。然而,由于先前killprocess导致的数据不一致无法自动恢复。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

昨天一次插入 10W 条记录、卡死了怎么办,发现从服务器状态错误,因为中途曾经几次 kill process,现在数据没有同步,状态也不对了!

20230818 又一次处理 unblock with ‘mysqladmin flush-hosts’

之前怎么会处理的那么复杂?

  1. 许久不查看 replica,今天查看的时候发现错误了

             Last_IO_Error: Error reconnecting to source '[email protected]:3306'. This was attempt 2077/86400, with a delay of 60 seconds between attempts. Message: Host '192.168.0.195' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'
    
  2. 处理方法
    提示信息中已经告知处理方法 : unblock with ‘mysqladmin flush-hosts’
    我还傻乎乎转了一圈

    1). 在 master
    mysql> flush hosts;
    Query OK, 0 rows affected, 1 warning (0.08 sec)
    2). 在 replica 确认一下能否连接上 master
    
    $ mysql -h192.168.0.XXX -uroot -p
    
    3). 在 replica ,无需重新启动 replica
    直接查看
    mysql> show replica status \G;
    
    OK
    

处理 unblock with ‘mysqladmin flush-hosts’

  1. 错误信息:

    Last_IO_Error: Error connecting to source ‘[email protected]:3306’. This was attempt 1/86400, with a delay of 60 seconds between attempts. Message: Host ‘192.168.0.103’ is blocked because of many connection errors; unblock with ‘mysqladmin flush-hosts’

     mysql> show replica status\G;
     *************************** 1. row ***************************
                  Replica_IO_State: Connecting to source
                       Source_Host: 192.168.0.101
                       Source_User: repl
                       Source_Port: 3306
                     Connect_Retry: 60
                   Source_Log_File: binlog.000001
               Read_Source_Log_Pos: 30115639
                    Relay_Log_File: ubuntu2004-103-relay-bin.000004
                     Relay_Log_Pos: 30111997
             Relay_Source_Log_File: binlog.000001
                Replica_IO_Running: Connecting
               Replica_SQL_Running: Yes
               ......
               Last_IO_Errno: 1129
                     Last_IO_Error: Error connecting to source '[email protected]:3306'. This was attempt 1/86400, with a delay of 60 seconds between attempts. Message: Host '192.168.0.103' is bloc
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

哈哈虎123

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值