MySQL主从不一致修复
场景:
线上正在服务的库由于紧急主从切换导致主从不一致,报错信息如下:
Last_Error: Coordinator stopped because there were error(s) in the worker(s). The most recent failure being: Worker 0 failed executing transaction '8fc8d9ac-a62b-11e6-a3ee-a4badb1b4a00:7649' at master log mysql-bin.000011, end_log_pos 5290535. See error log and/or performance_schema.replication_applier_status_by_worker table for more details about this failure or others, if any.
出现这种错误如果少量的情况可以通过orc监控程序直接跳过
手动跳过几次还可以,如果特别多的话就比较崩溃了,所以我们直接选择使用设置slave_exec_mode来处理,关于slave_exec_mode的介绍可以参考
通过设置set global slave_exec_mode=IDEMPOTENT;等待从库和主库同步完成之后再把同步模式修改"严格模式"
set global slave_exec_mode=stric;
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步