root@[(none)] 05:36:24> show slave status\G;*************************** 1. row ***************************Slave_IO_State: Waiting for master to send eventMaster_Host: 10.1.8.24Master_User: replMaster_Port: 3306Connect_Retry: 60Master_Log_File: mysql-bin.000009Read_Master_Log_Pos: 49413140Relay_Log_File: mysqld-relay-bin.000011Relay_Log_Pos: 2043387Relay_Master_Log_File: mysql-bin.000002Slave_IO_Running: YesSlave_SQL_Running: NoReplicate_Do_DB:Replicate_Ignore_DB:Replicate_Do_Table:Replicate_Ignore_Table:Replicate_Wild_Do_Table: zabbix.%Replicate_Wild_Ignore_Table:Last_Errno: 1032Last_Error: Could not execute Update_rows event on table zabbix.user_history; Can't find record in 'user_history', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log mysql-bin.000002, end_log_pos 28739818Skip_Counter: 0Exec_Master_Log_Pos: 28739081Relay_Log_Space: 783475657Until_Condition: NoneUntil_Log_File:Until_Log_Pos: 0Master_SSL_Allowed: NoMaster_SSL_CA_File:Master_SSL_CA_Path:Master_SSL_Cert:Master_SSL_Cipher:Master_SSL_Key:Seconds_Behind_Master: NULLMaster_SSL_Verify_Server_Cert: NoLast_IO_Errno: 0Last_IO_Error:Last_SQL_Errno: 1032Last_SQL_Error: Could not execute Update_rows event on table zabbix.user_history; Can't find record in 'user_history', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log mysql-bin.000002, end_log_pos 28739818Replicate_Ignore_Server_Ids:Master_Server_Id: 1Master_UUID: 7bdd3156-ff10-11e3-91dc-001018a0b030Master_Info_File: /var/lib/mysql/master.infoSQL_Delay: 0SQL_Remaining_Delay: NULLSlave_SQL_Running_State:Master_Retry_Count: 86400Master_Bind:Last_IO_Error_Timestamp:Last_SQL_Error_Timestamp: 140928 05:33:17Master_SSL_Crl:Master_SSL_Crlpath:Retrieved_Gtid_Set: 7bdd3156-ff10-11e3-91dc-001018a0b030:1-732546Executed_Gtid_Set: 7bdd3156-ff10-11e3-91dc-001018a0b030:1-107805 #当前slave执行到的位置Auto_Position: 11 row in set (0.00 sec)ERROR:No query specified
gtid_purged跳过事务,从上面slave状态信息可知,slave当前执行到了
7bdd3156-ff10-11e3-91dc-001018a0b030:1-107805,使用gtid_purged跳过下一个事务
7bdd3156-ff10-11e3-91dc-001018a0b030:1-107806
root@[(none)] 05:36:29> stop slave;Query OK, 0 rows affected (0.05 sec)root@[(none)] 05:36:35> reset master;Query OK, 0 rows affected (0.14 sec)root@[(none)] 05:36:38> set global gtid_purged='7bdd3156-ff10-11e3-91dc-001018a0b030:1-107806'; #跳过事务Query OK, 0 rows affected (0.13 sec)
root@[(none)] 05:36:57> start slave;show slave status\G;Query OK, 0 rows affected (0.04 sec)*************************** 1. row ***************************Slave_IO_State: Checking master versionMaster_Host: 10.1.8.24Master_User: replMaster_Port: 3306Connect_Retry: 60Master_Log_File: mysql-bin.000009Read_Master_Log_Pos: 49436416Relay_Log_File: mysqld-relay-bin.000011Relay_Log_Pos: 2043387Relay_Master_Log_File: mysql-bin.000002Slave_IO_Running: YesSlave_SQL_Running: YesReplicate_Do_DB:Replicate_Ignore_DB:Replicate_Do_Table:Replicate_Ignore_Table:Replicate_Wild_Do_Table: zabbix.%Replicate_Wild_Ignore_Table:Last_Errno: 0Last_Error:Skip_Counter: 0Exec_Master_Log_Pos: 28739081Relay_Log_Space: 783498933Until_Condition: NoneUntil_Log_File:Until_Log_Pos: 0Master_SSL_Allowed: NoMaster_SSL_CA_File:Master_SSL_CA_Path:Master_SSL_Cert:Master_SSL_Cipher:Master_SSL_Key:Seconds_Behind_Master: 256354Master_SSL_Verify_Server_Cert: NoLast_IO_Errno: 0Last_IO_Error:Last_SQL_Errno: 0Last_SQL_Error:Replicate_Ignore_Server_Ids:Master_Server_Id: 1Master_UUID: 7bdd3156-ff10-11e3-91dc-001018a0b030Master_Info_File: /var/lib/mysql/master.infoSQL_Delay: 0SQL_Remaining_Delay: NULLSlave_SQL_Running_State: Waiting for the next event in relay logMaster_Retry_Count: 86400Master_Bind:Last_IO_Error_Timestamp:Last_SQL_Error_Timestamp:Master_SSL_Crl:Master_SSL_Crlpath:Retrieved_Gtid_Set: 7bdd3156-ff10-11e3-91dc-001018a0b030:1-732563Executed_Gtid_Set: 7bdd3156-ff10-11e3-91dc-001018a0b030:1-107806Auto_Position: 11 row in set (0.00 sec)ERROR:No query specified
转载于:https://my.oschina.net/anthonyyau/blog/322760
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/109717.html原文链接:https://javaforall.net

