当前位置:论坛首页 > Linux面板 > 求助

【待反馈】MySQL主从复制(重构版) 1.3,修复不了,都是失败,

发表在 Linux面板2023-3-12 15:29 [复制链接] 5 3595

QQ截图20230312152746.png
删除重新加也是一样,


*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host:
                  Master_User: TtDxQQsl
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: mysql-bin.000021
          Read_Master_Log_Pos: 3075060
               Relay_Log_File: relay-log-server.000003
                Relay_Log_Pos: 171410
        Relay_Master_Log_File: mysql-bin.000021
             Slave_IO_Running: Yes
            Slave_SQL_Running: No
              Replicate_Do_DB:
          Replicate_Ignore_DB:
           Replicate_Do_Table:
       Replicate_Ignore_Table:
      Replicate_Wild_Do_Table: %
  Replicate_Wild_Ignore_Table:
                   Last_Errno: 1062
                   Last_Error: Error 'Duplicate entry '167744' for key 'PRIMARY'' on query. Default database: 'mrtv'. Query: 'insert into mac_vod_store (user_id, vod_id) values (24039, 10024)'
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 2573892
              Relay_Log_Space: 719854
              Until_Condition: None
               Until_Log_File:
                Until_Log_Pos: 0
           Master_SSL_Allowed: No
           Master_SSL_CA_File:
           Master_SSL_CA_Path:
              Master_SSL_Cert:
            Master_SSL_Cipher:
               Master_SSL_Key:
        Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 0
                Last_IO_Error:
               Last_SQL_Errno: 1062
               Last_SQL_Error: Error 'Duplicate entry '167744' for key 'PRIMARY'' on query. Default database: 'mrtv'. Query: 'insert into mac_vod_store (user_id, vod_id) values (24039, 10024)'
  Replicate_Ignore_Server_Ids:
             Master_Server_Id: 1
                  Master_UUID: 252b2bd5-4222-11ed-ae28-c4346bb58f9c
             Master_Info_File: /www/server/data/master.info
                    SQL_Delay: 0
          SQL_Remaining_Delay: NULL
      Slave_SQL_Running_State:
           Master_Retry_Count: 86400
                  Master_Bind:
      Last_IO_Error_Timestamp:
     Last_SQL_Error_Timestamp: 230312 15:23:00
               Master_SSL_Crl:
           Master_SSL_Crlpath:
           Retrieved_Gtid_Set: 252b2bd5-4222-11ed-ae28-c4346bb58f9c:17243620-17245662
            Executed_Gtid_Set: 252b2bd5-4222-11ed-ae28-c4346bb58f9c:1-17244208,
d9f07301-761e-11ed-b842-6c3be5b39b20:1-1845
                Auto_Position: 1
         Replicate_Rewrite_DB:
                 Channel_Name:
           Master_TLS_Version:






使用道具 举报 只看该作者 回复
发表于 2023-3-12 17:38:12 | 显示全部楼层
您好,您是插入了相同的记录吗?主键冲突了
1.如果较少的错误可以手动解决,进入MySQL执行
  1. slave stop;
  2. set global sql_slave_skip_counter=n; \ n=正整数,,看你的错误有几条,就跳过几条  
  3. slave start;
复制代码

2.较多的情况下增加slave_skip_errors = 1062 参数
my.cnf 中增加slave_skip_errors = 1062 参数,忽略1062错误,若忽略多个错误,中间用逗号隔开,忽略所有用all
使用道具 举报 回复 支持 反对
发表于 2023-3-20 19:58:13 | 显示全部楼层
堡塔运维盏尽 发表于 2023-3-12 17:38
您好,您是插入了相同的记录吗?主键冲突了
1.如果较少的错误可以手动解决,进入MySQL执行

啥意思 没懂 插入什么 系统同步的 我没插入啊
使用道具 举报 回复 支持 反对
发表于 2023-3-20 20:04:56 | 显示全部楼层
堡塔运维盏尽 发表于 2023-3-12 17:38
您好,您是插入了相同的记录吗?主键冲突了
1.如果较少的错误可以手动解决,进入MySQL执行

我也 遇到这个问题
使用道具 举报 回复 支持 反对
发表于 2023-3-20 21:10:40 | 显示全部楼层
堡塔运维盏尽 发表于 2023-3-12 17:38
您好,您是插入了相同的记录吗?主键冲突了
1.如果较少的错误可以手动解决,进入MySQL执行

没用啊  我加了  还是报错
使用道具 举报 回复 支持 反对
发表于 2023-3-20 22:26:28 | 显示全部楼层
您好,MySQL主从的1062错误都是主键重复导致的,您那边做好服务器快照,以及数据库备份。
可参考下面文档处理1062错误
https://blog.csdn.net/ichen820/article/details/105653767
使用道具 举报 回复 支持 反对
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

普通问题处理

论坛响应时间:72小时

问题处理方式:排队(仅解答)

工作时间:白班:9:00 - 18:00

紧急运维服务

响应时间:3分钟

问题处理方式:宝塔专家1对1服务

工作时间:工作日:9:00 - 18:30

宝塔专业团队为您解决服务器疑难问题

点击联系技术免费分析

工作时间:09:00至18:30

快速回复 返回顶部 返回列表