mysql主从同步因断电产生的不能同步问题_MySQL

php中文网
发布: 2016-06-01 13:32:31
原创
1358人浏览过

bitsCN.com

mysql主从同步因断电产生的不能同步问题

 

偶尔因为断电导致mysql slave 出现复制错误“Could not parse relay log event entry”

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.

 

先查询下状态

show slave status /G

 

Master_Host: 192.168.2.51

                Master_User: backupuser

                Master_Port: 3306

              Connect_Retry: 60

            Master_Log_File: mysql-bin.000078

        Read_Master_Log_Pos: 984673998

             Relay_Log_File: memcached-relay-bin.000039

              Relay_Log_Pos: 747157846

      Relay_Master_Log_File: mysql-bin.000078

           Slave_IO_Running: Yes

          Slave_SQL_Running: No

 

          Skip_Counter: 0

        Exec_Master_Log_Pos: 747157709

            Relay_Log_Space: 984679197

 

如果可以确定主服务器没有问题的话,那么重置下从服务器的同步位置就可以了。

如上可以对应的指令为:

stop slave;

CHANGE MASTER TO  MASTER_LOG_FILE = 'mysql-bin.000078', MASTER_LOG_POS =747157709;

start slave;

再用 show slave status /G 查看状态。如下:

Master_Log_File: mysql-bin.000078

        Read_Master_Log_Pos: 879029246

             Relay_Log_File: memcached-relay-bin.000002

              Relay_Log_Pos: 1336369

      Relay_Master_Log_File: mysql-bin.000078

           Slave_IO_Running: Yes

          Slave_SQL_Running: Yes

            Replicate_Do_DB: 

        Replicate_Ignore_DB: 

         Replicate_Do_Table: 

     Replicate_Ignore_Table: 

    Replicate_Wild_Do_Table: 

Replicate_Wild_Ignore_Table: 

                 Last_Errno: 0

                 Last_Error: 

               Skip_Counter: 0

        Exec_Master_Log_Pos: 748493843

            Relay_Log_Space: 131871772

            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: 339469

 

好了到现在搞定了。

还有说法是内存不够用产生的,有人清除了几个不用的进程释放内存后, stop slave; start slave;然后好了,我遇到的不是这个情况,如果你遇到了,按我上面的不能解决的话,可以试着释放内存看看。

 

bitsCN.com
最佳 Windows 性能的顶级免费优化软件
最佳 Windows 性能的顶级免费优化软件

每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。

下载
相关标签:
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号