当前位置: 首页 > MySQL数据库

怎么解决MySQL中the master's binary log is corrupted报错问题

时间:2026-01-28 14:10:47

主从复制报错,下面是从库复制状态:

mysql> show slave status\G;

*************************** 1. row ***************************

               Slave_IO_State: Waiting for master to send event

                  Master_Host: 192.168.129.150

                  Master_User: replicat

                  Master_Port: 3306

                Connect_Retry: 60

              Master_Log_File: mysql-bin.000197

          Read_Master_Log_Pos: 213271941

               Relay_Log_File: mysql-relay-bin.000584

                Relay_Log_Pos: 1037392990

        Relay_Master_Log_File: mysql-bin.000195

             Slave_IO_Running: Yes

            Slave_SQL_Running: No

...

                   Last_Errno: 1594

                   Last_Error: Relay log read failure: Could not parse relay log event entry. The possible reasons are: the master's binary log is corrupted (you can check this by running 'mysqlbinlog' on the binary log), the slave's relay log is corrupted (you can check this by running 'mysqlbinlog' on the relay log), a network problem, or a bug in the master's or slave's MySQL code. If you want to check the master's binary log or slave's relay log, you will be able to know their names by issuing 'SHOW SLAVE STATUS' on this slave.

                 Skip_Counter: 0

          Exec_Master_Log_Pos: 1037392827

              Relay_Log_Space: 2368588837

...

               Last_SQL_Errno: 1594

               Last_SQL_Error: Relay log read failure: Could not parse relay log event entry. The possible reasons are: the master's binary log is corrupted (you can check this by running 'mysqlbinlog' on the binary log), the slave's relay log is corrupted (you can check this by running 'mysqlbinlog' on the relay log), a network problem, or a bug in the master's or slave's MySQL code. If you want to check the master's binary log or slave's relay log, you will be able to know their names by issuing 'SHOW SLAVE STATUS' on this slave.

  Replicate_Ignore_Server_Ids:

             Master_Server_Id: 3

                  Master_UUID: 58c0c354-8652-11e6-bebe-40f2e9ddc532

             Master_Info_File: /data/DB/mysql/master.info

                    SQL_Delay: 0

          SQL_Remaining_Delay: NULL

      Slave_SQL_Running_State:

           Master_Retry_Count: 86400

                  Master_Bind:

      Last_IO_Error_Timestamp:

     Last_SQL_Error_Timestamp: 161018 09:38:49

....

中继日志读主库日志失败 ,顺道看下错误日志信息,日志显示从库9点37分时重启了,38分出现主从故障,看样子是因为从库异常重启导致的!

161018 09:37:39 mysqld_safe Number of processes running now: 0

161018 09:37:39 mysqld_safe mysqld restarted

...

2016-10-18 09:38:49 6042 [ERROR] Slave SQL: Relay log read failure: Could not parse relay log event entry. The possible reasons are: the master's binary log is corrupted (you can check this by running 'mysqlbinlog' on the binary log), the slave's relay log is corrupted (you can check this by running 'mysqlbinlog' on the relay log), a network problem, or a bug in the master's or slave's MySQL code. If you want to check the master's binary log or slave's relay log, you will be able to know their names by issuing 'SHOW SLAVE STATUS' on this slave. Error_code: 1594

解决方法,重新设置主从进程解决:

mysql> stop slave;

Query OK, 0 rows affected (0.02 sec)

mysql> reset slave;

Query OK, 0 rows affected (0.57 sec)

mysql> change master to master_host='192.168.129.150',

    -> master_user='replicat',

    -> master_password='passw',

    -> master_log_file='mysql-bin.000195',

    -> master_log_pos=1037392827;

Query OK, 0 rows affected, 2 warnings (0.07 sec)

mysql> start slave;

Query OK, 0 rows affected (0.03 sec)

以前从库异常重启都没发生这类情况,网上查了相关资料,发现和relay_log_info_repository和relay_log_info_repository这两个参数有关

mysql> show variables like '%relay_log_info_repository%';
+---------------------------+-------+
| Variable_name             | Value |
+---------------------------+-------+
| relay_log_info_repository | FILE  |
+---------------------------+-------+

1 row in set (0.00 sec)

mysql> show variables like '%relay_log_info_repository%';
+---------------------------+-------+
| Variable_name             | Value |
+---------------------------+-------+
| relay_log_info_repository | FILE  |
+---------------------------+-------+

1 row in set (0.00 sec)

把FILE修改成TABLE可以降低这种主从失败发生的概率。


上一篇:怎么安装percona server 5.7
下一篇:MySQL集群架构优劣势有哪些
mysql
  • 英特尔与 Vertiv 合作开发液冷 AI 处理器
  • 英特尔第五代 Xeon CPU 来了:详细信息和行业反应
  • 由于云计算放缓引发扩张担忧,甲骨文股价暴跌
  • Web开发状况报告详细介绍可组合架构的优点
  • 如何使用 PowerShell 的 Get-Date Cmdlet 创建时间戳
  • 美光在数据中心需求增长后给出了强有力的预测
  • 2027服务器市场价值将接近1960亿美元
  • 生成式人工智能的下一步是什么?
  • 分享在外部存储上安装Ubuntu的5种方法技巧
  • 全球数据中心发展的关键考虑因素
  • 英特尔与 Vertiv 合作开发液冷 AI 处理器

    英特尔第五代 Xeon CPU 来了:详细信息和行业反应

    由于云计算放缓引发扩张担忧,甲骨文股价暴跌

    Web开发状况报告详细介绍可组合架构的优点

    如何使用 PowerShell 的 Get-Date Cmdlet 创建时间戳

    美光在数据中心需求增长后给出了强有力的预测

    2027服务器市场价值将接近1960亿美元

    生成式人工智能的下一步是什么?

    分享在外部存储上安装Ubuntu的5种方法技巧

    全球数据中心发展的关键考虑因素