一次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 恢复正常

你可能感兴趣的:(数据库,MYSQL基础)