服务器异常导致数据库日志异常,同步失败
解决方法:
登录数据库后通过show slave status\G命令查看 Relay_Master_Log_File 和 Exec_Master_Log_Pos两个参数确定日志同步失败的位置, 重新配置主从同步即可,命令如下:
mysql> stop slave; Query OK, 0 rows affected (0.00 sec) mysql> reset slave all; Query OK, 0 rows affected (0.06 sec) mysql> change master to master_host='XXX.XX.X.X',master_port=3306,master_user='root',master_password='XXXXXXX', master_log_file='mysql-bin.000055',master_log_pos=129546374; Query OK, 0 rows affected, 2 warnings (0.02 sec) mysql> start slave; Query OK, 0 rows affected (0.00 sec) mysql> show slave status\G; *************************** 1. row *************************** Slave_IO_State: Queueing master event to the relay log