SyntaxStudy
Sign Up
MySQL Monitoring Replication Health
MySQL Intermediate 4 min read

Monitoring Replication Health

Replication Monitoring

Monitor replication health via SHOW REPLICA STATUS and Performance Schema tables. Set up alerts on lag and thread status.

Example
-- Key SHOW REPLICA STATUS fields:
-- Replica_IO_Running:    Yes   (fetching binlog)
-- Replica_SQL_Running:   Yes   (applying events)
-- Seconds_Behind_Source: 0     (no lag)
-- Last_Error:            ""    (no error)
-- Performance Schema:
SELECT * FROM performance_schema.replication_connection_status\G
SELECT * FROM performance_schema.replication_applier_status\G
-- Alert on lag > 10s, IO/SQL thread not running, or errors
Pro Tip

Both IO and SQL threads must be running (Yes) — if either is No, replication has stopped.