你可能会有一个惊喜,但这里是:
运行SHOW SLAVE STATUS\G
。举个例子,假设你得到了这个:
Slave_IO_State: Waiting for master to send event
Master_Host: 10.64.68.253
Master_User: replusername
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.003202
Read_Master_Log_Pos: 577991837
Relay_Log_File: relay-bin.010449
Relay_Log_Pos: 306229695
Relay_Master_Log_File: mysql-bin.003202
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 577991837
Relay_Log_Space: 306229695
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: 0
您可以从显示中选择以下内容:
Relay_Master_Log_File
( mysql-bin.003202
)
Exec_Master_Log_Pos
( 577991837
)
原因如下:Relay_Master_Log_File
并Exec_Master_Log_Pos
表示来自 Master 的 binlog 条目,该条目到达 Slave 并成功执行。只需从那里取货。
您只需运行以下代码:Exec_Master_Log_Pos
STOP SLAVE;
CHANGE MASTER TO
MASTER_LOG_FILE='mysql-bin.003202',
MASTER_LOG_POS=577991837;
START SLAVE;
试试看 !!!
警告
如果Relay_Master_Log_File
Master 上不再存在,您可能需要进行一些损坏控制。鉴于SHOW SLAVE STATUS\G
前面提到的,您可能必须跳到 Master 上的下一个二进制日志,如下所示:
STOP SLAVE;
CHANGE MASTER TO
MASTER_LOG_FILE='mysql-bin.003203',
MASTER_LOG_POS=4;
START SLAVE;
如果复制赶上,你并没有走出困境。您可能需要下载 Percona Toolkit 并运行pt-table-checksum和pt-table-sync来修复 Slave 上丢失的数据。
如果复制没有启动,您将不得不执行尽职调查并重新加载从站。
如果复制符合原始建议,希望您可能不必在此警告中做任何事情。