我们有一个基于 ROW 的复制的主从设置。即使没有活动在 master 或 slave 上运行,我们也看到了 salve 的巨大延迟。
当我们查看时,我们观察到 SQL 线程看起来像是挂了。自过去 3 小时或更长时间以来,它一直处于“从中继日志中读取事件”状态。
baleaf:(none)> show processlist ;
+--------+-------------+-----------+------+---------+-------+----------------------------------+----- -------------+
| Id | User | Host | db | Command | Time | State | Info |
+--------+-------------+-----------+------+---------+-------+----------------------------------+----- -------------+
| 217159 | system user | | NULL | Connect | 1039 | Waiting for master to send event | NULL |
| 217160 | system user | | NULL | Connect | 10045 | Reading event from the relay log | NULL |
+--------+-------------+-----------+------+---------+-------+----------------------------------+----- -------------+
4 rows in set (0.00 sec)
baleaf:blackarrow_dw> SHOW SLAVE STATUS \G
*************************** 1. row ***************************
Slave_IO_State: Queueing master event to the relay log
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: binlog.001403
Read_Master_Log_Pos: 95601911
Relay_Log_File: relay-bin.000002
Relay_Log_Pos: 12757514
Relay_Master_Log_File: binlog.001403
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: 32820355
Relay_Log_Space: 75539220
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: 7720
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1
1 row in set (0.00 sec)
Run Code Online (Sandbox Code Playgroud)
有人请尽快看看这个。
您可能需要重置中继日志。请不要使用RESET SLAVE;
您需要以这样一种方式重置中继日志,使其从它执行的最后一条 SQL 语句中提取。
请运行以下命令:
STOP SLAVE;
CHANGE MASTER TO MASTER_LOG_FILE='binlog.001403',MASTER_LOG_POS=32820355;
START SLAVE;
Run Code Online (Sandbox Code Playgroud)
如果Seconds_Behind_Master保持为零,恭喜!!!
如果Seconds_Behind_Master立即返回到 7720,请对照从站操作系统中设置的日期和时间检查主站操作系统中设置的日期和时间。
试一试 !!!
查看 master bin 日志以查看哪个查询记录在文件 binlog.001403 的位置 32820355 上
mysqlbinlog --start-position=32820355 binlog.001403
Run Code Online (Sandbox Code Playgroud)
看看它是否有助于找到导致 sql 线程挂起的原因。
| 归档时间: |
|
| 查看次数: |
7616 次 |
| 最近记录: |