2017-05-30 26 views
0

我配置了MySQL複製,它工作正常。偶然地,我刪除了/修改了從站上的一些用戶,並對主站執行了相同的操作。在此之後,複製停止和`顯示從狀態\ G」與GTID MySQL複製失敗,無法恢復它

mysql> show slave status \G 
*************************** 1. row *************************** 
       Slave_IO_State: Waiting for master to send event 
        Master_Host: mysql-servers01 
        Master_User: mysqlreplica 
        Master_Port: 3306 
       Connect_Retry: 60 
       Master_Log_File: mysql-bin.000002 
      Read_Master_Log_Pos: 1346 
       Relay_Log_File: mysql-servers02-relay-bin.000002 
       Relay_Log_Pos: 4681 
     Relay_Master_Log_File: mysql-bin.000001 
      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: 1032 
        Last_Error: Could not execute Delete_rows event on table mysql.user; Can't find record in 'user', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log mysql-bin.000001, end_log_pos 4974 
       Skip_Counter: 0 
      Exec_Master_Log_Pos: 4468 
       Relay_Log_Space: 9096 
       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: 1032 
       Last_SQL_Error: Could not execute Delete_rows event on table mysql.user; Can't find record in 'user', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log mysql-bin.000001, end_log_pos 4974 
    Replicate_Ignore_Server_Ids: 
      Master_Server_Id: 1 
        Master_UUID: aaa2545a-4437-11e7-9f03-0021f6f0406f 
      Master_Info_File: mysql.slave_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: 170529 21:06:36 
       Master_SSL_Crl: 
      Master_SSL_Crlpath: 
      Retrieved_Gtid_Set: aaa2545a-4437-11e7-9f03-0021f6f0406f:1-31 
      Executed_Gtid_Set: aaa2545a-4437-11e7-9f03-0021f6f0406f:1-20:31, 
acc29e29-4437-11e7-8074-0021f6f0406e:1-23 
       Auto_Position: 0 
     Replicate_Rewrite_DB: 
       Channel_Name: 
      Master_TLS_Version: 
1 row in set (0.00 sec) 

mysql> 

我試圖讓下面的錯誤設置SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1這給下面的消息,

mysql> SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; 
ERROR 1858 (HY000): sql_slave_skip_counter can not be set when the server is running with @@GLOBAL.GTID_MODE = ON. Instead, for each transaction that you want to skip, generate an empty transaction with the same GTID as the transaction 

的,我也嘗試下面的動作也該沒有幫助,

mysql> STOP SLAVE; 
Query OK, 0 rows affected (0.00 sec) 

mysql> SET GTID_NEXT="aaa2545a-4437-11e7-9f03-0021f6f0406f:20" 
    -> ; 
Query OK, 0 rows affected (0.00 sec) 

mysql> BEGIN; COMMIT; 
Query OK, 0 rows affected (0.00 sec) 

Query OK, 0 rows affected (0.00 sec) 

mysql> SET GTID_NEXT="acc29e29-4437-11e7-8074-0021f6f0406e:23"; 
Query OK, 0 rows affected (0.01 sec) 

mysql> BEGIN; COMMIT; 
Query OK, 0 rows affected (0.00 sec) 

Query OK, 0 rows affected (0.00 sec) 

mysql> SET GTID_NEXT="aaa2545a-4437-11e7-9f03-0021f6f0406f:31"; 
Query OK, 0 rows affected (0.00 sec) 

mysql> BEGIN; COMMIT; 
Query OK, 0 rows affected (0.00 sec) 

Query OK, 0 rows affected (0.00 sec) 

mysql> SET GTID_NEXT="AUTOMATIC"; 
Query OK, 0 rows affected (0.01 sec) 

mysql> START SLAVE; 
Query OK, 0 rows affected (0.00 sec) 

有什麼辦法恢復這一點,並作出正確的複製發生。

回答

0

我在Slave節點上重新安裝了MySQL,並重新配置它。