Mysql 主从延迟定位
观察主从节点cpu 内存情况
top 命令
查看磁盘io
iostat命令
查看主从状态
SHOW MASTER STATUS SHOW SLAVE STATUS
- 比较:第一对:( File , Position ) & ( Master_Log_File , Read_Master_Log_Pos )
如果 ( File , Position ) 大于 ( Master_Log_File , Read_Master_Log_Pos ) ,则意味着 IO 线程存在延迟。
第二对:( Master_Log_File , Read_Master_Log_Pos ) & ( Relay_Master_Log_File , Exec_Master_Log_Pos )
- 如果 ( Relay_Master_Log_File, Exec_Master_Log_Pos ) < ( Master_Log_File, Read_Master_Log_Pos ) ,则意味着 SQL 线程存在延迟。