mysql> show slave status\G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 172.16.1.201
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.001023
Read_Master_Log_Pos: 126234930
Relay_Log_File: testmysql-relay-bin.000024
Relay_Log_Pos: 251
Relay_Master_Log_File: mysql-bin.001021
Slave_IO_Running: Yes
Slave_SQL_Running: No
Replicate_Do_DB:
Replicate_Ignore_DB: mysql
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 1050
Last_Error: Error 'Table '_xlnm#_filterdatabase' already exists' on query. Default database: 'docresource'. Query: 'RENAME TABLE `#mysql50#_xlnm#_filterdatabase` TO `_xlnm#_filterdatabase`'
发现一个事件不同步,可以跳过去,执行下面的事件即可:
stop slave;
set global sql_slave_skip_counter =1 ;
start slave;
sql_slave_skip_counter的官方解释:
13.4.2.4. SET GLOBAL sql_slave_skip_counter Syntax SET GLOBAL sql_slave_skip_counter = N
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 172.16.1.201
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.001023
Read_Master_Log_Pos: 126234930
Relay_Log_File: testmysql-relay-bin.000024
Relay_Log_Pos: 251
Relay_Master_Log_File: mysql-bin.001021
Slave_IO_Running: Yes
Slave_SQL_Running: No
Replicate_Do_DB:
Replicate_Ignore_DB: mysql
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 1050
Last_Error: Error 'Table '_xlnm#_filterdatabase' already exists' on query. Default database: 'docresource'. Query: 'RENAME TABLE `#mysql50#_xlnm#_filterdatabase` TO `_xlnm#_filterdatabase`'
发现一个事件不同步,可以跳过去,执行下面的事件即可:
stop slave;
set global sql_slave_skip_counter =1 ;
start slave;
sql_slave_skip_counter的官方解释:
13.4.2.4. SET GLOBAL sql_slave_skip_counter Syntax SET GLOBAL sql_slave_skip_counter = N
This statement skips the next N events from the master. This is useful for recovering from replication stops caused by a statement.
这样就可以跳过一个事件,恢复主从关系。