Analysis updated 2026-07-09 · repo last pushed 2013-09-18
Add health checks to HAProxy so it stops routing traffic to lagging MySQL read replicas.
Monitor Galera cluster node health and automatically pull unhealthy nodes out of rotation.
Prevent users from reading stale data by detecting replication lag beyond a configurable threshold.
| moritzheiber/apprentice | mastodon/webpush | gargron/pghero | |
|---|---|---|---|
| Stars | 2 | 2 | 1 |
| Language | Ruby | Ruby | Ruby |
| Last pushed | 2013-09-18 | 2025-01-13 | 2019-02-07 |
| Maintenance | Dormant | Stale | Dormant |
| Setup difficulty | moderate | moderate | easy |
| Complexity | 2/5 | 2/5 | 2/5 |
| Audience | ops devops | developer | developer |
Figures from each repo's GitHub metadata at analysis time.
Requires a running MySQL or MariaDB server with replication or Galera cluster setup, plus a load balancer like HAProxy to make use of the health signal.
Apprentice is a small health-check tool for MariaDB and MySQL databases. It tells your load balancer whether a specific database server is actually ready to handle live traffic, so you never accidentally send users to a database that's broken or falling behind. Here's the problem it solves: when you run multiple database servers, a load balancer usually just checks whether the server responds at all. But a database that's "alive" might still be unhealthy. It might be lagging behind the primary server by several minutes, serving stale data. Or in a cluster setup, it might have disconnected from the other nodes. Apprentice connects to the database and runs actual integrity checks, then exposes a simple HTTP endpoint: a 200 response means the server is healthy and ready, a 503 means stay away. The tool checks different things depending on your setup. For a standard MySQL/MariaDB replica, it verifies that replication is actively running and measures how many seconds behind the primary server the replica has fallen, with a configurable threshold (defaulting to 120 seconds). For a Galera cluster, it checks that the cluster has enough members, that replication is turned on, and that the node isn't in a bad state. You can optionally allow a "donor" state, where a node is sharing data with another cluster member, to still count as healthy. The typical user is someone running a multi-server database setup behind a load balancer like HAProxy. For example, if you have five read replicas handling user queries and one starts lagging behind by five minutes, Apprentice detects that and tells HAProxy to stop sending traffic to it until it catches up. This prevents users from seeing outdated data without you having to manually intervene. The project is notably minimal, weighing in at under 300 lines of Ruby code, and does one thing well. It doesn't load-balance connections itself or relay client traffic. It's purely a signal provider that helps your existing infrastructure make smarter routing decisions. The README notes that PostgreSQL support has been requested but not yet built.
A small health-check tool for MySQL and MariaDB databases that tells your load balancer whether a database server is truly ready for live traffic by checking replication lag and cluster integrity.
Mainly Ruby. The stack also includes Ruby, MySQL, MariaDB.
Dormant — no commits in 2+ years (last push 2013-09-18).
No license information is provided in the repository, so default copyright restrictions apply and you should contact the author before using it.
Setup difficulty is rated moderate, with roughly 30min to a first successful run.
Mainly ops devops.
This repo across BitVibe Labs
Verify against the repo before relying on details.