怎么理解Mysql GITD复制中断处理,相信很多没有经验的人对此束手无策,为此本文总结了问题出现的原因和解决方法,通过这篇文章希望你能解决这个问题。
从库发现复制错误:
"root@localhost:mysqld.sock [test]>show slave status/G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.2.54
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000010
Read_Master_Log_Pos: 2513
Relay_Log_File: virtdb55-relay-bin.000002
Relay_Log_Pos: 1305
Relay_Master_Log_File: mysql-bin.000010
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: 1051
Last_Error: Error 'Unknown table 'test.t1'' on query. Default database: 'test'. Query: 'DROP TABLE "t1" /* generated by server */'
Skip_Counter: 0
Exec_Master_Log_Pos: 1135
Relay_Master_Log_File: mysql-bin.000010:为从库sql线程读取master log file位置
Exec_Master_Log_Pos: 1135:为从库sql线程读到master log pos位置
解决:根据SQL线程读取位置,检索操作内容
mysqlbinlog -vvv mysql-bin.000010 –start-position=1135
# at 1135
#160519 9:24:50 server id 54 end_log_pos 1183 CRC32 0x5edc0e52 GTID [commit=yes]
SET @@SESSION.GTID_NEXT= '8b8cad8e-053c-11e6-b500-5254006f0b84:6'/*!*/;
# at 1183
#160519 9:24:50 server id 54 end_log_pos 1298 CRC32 0x3c2cbffc Query thread_id=3 exec_time=0 error_code=0
use `test`/*!*/;
SET TIMESTAMP=1463621090/*!*/;
DROP TABLE "t1" /* generated by server */
/*!*/;
SET @@SESSION.GTID_NEXT= '8b8cad8e-053c-11e6-b500-5254006f0b84:6'/*!*/; 设定该GTID,就跳过了该event.
跳过该复制错误
stop slave;
SET @@SESSION.GTID_NEXT= '8b8cad8e-053c-11e6-b500-5254006f0b84:6'/*!*/;
begin;commit;
set gtid_next="AUTOMATIC";
start slave;
看完上述内容,你们掌握怎么理解Mysql GITD复制中断处理的方法了吗?如果还想学到更多技能或想了解更多相关内容,欢迎关注亿速云行业资讯频道,感谢各位的阅读!
原创文章,作者:kepupublish,如若转载,请注明出处:https://blog.ytso.com/201829.html