hangkk2008

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

1032,1062 复制错误处理:非GTID模式跳过

1.跳过指定数量的事务:

#跳过一个事务
stop slave; SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; start slave;

2.修改mysql的配置文件,通过slave_skip_errors参数来跳所有错误或指定类型的错误
[mysqld]
#slave-skip-errors=1062,1032                            #跳过指定error no类型的错误
#slave-skip-errors=all #跳过所有错误

 

错误

1032:更新或者删除找不到记录

#当删除的列在从库,不存在

Last_SQL_Errno: 1032
Last_SQL_Error: Could not execute Delete_rows event on table school.student02; Can't find record in 'student02',
Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log mysql-bin.000001, end_log_pos 1431

#当更新的列在从库,不存在(报错和上面一样)

Last_SQL_Errno: 1032
Last_SQL_Error: Could not execute Update_rows event on table school.student02; Can't find record in 'student02',
Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log mysql-bin.000001, end_log_pos 1789

 1062: 主键冲突

Last_SQL_Errno: 1062
Last_SQL_Error: Could not execute Write_rows event on table school.student02; Duplicate entry '7' for key 'PRIMARY', 
Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log mysql-bin.000001, end_log_pos 2137

 

posted on 2019-04-04 13:46  鱼儿也疯狂  阅读(538)  评论(0)    收藏  举报