具体来说,我有一套InnoDB表,我们将这些表备份到MyISAM表中以提供全文search。 从属数据库通常落后于主数据库。 我正在寻找可用于跟踪滞后的诊断或命令的build议。 两台机器都在同一个networking上。 非常感谢。
SHOW SLAVE STATUS是你的命令
mysql> SHOW SLAVE STATUS\G *************************** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: localhost Master_User: root Master_Port: 3306 Connect_Retry: 3 Master_Log_File: gbichot-bin.005 Read_Master_Log_Pos: 79 Relay_Log_File: gbichot-relay-bin.005 Relay_Log_Pos: 548 Relay_Master_Log_File: gbichot-bin.005 Slave_IO_Running: Yes Slave_SQL_Running: Yes Replicate_Do_DB: Replicate_Ignore_DB: Last_Errno: 0 Last_Error: Skip_Counter: 0 Exec_Master_Log_Pos: 79 Relay_Log_Space: 552 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: 8 Master_SSL_Verify_Server_Cert: No Last_IO_Errno: 0 Last_IO_Error: Last_SQL_Errno: 0 Last_SQL_Error: Replicate_Ignore_Server_Ids: 0
相关部分是:
Slave_IO_State: Waiting for master to send event
“等待主人……”就是你通常想看到的
Master_Log_File: gbichot-bin.005 Read_Master_Log_Pos: 79 Exec_Master_Log_Pos: 79
这与主服务器上的“SHOW MASTER STATUS”相结合,可以让您比较已传输和正确复制了多less
Slave_IO_Running: Yes Slave_SQL_Running: Yes
复制正在运行?
Seconds_Behind_Master: 8
滞后估计
Last_IO_Errno: 0 Last_IO_Error: Last_SQL_Errno: 0 Last_SQL_Error:
如果出现错误,则显示错误。 另外请查看您的错误日志和SHOW PROCESSLIST了解更多信息
nagios的插件做到了这一点
-bash-3.2#〜nagios / libexec / check_mysql -h | grep check-slave -S,--check-slave -bash-3.2#