主從同步,從庫報錯代碼:1141 ,錯誤信息如下: 解決方法: 根據上述的主從同步信息, 在從庫上使用mysqlbinlog將日誌文件解析出來,命令如下: 在解析出來的文件中找到對應的POS點: 212230586 發現在執行 revoke語句 刪除用戶許可權。 查看從庫上的用戶庫,發現沒有用戶 f_ ...
主從同步,從庫報錯代碼:1141 ,錯誤信息如下:
Master_Port: 3306 Connect_Retry: 60 Master_Log_File: binlog.000086 Read_Master_Log_Pos: 596130762 Relay_Log_File: mysql-relay-bin.000486 Relay_Log_Pos: 212230586 Relay_Master_Log_File: binlog.000086 Slave_IO_Running: Yes Slave_SQL_Running: No Replicate_Do_DB: Replicate_Ignore_DB: information_schema,performance_schema,undolog,for_nagios Replicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table: information_schema.%,performance_schema.% Last_Errno: 1141 Last_Error: Coordinator stopped because there were error(s) in the worker(s). The most recent failure being: Worker 1 failed executing transaction '510f1fe6-aeba-4334-b18b-3c2043b52ff2:125151353' at master log binlog.000086, end_log_pos 547512983. See error log and/or performance_schema.replication_applier_status_by_worker table for more details about this failure or others, if any. Skip_Counter: 0 Exec_Master_Log_Pos: 547458856 Relay_Log_Space: 261211881 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: 1141 Last_SQL_Error: Coordinator stopped because there were error(s) in the worker(s). The most recent failure being: Worker 1 failed executing transaction '510f1fe6-aeba-4334-b18b-3c2043b52ff2:125151353' at master log binlog.000086, end_log_pos 547512983. See error log and/or performance_schema.replication_applier_status_by_worker table for more details about this failure or others, if any. Replicate_Ignore_Server_Ids: Master_Server_Id: 33 Master_UUID: 41f96eda-0f5a-11e9-ad75-00163e00d868 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: 190704 19:57:28 Master_SSL_Crl: Master_SSL_Crlpath: Retrieved_Gtid_Set: 510f1fe6-aeba-4334-b18b-3c2043b52ff2:25836646-125206230 Executed_Gtid_Set: 0b117566-0b1e-11e9-a8b4-00163e001495:1-3087343, 2479bd1b-1271-11e9-8c68-005056bd8639:1-81, 2d748950-c0fd-11e7-81f8-0050569175d7:35404018-35647968, 510f1fe6-aeba-4334-b18b-3c2043b52ff2:1-5363955:5393677-125151352, db981f90-01f5-11e9-8d52-00163e008b14:1-4218, e66adda1-ff8d-11e8-9d3d-00163e008b14:1-25261 Auto_Position: 0 Replicate_Rewrite_DB: Channel_Name: Master_TLS_Version:
解決方法:
根據上述的主從同步信息,
Relay_Log_File: mysql-relay-bin.000486
Relay_Log_Pos: 212230586
在從庫上使用mysqlbinlog將日誌文件解析出來,命令如下:
mysqlbinlog --no-defaults -v -v --base64-output=DECODE-ROWS mysql-relay-bin.000486 > /tmp/mysql-relay-bin.000486
在解析出來的文件中找到對應的POS點: 212230586
#190704 13:47:32 server id 1 end_log_pos 547458856 Xid = 4140969095 COMMIT/*!*/; # at 212230586 #190704 13:47:32 server id 1 end_log_pos 547458917 GTID last_committed=1230803 sequence_number=1230804 rbr_only=no SET @@SESSION.GTID_NEXT= '510f1fe6-aeba-4334-b18b-3c2043b52ff2:125151281'/*!*/; # at 212230647 #190704 13:47:32 server id 1 end_log_pos 547459084 Query thread_id=469641862 exec_time=0 error_code=0 SET TIMESTAMP=1562219252/*!*/; SET @@session.sql_mode=1436549152/*!*/; REVOKE GRANT OPTION ON `f_common`.* FROM 'f_common'@'172.20.73.%' /*!*/; # at 212230814
發現在執行 revoke語句 刪除用戶許可權。
查看從庫上的用戶庫,發現沒有用戶 f_common。 所以就出現問題了。
問題原因已經清楚了,後續就自己處理了。