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

所属分类: 数据库 / Mysql 阅读数: 432
收藏 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中distinct和count(*)的使用方法比较

这篇文章主要针对MySQL中distinct和count(*)的使用方法比较,对两者之间的使用方法、效率进行了详细分析,感兴趣的小伙伴们可以参考一下
收藏 0 赞 0 分享

Mysql命令大全(完整版)

这篇文章主要介绍了Mysql命令大全,分享的命令都是最基本的,推荐给大家,感兴趣的小伙伴们可以参考一下
收藏 0 赞 0 分享

Mysql常用命令汇总

这篇文章主要介绍了Mysql常用命令,都是mysql数据库日常最基本的操作命令,感兴趣的小伙伴们可以参考一下
收藏 0 赞 0 分享

MySQL最基本的命令使用汇总

这篇文章为大家分享了MySQL最基本的命令使用汇总,MySQL最基本的命令使用,包括如何正确连接MySQL(和PHP搭配之最佳组合),修改密码与增加新用户等相关内容的描述,感兴趣的小伙伴们可以参考一下
收藏 0 赞 0 分享

mysql命令行如何操作

这篇文章主要介绍了mysql命令行如何操作,还为大家分享了mysql添加环境变量的方法,感兴趣的小伙伴们可以参考一下
收藏 0 赞 0 分享

MySQL常用命令 MySQL处理数据库和表的命令

这篇文章主要介绍了MySQL常用命令,尤其是针对MySQL处理数据库和表的命令进行学习,特别适用于新手,感兴趣的小伙伴们可以参考一下
收藏 0 赞 0 分享

Mysql基础入门 轻松学习Mysql命令

这篇文章主要是Mysql基础入门教程,教大家如何轻松学习Mysql命令,并熟练掌握Mysql命令,感兴趣的小伙伴们可以参考一下
收藏 0 赞 0 分享

解决Mysql服务器启动时报错问题的方法

这篇文章主要介绍了解决Mysql服务器启动时报错问题的方法,需要的朋友可以参考下
收藏 0 赞 0 分享

MySql命令实例汇总

这篇文章主要介绍了MySql命令,结合实例分析了MySQL数据库的创建、连接及增删改查等各种常用操作的使用方法与相关注意事项,非常具有实用价值,需要的朋友可以参考下
收藏 0 赞 0 分享

Linux下实现MySQL数据备份和恢复的命令使用全攻略

这篇文章主要介绍了Linux下实现MySQL数据备份和恢复的命令使用全攻略,包括使用Mysqldump和LVM快照以及xtrabackup三种方法,倾力推荐!需要的朋友可以参考下
收藏 0 赞 0 分享
查看更多