MySQL High Availability at GitHub
GitHub replaced VIP- and DNS-based MySQL primary discovery with a decoupled pipeline: orchestrator/raft detects failures and promotes a new primary, each orchestrator node writes the new identity to its local Consul KV store, and consul-template reconfigures GLB/HAProxy writer pools reached via anycast. This removes DNS TTLs and any reliance on the failed primary's cooperation. HAProxy's short hard-stop-after kills connections to the old primary to limit split-brain, and GLB checks that the new backend is really a writer. Raft quorum placement means an isolated data center cannot lead failovers, and orchestrator advertises an ideal candidate before the replication tree is repaired, which shortens outages.
Related posts
- Building and deploying MySQL Raft at Meta
Meta Engineering hardMasterMeta replaced its MySQL semisynchronous replication, whose failover and membership changes were orchestrated by external Python automation, with MySQL Raft, a Raft consensus engine built into mysqld. Control plane operations (promotions, membership changes) and data now share one replicated log, the existing binlog. That moves leadership and membership truth into the server and gives provable safety, faster failover and simpler operations, with comparable write performance. The implementation is based on a kuduraft fork that adds FlexiRaft, a Flexible Paxos-inspired scheme with a small in-region data quorum and a larger leader-election quorum, along with proxying, compression and log abstraction. The post also covers the write commit path, crash-recovery cases and one-at-a-time membership changes.
- FOQS: Making a distributed priority queue disaster-ready
Meta Engineering mediumAdeptMeta's FOQS distributed priority queue moved from isolated regional installations on semi-synchronous replicated MySQL to a single global installation, after Hurricane Florence in 2018 exposed manual traffic rebalancing and items stuck on unreachable shards. The global design uses Shard Manager so a queue node in the new region takes over a MySQL primary within seconds of failover. A routing service maps logical region preferences to shards for enqueue and keeps a heap-based cache of nodes with ready items for dequeue. Migrating the Async platform required parallelizing cache replenishment, which nearly halved its latency, and randomizing selection among top-priority nodes to fix thundering herd and starvation. The 2021 migration finished with zero downtime using shadow load testing, config-based rollouts and health dashboards.
- Breaking the Loop: How we migrated our backup catalog for 250+ MySQL clusters to AWS
Booking.com Engineering mediumAdeptBooking.com moved the Bacula backup catalog for 250+ MySQL clusters off its on-prem dbadb replication chain and onto Amazon RDS MySQL. The move removes a circular dependency: Bacula could not automatically restore the database that held its own catalog. The work became a "3-in-1" side-by-side migration, combining an OS upgrade from CentOS 8 to Oracle Linux 9, an upgrade from Bacula v12 to v16, and the database move. A new stack was built greenfield and ran in parallel with the old one past the backup retention window, instead of using replication-based data migration. The team provisioned RDS with the same Terraform modules customer teams use and extended them for cross-region replicas, since RDS is multi-AZ but not multi-region.
- Choosing QuePaxa, an unusual consensus algorithm
Cloudflare hardMasterCloudflare's Meerkat, a globally distributed consensus service for its internal control plane, uses QuePaxa instead of Raft or Multi-Paxos. Leader-based protocols stall over wide-area networks: mistaken or slow fault detection triggers leader elections, and competing candidates can interfere destructively and cause metastable failures. QuePaxa avoids this with an optional leader, no reliance on fault detection, and randomized priorities that make proposers converge on the highest-priority proposal. It still decides in one round trip through the leader in good conditions and degrades gracefully otherwise. Its hedging timeout is not fault detection, so it can be very small (e.g., 5ms on 100ms links) without freezing the system.
- Partitioning GitHub’s relational databases to handle scale
GitHub Engineering mediumAdeptGitHub split its monolithic `mysql1` MySQL cluster by first virtually partitioning tables into schema domains (declared in YAML) and enforcing boundaries with query and transaction linters, then physically moving domains to new clusters via Vitess vertical sharding or a custom ProxySQL/GTID-based write-cutover script. Cross-domain joins were eliminated with techniques like preload, Rails' new `disable_joins` option and application-side joins, validated with Scientist experiments. The write-cutover moved 130 of the busiest tables in tens of milliseconds with only a handful of failed writes. Query volume grew from 950k to 1.2M queries/s while average per-host load halved, reducing database-related incidents.