Mysql主从同步异常处理
参考文档:https://blog.csdn.net/weixin_34684094/article/details/113204192 mysql 主从修复_MySQL主从不一致的修复过程
错误日志 show slave status: Coordinator stopped because there were error(s) in the worker(s). The most recent failure being: Worker 0 failed executing transaction '345d83dc-81d7-11ed-a7e4-0242ac120002:2964683' at master log mysql-bin.001686, end_log_pos 25548042. See error log and/or performance_schema.replication_applier_status_by_worker table for more details about this failure or others, if any.
错误日志 mysql error.log:[Warning] Slave SQL for channel '': Worker 0 failed executing transaction '345d83dc-81d7-11ed-a7e4-0242ac120002:2964684' at master log mysql-bin.001686, end_log_pos 26086812; Could not execute Delete_rows event on table rqwl-wms-prod.location_inventory_his; Unknown error 1032, Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log FIRST, end_log_pos 26086812, Error_code: 1032
处理办法:
办法1:逐个处理 因错误太多,使用办法2
mysql> STOP SLAVE;
mysql> SET @@SESSION.GTID_NEXT = '345d83dc-81d7-11ed-a7e4-0242ac120002:2964682';
mysql> BEGIN; COMMIT;
mysql> SET @@SESSION.GTID_NEXT = AUTOMATIC;
mysql> START SLAVE;
办法2:set global slave_exec_mode=IDEMPOTENT; stop slave;start slave;
关闭: set global slave_exec_mode=STRICT;
处理结果:
select count(1) from location_inventory_his;
主从节点数据不一致,需要进行校验修复




