我们有一个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天里开始减less。
当我今天查看从属复制状态时,发现自上午以来, seconds_behind_master值一直在增加。 我停止了slave IO_Thread ,然后slave IO_Thread变为空。 然后,我开始IO_thread ,价值变得一样,不断增加。
我看到一个进程从早上system user gss-app Connect 9535736 copy to tmp table ALTER TABLE运行system user gss-app Connect 9535736 copy to tmp table ALTER TABLE queue_clicks ADD INDEX( puid )
请帮我解决这个问题。 谢谢。
#mysql> show slave status\G; `*************************** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: 203.xxx 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)`
如果IO和SQL正在运行,我不担心它,以及Relay_Master_Log_File正在赶上Master_Log_File 。 我相信延迟是因为你的总中继日志文件是巨大的,约。 105G – Relay_Log_Space: 112995681998 ,考虑到从机处于000774位置,主机处于000990位置,共有214个二进制日志,每个大约有468M(105G / 214)等待在从机上重放。
我的build议是关注Relay_Master_Log_File ,并确保它正在上升并赶上Master_Log_File 。 我也看到,主控主机在公共IP地址,这种复制发生在公共networking或慢WAN? 这可能会引入延迟,链接越快越好。