show slave status查看slave状态时,SQL线程停止运行,错误显示Update错误,如果没有使用gtid,可以使用sql_slave_skip_counter跳过,但是开启gtid后,使用该方式是无效的。
root@[(none)] 05:36:24> show slave status\G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 10.1.8.24
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000009
Read_Master_Log_Pos: 49413140
Relay_Log_File: mysqld-relay-bin.000011
Relay_Log_Pos: 2043387
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: zabbix.%
Replicate_Wild_Ignore_Table:
Last_Errno: 1032
Last_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 28739818
Skip_Counter: 0
Exec_Master_Log_Pos: 28739081
Relay_Log_Space: 783475657
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 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 28739818
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1
Master_UUID: 7bdd3156-ff10-11e3-91dc-001018a0b030
Master_Info_File: /var/lib/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: 140928 05:33:17
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set: 7bdd3156-ff10-11e3-91dc-001018a0b030:1-732546
Executed_Gtid_Set: 7bdd3156-ff10-11e3-91dc-001018a0b030:1-107805 #当前slave执行到的位置
Auto_Position: 1
1 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
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 version
Master_Host: 10.1.8.24
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000009
Read_Master_Log_Pos: 49436416
Relay_Log_File: mysqld-relay-bin.000011
Relay_Log_Pos: 2043387
Relay_Master_Log_File: mysql-bin.000002
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table: zabbix.%
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 28739081
Relay_Log_Space: 783498933
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: 256354
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1
Master_UUID: 7bdd3156-ff10-11e3-91dc-001018a0b030
Master_Info_File: /var/lib/mysql/master.info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Waiting for the next event in relay log
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set: 7bdd3156-ff10-11e3-91dc-001018a0b030:1-732563
Executed_Gtid_Set: 7bdd3156-ff10-11e3-91dc-001018a0b030:1-107806
Auto_Position: 1
1 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