MySQL5.1主從同步出現(xiàn)Relay log read failure錯誤解決方法
眾所周知MySQL5.1的Replication是比較爛的。MySQL的每一個版本更新關(guān)于同步方面每次都是可以看到一大堆。但MySQL 5.1性能是比較突出的。所以經(jīng)不住誘惑使用MySQL 5.1。所以也要經(jīng)常遇到一些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上的日值出問題了。
首先如果是中繼日值壞掉,那只需要找到同步的時間點(diǎn),然后重新同步,這樣就可以有新的中繼日值了。如果Master上的日值壞了就麻煩了。
從經(jīng)驗(yàn)來看,這是中繼日值出問題了。處理方法:
需要找到同步的點(diǎn)。
日值為:Master_Log_File: mysql-bin.005121,Relay_Master_Log_File: mysql-bin.005121以Relay_Master_Log_File為準(zhǔn),Master_Log_File為參考。
日值執(zhí)行時間點(diǎn):
那么現(xiàn)在就可以:
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;
進(jìn)行確認(rèn)。
建議:
在使用MySQL-5.1.36以下的版本的同學(xué),請盡快升級到MySQL-5.1.40 & MySQL-5.1.37sp1
- MySQL數(shù)據(jù)庫主從同步實(shí)戰(zhàn)過程詳解
- MySQL主從同步中的server-id示例詳解
- MySQL主從同步延遲的原因及解決辦法
- MySQL主從同步機(jī)制與同步延時問題追查過程
- Mysql主從同步的實(shí)現(xiàn)原理
- PHP入門教程之使用Mysqli操作數(shù)據(jù)庫的方法(連接,查詢,事務(wù)回滾等)
- MYSQL事務(wù)回滾的2個問題分析
- 詳解MySQL數(shù)據(jù)庫設(shè)置主從同步的方法
- Shell腳本實(shí)現(xiàn)監(jiān)控MySQL主從同步
- MySQL 主從同步,事務(wù)回滾的實(shí)現(xiàn)原理
相關(guān)文章
MySQL對數(shù)據(jù)庫操作(創(chuàng)建、選擇、刪除)
這篇文章主要介紹了MySQL如何對數(shù)據(jù)庫操作,文中講解非常詳細(xì),代碼幫助大家更好的理解和學(xué)習(xí),感興趣的朋友可以了解下2020-07-07MySQL之select、distinct、limit的使用
這篇文章主要介紹了MySQL之select、distinct、limit的使用,下面文章圍繞select、distinct、limit的相關(guān)資料展開聚集內(nèi)容,需要的朋友可以參考一下2021-11-11在MySQL數(shù)據(jù)庫中使用C執(zhí)行SQL語句的方法
與PostgreSQL相似,可使用許多不同的語言來訪問MySQL,包括C、C++、Java和Perl。從Professional Linux Programming中第5章有關(guān)MySQL的下列章節(jié)中,Neil Matthew和Richard Stones使用詳盡的MySQL C接口向我們介紹了如何在MySQL數(shù)據(jù)庫中執(zhí)行SQL語句。2012-10-10在MySQL中使用JOIN語句進(jìn)行連接操作的詳細(xì)教程
這篇文章主要介紹了在MySQL中使用JOIN語句進(jìn)行連接操作的詳細(xì)教程,是MySQL入門學(xué)習(xí)中的基礎(chǔ)知識,需要的朋友可以參考下2015-05-05SQL語句執(zhí)行深入講解(MySQL架構(gòu)總覽->查詢執(zhí)行流程->SQL解析順序)
這篇文章主要給大家介紹了SQL語句執(zhí)行的相關(guān)內(nèi)容,文中一步步給大家深入的講解,包括MySQL架構(gòu)總覽->查詢執(zhí)行流程->SQL解析順序,需要的朋友可以參考下2019-01-01在ubuntu中重置mysql服務(wù)器root密碼的方法
在ubuntu下安裝了mysql 5 server,結(jié)果不知道什么原因,安裝時輸入的root帳號密碼在使用時無論如何都不能通過數(shù)據(jù)庫服務(wù)器的驗(yàn)證。無奈只有重置mysql的root帳號密碼。查了一下,用了以下方法成功的重置了root帳號密碼2012-10-10MySQL?優(yōu)化?index?merge引起的死鎖分析
這篇文章主要介紹了MySQL?優(yōu)化?index?merge引起的死鎖分析,MySQL通過優(yōu)化索引合并是遇到的死鎖問題,下面具體分析需要的小伙伴可以參考一下2022-04-04