MySQL5.1主從同步出現(xiàn)Relay log read failure錯(cuò)誤解決方法
眾所周知MySQL5.1的Replication是比較爛的。MySQL的每一個(gè)版本更新關(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上的日值出問(wèn)題了。
首先如果是中繼日值壞掉,那只需要找到同步的時(shí)間點(diǎn),然后重新同步,這樣就可以有新的中繼日值了。如果Master上的日值壞了就麻煩了。
從經(jīng)驗(yàn)來(lái)看,這是中繼日值出問(wè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í)行時(shí)間點(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é),請(qǐng)盡快升級(jí)到MySQL-5.1.40 & MySQL-5.1.37sp1
- MySQL數(shù)據(jù)庫(kù)主從同步實(shí)戰(zhàn)過(guò)程詳解
- MySQL主從同步中的server-id示例詳解
- MySQL主從同步延遲的原因及解決辦法
- MySQL主從同步機(jī)制與同步延時(shí)問(wèn)題追查過(guò)程
- Mysql主從同步的實(shí)現(xiàn)原理
- PHP入門(mén)教程之使用Mysqli操作數(shù)據(jù)庫(kù)的方法(連接,查詢(xún),事務(wù)回滾等)
- MYSQL事務(wù)回滾的2個(gè)問(wèn)題分析
- 詳解MySQL數(shù)據(jù)庫(kù)設(shè)置主從同步的方法
- Shell腳本實(shí)現(xiàn)監(jiān)控MySQL主從同步
- MySQL 主從同步,事務(wù)回滾的實(shí)現(xiàn)原理
相關(guān)文章
MySQL數(shù)據(jù)庫(kù)內(nèi)置函數(shù)使用說(shuō)明
這篇文章主要給大家介紹了關(guān)于MySQL數(shù)據(jù)庫(kù)內(nèi)置函數(shù)使用說(shuō)明的相關(guān)資料,MySQL提供了多種內(nèi)置函數(shù)來(lái)實(shí)現(xiàn)不同的功能,文中通過(guò)圖文介紹的非常詳細(xì),需要的朋友可以參考下2023-12-12
Mysql恢復(fù)誤刪庫(kù)表數(shù)據(jù)完整場(chǎng)景演示
在開(kāi)發(fā)和在生產(chǎn)中總會(huì)出現(xiàn)各種各樣的失誤和意味,當(dāng)MySQL的數(shù)據(jù)或表被刪除后不要慌,下面這篇文章主要給大家介紹了關(guān)于Mysql恢復(fù)誤刪庫(kù)表數(shù)據(jù)的相關(guān)資料,文中通過(guò)代碼介紹的非常詳細(xì),需要的朋友可以參考下2024-07-07
mysql數(shù)據(jù)庫(kù)之count()函數(shù)和sum()函數(shù)用法及區(qū)別說(shuō)明
這篇文章主要介紹了mysql數(shù)據(jù)庫(kù)之count()函數(shù)和sum()函數(shù)用法及區(qū)別說(shuō)明,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-06-06
mysql-8.0.15-winx64 使用zip包進(jìn)行安裝及服務(wù)啟動(dòng)后立即關(guān)閉問(wèn)題
這篇文章主要介紹了mysql 使用zip包進(jìn)行安裝以及服務(wù)啟動(dòng)后立即關(guān)閉問(wèn)題 ,本實(shí)例使用的mysql版本為mysql-8.0.15-winx64,需要的朋友可以參考下2019-05-05
MYSQL數(shù)據(jù)表基本操作之創(chuàng)建+查看+修改+刪除操作方法
本文將介紹如何在MySQL數(shù)據(jù)庫(kù)中進(jìn)行數(shù)據(jù)表的創(chuàng)建、查看、修改和刪除操作,并討論一些常見(jiàn)的注意事項(xiàng)及防止誤操作的策略,通過(guò)這些基礎(chǔ)操作,您將能夠更高效地進(jìn)行數(shù)據(jù)庫(kù)設(shè)計(jì)和管理工作,感興趣的朋友一起看看吧2025-04-04
MySQL for update鎖表還是鎖行校驗(yàn)(過(guò)程詳解)
在MySQL中,使用for update子句可以對(duì)查詢(xún)結(jié)果集進(jìn)行行級(jí)鎖定,以便在事務(wù)中對(duì)這些行進(jìn)行更新或者防止其他事務(wù)對(duì)這些行進(jìn)行修改,這篇文章主要介紹了MySQL for update鎖表還是鎖行校驗(yàn),需要的朋友可以參考下2024-02-02
詳解MySQL中Order By排序和filesort排序的原理及實(shí)現(xiàn)
這篇文章主要為大家詳細(xì)介紹了MySQL的Order By排序的底層原理與filesort排序,以及排序優(yōu)化手段,文中的示例代碼講解詳細(xì),感興趣的小編可以跟隨小編一起學(xué)習(xí)一下2022-08-08
優(yōu)化MySQL數(shù)據(jù)庫(kù)中的查詢(xún)語(yǔ)句詳解
這篇文章主要介紹了優(yōu)化MySQL數(shù)據(jù)庫(kù)中的查詢(xún)語(yǔ)句,非常實(shí)用的經(jīng)驗(yàn)總結(jié),需要的朋友可以參考下2014-07-07
MySQL 創(chuàng)建索引(Create Index)的方法和語(yǔ)法結(jié)構(gòu)及例子
MySQL 創(chuàng)建索引(Create Index)的方法和語(yǔ)法結(jié)構(gòu)及例子2009-07-07

