暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

Mysql主从同步异常处理

原创 wzf0072 2023-02-09
492

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;

主从节点数据不一致,需要进行校验修复

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论