2013年1月28日 星期一

如何解決mmm replication fail 問題

今天lab 網路的database 遇到 replication fail,嘗試了幾個方法都沒辦法解決,後來看到另外一篇,搭配fix slave relay log curruption 之後,終於把他正常啟動了

 

1. mmm replication fail # mmm_control set_online shard0master1 MySQL Multi-Master Replication Manager Version: 1.2.6 Config file: mmm_mon.conf Daemon is running! Command sent to monitoring host. Result: ERROR: This server is 'REPLICATION_FAIL' now. It can't be switched to online.

 

2.遠端連線到replication fail那台database

#mysql > show slave status \G

就看到如下的錯誤

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)

 

3.開始進行 mysqlbinlog 修護

發現他顯示某一行有錯誤,可能是因為之前錯誤的顯示,這個能是由於在之前我的硬碟空間滿了,所以造成系統寫入有問題,即時我把硬碟空間刪除後,在重新啟動系統也沒用,因為file 已經corrupt

#mysqlbinlog mysql-relay.001722

 

4.在執行show slave status \G

記住下列兩個欄位

Relay_Master_Log_File: mysql-bin.001722

Exec_Master_Log_Pos: 4185958

5.執行下列comman ,跳過這段有問題的relay log

#mysql > stop slave;

#mysql> CHANGE master TO master_log_file='mysql-bin.001019', master_log_pos=4185958;

#mysql > start slave ;

沒有留言:

How to restore a deleted onenote page

復原不小心誤刪的onenote