背景
在MySQL集群环境中需要开启binlog,然后可以在其它节点解析主节点的binlog,写入到当前节点,达到集群环境数据同步的效果。在实际使用场景中经常会出现某条binlog还原失败的情况,同步任务会一直尝试,导致整个mysql集同步任务卡住。我们需要解析binlog找出是哪条sql导致的,然后想办法恢复集群。
操作步骤
1.查看从库状态
show slave status\G
Slave_IO_State: Waiting for master to send event
Master_Host: xxx.xxx.xxx.xxx
Master_User: sync
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000010
Read_Master_Log_Pos: 13572204
Relay_Log_File: vm081p009-relay-bin.000019