我们有一个MySQL 5.0.77主从复制。在过去的几周里,复制没有正常运行,它给了Duplicate entry error 1062. 该Set Global Skip-counter选项没有帮助,因此我不得不error no.1062通过将其添加到/etc/my.cnf文件中来跳过该选项,然后它报告了某个特定数据库中不存在表的错误。
然后我取了一个mysqldump那个数据库并在上周末在 Slave 中恢复。然后Slave IO_Thread,Slave_SQL两者都开始正常运行,看起来复制又回到了正轨。该Seconds_behind_master值非常高,然后在过去 4 天开始下降。
今天查看slave复制状态,发现seconds_behind_master从早上开始就一直在增加。我停止了slave IO_Thread一次,然后 seconds_behind_master 变成了 Null。然后在我开始后IO_thread,价值变得相同并不断增加。
我看到一个进程正在从早上system user gss-app Connect 9535736 copy to tmp table ALTER TABLEqueue_clicks ADD INDEX(puid运行
)
请帮我解决这个问题。谢谢。
#mysql> show slave status\G;
`*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 203.x.x.x
Master_User: replication
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000990
Read_Master_Log_Pos: 185674180
Relay_Log_File: mysqld-relay-bin.000224
Relay_Log_Pos: 9286354
Relay_Master_Log_File: mysql-bin.000774
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: 472142385
Relay_Log_Space: 112995681998
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: 9533355
1 row in set (0.00 sec)`
Run Code Online (Sandbox Code Playgroud)
如果 IO 和 SQL 正在运行,以及Relay_Master_Log_File正在赶上Master_Log_File. 我相信延迟是因为您的总中继日志文件很大,大约。105G -Relay_Log_Space: 112995681998考虑到 Slave 位于 000774 位置而 master 位于 000990 位置,总共有 214 个二进制日志,每个大约 468M (105G/214) 等待在从机上重放。
我的建议是密切关注Relay_Master_Log_File并确保它正在上升并赶上Master_Log_File. 我还看到主主机位于公共 IP 地址中,此复制是通过公共网络还是慢速 WAN 进行的?这可能会引入延迟,链接越快越好。
| 归档时间: |
|
| 查看次数: |
13566 次 |
| 最近记录: |