---
title: "MySQL High Availability at GitHub"
description: "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."
url: "https://swe.quest/articles/mysql-high-availability-at-github-eab0c6a4cc5f7bdc"
canonical: "https://github.blog/engineering/infrastructure/mysql-high-availability-at-github/"
source: "GitHub Engineering"
published: "2018-06-20"
difficulty: "medium"
kind: "Case study"
reading_minutes: 15
tags: ["mysql","replication","load-balancing","consensus","resilience"]
---

# MySQL High Availability at GitHub

A post on [GitHub Engineering](https://swe.quest/sources/github.md), published 2018-06-20, 15 min read, Case study. Original: [https://github.blog/engineering/infrastructure/mysql-high-availability-at-github/](https://github.blog/engineering/infrastructure/mysql-high-availability-at-github/)

## Summary

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.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [MySQL](https://swe.quest/tags/mysql.md) (Data & databases)
- [Replication](https://swe.quest/tags/replication.md) (Distributed systems)
- [Load balancing](https://swe.quest/tags/load-balancing.md) (Infrastructure)
- [Consensus](https://swe.quest/tags/consensus.md) (Distributed systems)
- [Resilience](https://swe.quest/tags/resilience.md) (Distributed systems)

## Prerequisites

- MySQL primary-replica replication ([easy posts on MySQL](https://swe.quest/tags/mysql.md?difficulty=easy))
- Raft consensus basics ([easy posts on Consensus](https://swe.quest/tags/consensus.md?difficulty=easy))
- HAProxy load balancing ([easy posts on Load balancing](https://swe.quest/tags/load-balancing.md?difficulty=easy))
- Service discovery concepts

## Keywords

orchestrator, Consul, HAProxy, GLB, anycast, consul-template, Raft, semi-synchronous replication

## Related posts

- [Building and deploying MySQL Raft at Meta](https://swe.quest/articles/building-and-deploying-mysql-raft-at-meta-7a90b8f5fc15ecc0.md): Meta Engineering · 2023-05-16 · Hard · 18 min read · MySQL, Consensus, Replication, Distributed databases
  Meta 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.
- [FOQS: Making a distributed priority queue disaster-ready](https://swe.quest/articles/foqs-making-a-distributed-priority-queue-disaster-ready-0c0b1a2a20084eae.md): Meta Engineering · 2022-01-18 · Medium · 10 min read · Queues & messaging, Resilience, Replication, Distributed systems, MySQL
  Meta'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.
- [Breaking the Loop: How we migrated our backup catalog for 250+ MySQL clusters to AWS](https://swe.quest/articles/breaking-the-loop-how-we-migrated-our-backup-catalog-for-250-mysql-clusters-to-a99d4c43a779f0a9.md): Booking.com Engineering · 2026-02-19 · Medium · 21 min read · MySQL, Cloud platforms, Storage systems, Resilience, Infrastructure as code
  Booking.com moved the Bacula backup catalog for 250+ MySQL clusters off its on-prem dbadb replication chain and onto Amazon RDS MySQL.
- [Choosing QuePaxa, an unusual consensus algorithm](https://swe.quest/articles/choosing-quepaxa-an-unusual-consensus-algorithm-8142736b7b34aaea.md): Cloudflare · 2026-11-11 · Hard · 18 min read · Consensus, Distributed systems, Resilience, Replication
  Cloudflare's Meerkat, a globally distributed consensus service for its internal control plane, uses QuePaxa instead of Raft or Multi-Paxos.
- [Partitioning GitHub’s relational databases to handle scale](https://swe.quest/articles/partitioning-github-s-relational-databases-to-handle-scale-7b5ea75acfc088c0.md): GitHub Engineering · 2021-09-27 · Medium · 9 min read · MySQL, Distributed databases, Scaling, Schema migrations, Ruby
  GitHub 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.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
