一次mysql slave故障的解決過程

mysql> show slave status\G
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. Error_code: 1594
看樣子,應該由於網絡原因 slave relay log損壞了

查看 mysql 日誌:
170306 12:34:08 [Note] Slave SQL thread initialized, starting replication in log ‘mysql-bin.000033’ at position 77270703, relay log ‘./HK3ASERVER-relay-bin.066281’ position: 10604437
170306 12:34:08 [ERROR] Error in Log_event::read_log_event(): ‘read error’, data_len: 67, event_type: 19
170306 12:34:08 [ERROR] Error reading relay log event: slave SQL thread aborted because of I/O error
170306 12:34:08 [ERROR] Slave SQL: 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. Error_code: 1594
170306 12:34:08 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with “SLAVE START”. We stopped at log ‘mysql-bin.000033’ position 77270703

mysql> stop slave;

mysql> change master to Master_Log_File=’mysql-bin.000033’, Master_Log_Pos=77270703;
This operation cannot be performed with a running slave; run STOP SLAVE first

mysql> show slave status\G
發現IO_THREAD線程一直存在停不掉

最後,將mysql/data目錄下的 master.info 備走,重新啓動 mysql

mysql> show slave status\G
發現 slave 已徹底停掉了

mysql> reset slave;
mysql> change master to Master_Log_File=’mysql-bin.000033’, Master_Log_Pos=77270703;
mysql> start slave;
Slave_IO_Running: Yes
Slave_SQL_Running: Yes

slave 恢復正常

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章