MySQL Replay(by processlist)
检查 MySQL 从库的复制状态,通过查询 SHOW PROCESSLIST
命令的结果,判断从库是否处于以下正常等待状态之一:
MySQL 5.6 及之前版本:
"Has read all relay log; waiting for the slave I/O thread to update it"
MySQL 5.6:
"Slave has read all relay log; waiting for the slave I/O thread to update it"
MySQL 8.0:
"Replica has read all relay log; waiting for more updates"
如果检测到上述任一状态,返回 0
(表示复制正常等待);否则返回 -1
(表示异常或未检测到目标状态)。
备注:
看 5.7 的processlist 里是 "Slave has read all relay log; waiting for more updates"
Last updated