This document discusses monitoring MySQL replication delay using mysqld_exporter and pt-heartbeat. It describes how pt-heartbeat works to track replication lag by storing timestamps in MySQL. It then details how the author contributed code to mysqld_exporter to integrate this functionality, including relevant configuration options, metrics, and example alerts. The talk encourages contributions to further improve open source monitoring tools.
4. MySQL Replication
MySQL Master <-> MySQL Master
MySQL Master -> MySQL Slave
MySQL Master -> MySQL Slave -> MySQL
Slave
MySQL Masters -> MySQL Slaves -> MySQL
Slaves -> MySQL Slaves
MySQL Master -> MySQL Slaves
7. mysqld_exporter is great
Lots of data
Lots of alerts examples
Percona's Graphana dashboard brings dozens
of useful dashboards
8. Migrating to Prometheus does not mean that we
should forget the past ... Or lower our monitoring
expectations.
9. pt-heartbeat
pt-heartbeart is a daemon that updates an entry
with current timestamp on a mysql server every
second.
On the replica, you can check the timestamp and
do NOW timestamp to get the real lag.
+++
| ts | server_id |
+++
| 20170817T16:55:01.001030 | 1 |
+++
23. Takeaways
contributing to prometheus is easy
pt-heartbeat is the way to monitor mysql
replication lag
and now it's available in prometheus
any volunteers to rewrite pt-heartbeat in go? :)