mysql 丛库不同步

在一台丛库上发现 不同步了,查看丛库状态如下:
mysql> show slave status\G;
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 10.51.180.93
                  Master_User: slaveuser
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: mysql-bin.000278
          Read_Master_Log_Pos: 979285779
               Relay_Log_File: appadmin-02-relay-bin.000177
                Relay_Log_Pos: 4349
        Relay_Master_Log_File: mysql-bin.000278
             Slave_IO_Running: Yes
            Slave_SQL_Running: No
              Replicate_Do_DB: 
          Replicate_Ignore_DB: mysql,information_schema,performance_schema,log,test,tmp
           Replicate_Do_Table: 
       Replicate_Ignore_Table: 
      Replicate_Wild_Do_Table: 
  Replicate_Wild_Ignore_Table: 
                   Last_Errno: 1062
                   Last_Error: Error 'Duplicate entry '110842310' for key 'PRIMARY'' on query. Default database: 'boss'. Query: 'insert into message_id_sequence set id = 0'
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 907321199
              Relay_Log_Space: 979286862
              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 '110842310' for key 'PRIMARY'' on query. Default database: 'boss'. Query: 'insert into message_id_sequence set id = 0'
  Replicate_Ignore_Server_Ids: 
             Master_Server_Id: 255
                  Master_UUID: cadca151-4896-11e5-a6dd-00163e000499
             Master_Info_File: /data2/mysql/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: 150929 11:26:31
               Master_SSL_Crl: 
           Master_SSL_Crlpath: 
           Retrieved_Gtid_Set: 
            Executed_Gtid_Set: 
                Auto_Position: 0
1 row in set (0.00 sec)
 
发现有个错误,Slave_SQL_Running:NO sql没有运行,key重复了,导致丛库不继续干活了
解决办法:
找到指定的表 删除该重复key的记录,
delete from message_id_sequence where id =  110842310;
停止slave
stop slave;
重新启动slave
start slave;
 
查看状态:
mysql> show slave status\G;
发现状态都正常了,只是落后master,等待赶上就ok了


你可能感兴趣的:(mysql,同步)