MySQL5.1主从同步出现Relay log read failure错误解决方法

所属分类: 数据库 / Mysql 阅读数: 436
收藏 0 赞 0 分享

众所周知MySQL5.1的Replication是比较烂的。MySQL的每一个版本更新关于同步方面每次都是可以看到一大堆。但MySQL 5.1性能是比较突出的。所以经不住诱惑使用MySQL 5.1。所以也要经常遇到一些Bug。如:

复制代码 代码如下:

mysql> show slave status\G
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 192.168.10.118
                  Master_User: repl_wu
                  Master_Port: 3306
                Connect_Retry: 30
              Master_Log_File: mysql-bin.005121
          Read_Master_Log_Pos: 64337286
               Relay_Log_File: relay-bin.003995
                Relay_Log_Pos: 18446697137031827760
        Relay_Master_Log_File: mysql-bin.005121
             Slave_IO_Running: Yes
            Slave_SQL_Running: No
              Replicate_Do_DB:
          Replicate_Ignore_DB:
           Replicate_Do_Table:
       Replicate_Ignore_Table:
      Replicate_Wild_Do_Table:
  Replicate_Wild_Ignore_Table:
                   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: 4
              Relay_Log_Space: 64337901
              Until_Condition: None
               Until_Log_File:
                Until_Log_Pos: 0
           Master_SSL_Allowed: No
           Master_SSL_CA_File:
           Master_SSL_CA_Path:
              Master_SSL_Cert:
            Master_SSL_Cipher:
               Master_SSL_Key:
        Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 0
                Last_IO_Error:
               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.
1 row in set (0.00 sec)

从上面可以看到是中继日值或是Master上的日值出问题了。

首先如果是中继日值坏掉,那只需要找到同步的时间点,然后重新同步,这样就可以有新的中继日值了。如果Master上的日值坏了就麻烦了。

从经验来看,这是中继日值出问题了。处理方法:

需要找到同步的点。

日值为:Master_Log_File: mysql-bin.005121,Relay_Master_Log_File: mysql-bin.005121以Relay_Master_Log_File为准,Master_Log_File为参考。

日值执行时间点:

复制代码 代码如下:
Exec_Master_Log_Pos: 4

那么现在就可以:

复制代码 代码如下:

mysql>stop slave;
 
mysql>change master to Master_Log_File='mysql-bin.005121', Master_Log_Pos=4;
  
mysql>start slave;
 
mysql>show slave status\G;

进行确认。

建议:

在使用MySQL-5.1.36以下的版本的同学,请尽快升级到MySQL-5.1.40 & MySQL-5.1.37sp1

更多精彩内容其他人还在看

MySQL中的基本查询语句学习笔记

这篇文章主要介绍了MySQL中的基本查询语句学习笔记,包括使用limit限制查询结果条数和合并查询结果的方法,需要的朋友可以参考下
收藏 0 赞 0 分享

详解MySQL中的分组查询与连接查询语句

这篇文章主要介绍了MySQL中的分组查询与连接查询语句,同时还介绍了一些统计函数的用法,需要的朋友可以参考下
收藏 0 赞 0 分享

linux下安装升级mysql到新版本(5.1-5.7)

这篇文章主要介绍了linux下安装升级mysql到新版本(5.1-5.7),需要的朋友可以参考下
收藏 0 赞 0 分享

MySQL备份时排除指定数据库的方法

这篇文章主要介绍了MySQL备份时排除指定数据库的方法的相关资料,需要的朋友可以参考下
收藏 0 赞 0 分享

Mysql数据库之索引优化

MySQL凭借着出色的性能、低廉的成本、丰富的资源,已经成为绝大多数互联网公司的首选关系型数据库。本文给大家介绍mysql数据库之索引优化,感兴趣的朋友一起学习吧
收藏 0 赞 0 分享

Mysql性能优化方案分享

这篇文章主要为大家分享了Mysql性能优化方案,帮助大家进行Mysql性能优化,感兴趣的小伙伴们可以参考一下
收藏 0 赞 0 分享

MySQL中一些常用的数据表操作语句笔记

这篇文章主要介绍了MySQL中一些常用的数据表操作语句笔记,其中重点讲解了删除关联表的方法,需要的朋友可以参考下
收藏 0 赞 0 分享

mysql版本5.5.x升级到5.6.x步骤分享

在我做的一个项目中,最近我对生产服务器上的一系列系统软件进行了升级,包括git、nginx、MySQL和PHP。这篇文章讲的是升级MySQL的过程,其他软件的升级将在其他文章中介绍。
收藏 0 赞 0 分享

Mysql IO 内存方面的优化

这篇文章主要介绍了Mysql IO 内存方面的优化 的相关资料,需要的朋友可以参考下
收藏 0 赞 0 分享

Mysql忘记root密码怎么办

MySQL有时候忘记了root密码是一件伤感的事,下面通过本文给大家介绍Mysql忘记root密码怎么办的相关知识,需要的朋友参考下
收藏 0 赞 0 分享
查看更多