zoukankan      html  css  js  c++  java
  • Last_IO_Errno: 1062

    主键冲突的错误 1062
     
    模拟错误:
     
    在主库上操作:
    create table test100(id int not null,name varchar(20),primary key(id));
    insert into test100 (id,name) values(100,'lianggj');
     
    在从库上操作:
    insert into test100 (id,name) values(200,'guo');
     
     
    在主库上操作:
    insert into test100 (id,name) values(200,'guo');
     
     
     
     
    mysql> show slave status \G;
    *************************** 1. row ***************************
                   Slave_IO_State: Waiting for master to send event
                      Master_Host: 192.168.56.56
                      Master_User: repl
                      Master_Port: 3306
                    Connect_Retry: 60
                  Master_Log_File: mysql-bin.000002
              Read_Master_Log_Pos: 955
                   Relay_Log_File: relay-bin.000006
                    Relay_Log_Pos: 897
            Relay_Master_Log_File: mysql-bin.000002
                 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: Could not execute Write_rows event on table lgj3306.test100; Duplicate entry '200' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log mysql-bin.000002, end_log_pos 924
                     Skip_Counter: 0
              Exec_Master_Log_Pos: 684
                  Relay_Log_Space: 1456
                  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: Could not execute Write_rows event on table lgj3306.test100; Duplicate entry '200' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log mysql-bin.000002, end_log_pos 924
      Replicate_Ignore_Server_Ids: 
                 Master_Server_Id: 563306
                      Master_UUID: 3c1ec304-e17d-11e6-9f17-080027746853
                 Master_Info_File: /data/mysql/3306/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: 170124 12:26:56
                   Master_SSL_Crl: 
               Master_SSL_Crlpath: 
               Retrieved_Gtid_Set: 3c1ec304-e17d-11e6-9f17-080027746853:1-8
                Executed_Gtid_Set: 3c1ec304-e17d-11e6-9f17-080027746853:1-7,
    e4602c16-e1db-11e6-9277-080027cc764c:1
                    Auto_Position: 1
             Replicate_Rewrite_DB: 
                     Channel_Name: 
               Master_TLS_Version:
     
    解决思路:
    以主库的为准,把从库上重复的数据删掉。
     
    错误解决:
    set sql_log_bin=0;
    delete from  xxx;
    set sql_log_bin=1;
    start slave sql_thread;
     
     
  • 相关阅读:
    十张伟大的科学瞬间
    机器学习如何破译早已消亡的古老语言?
    如何阻止「数码黑帮」偷走你的时间
    社会地位即服务, Status as a Service (二): 社交网络的投资回报率 (ROI)
    谁是你的创业竞争对手?
    酷!美国国家安全局(NSA)开源了逆向工程工具 Ghidra
    Linux终端下Ctrl+S卡死
    操作系统损坏重装是否能恢复lvm硬盘数据的相关实验
    How to write an iso file to usb driver
    linux screen的用法
  • 原文地址:https://www.cnblogs.com/l10n/p/7518403.html
Copyright © 2011-2022 走看看