现象:
在slave从库使用命令查询状态:
mysql> show slave status\G;
*************************** 1. row ***************************
Slave_IO_State:
Master_Host: 172.81.100.124
Master_User: repluser
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: log-bin.001194
Read_Master_Log_Pos: 65542689
Relay_Log_File: relay-log.003469
Relay_Log_Pos: 65542850
Relay_Master_Log_File: log-bin.001194
Slave_IO_Running: No
Slave_SQL_Running: No
操作:
mysql> stop slave;
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> set global sql_slave_skip_counter=1;
Query OK, 0 rows affected (0.00 sec)
mysql> start slave;
Query OK, 0 rows affected (0.00 sec)
结果:
mysql> show slave status\G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 172.81.100.124
Master_User: repluser
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: log-bin.001197
Read_Master_Log_Pos: 104753533
Relay_Log_File: relay-log.003474
Relay_Log_Pos: 96753983
Relay_Master_Log_File: log-bin.001195
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
mysql> show master status\G;
*************************** 1. row ***************************
File: log-bin.001197
Position: 32492795
Binlog_Do_DB:
Binlog_Ignore_DB:
Executed_Gtid_Set:
1 row in set (0.00 sec)