---
title: "Building and deploying MySQL Raft at Meta"
description: "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."
url: "https://swe.quest/articles/building-and-deploying-mysql-raft-at-meta-7a90b8f5fc15ecc0"
canonical: "https://engineering.fb.com/2023/05/16/data-infrastructure/mysql-raft-meta/"
source: "Meta Engineering"
published: "2023-05-16"
difficulty: "hard"
kind: "Case study"
reading_minutes: 18
tags: ["mysql","consensus","replication","distributed-databases"]
---

# Building and deploying MySQL Raft at Meta

A post on [Meta Engineering](https://swe.quest/sources/meta.md), published 2023-05-16, 18 min read, Case study. Original: [https://engineering.fb.com/2023/05/16/data-infrastructure/mysql-raft-meta/](https://engineering.fb.com/2023/05/16/data-infrastructure/mysql-raft-meta/)

## Summary

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. 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.

Written by swe.quest, not by the author.

**Difficulty:** Hard: written for specialists in the field

## Topics

- [MySQL](https://swe.quest/tags/mysql.md) (Data & databases)
- [Consensus](https://swe.quest/tags/consensus.md) (Distributed systems)
- [Replication](https://swe.quest/tags/replication.md) (Distributed systems)
- [Distributed databases](https://swe.quest/tags/distributed-databases.md) (Data & databases)

## Prerequisites

- Raft consensus ([easy posts on Consensus](https://swe.quest/tags/consensus.md?difficulty=easy))
- MySQL binlog replication ([easy posts on MySQL](https://swe.quest/tags/mysql.md?difficulty=easy))
- two-phase commit
- quorum systems

## Keywords

MySQL Raft, kuduraft, FlexiRaft, Flexible Paxos, Apache Kudu, MyRaft, semisynchronous replication, InnoDB

## Related posts

- [MySQL High Availability at GitHub](https://swe.quest/articles/mysql-high-availability-at-github-eab0c6a4cc5f7bdc.md): GitHub Engineering · 2018-06-20 · Medium · 15 min read · MySQL, Replication, Load balancing, Consensus, Resilience
  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.
- [Augmenting Flexible Paxos in LogDevice to improve read availability](https://swe.quest/articles/augmenting-flexible-paxos-in-logdevice-to-improve-read-availability-1636941d1f8188f4.md): Meta Engineering · 2022-03-07 · Hard · 10 min read · Consensus, Distributed systems, Replication, Resilience
  LogDevice, Meta's distributed log store built on flexible Multi-Paxos, removed a core Flexible Paxos trade-off.
- [Why does Neon use Paxos instead of Raft, and what’s the difference?](https://swe.quest/articles/why-does-neon-use-paxos-instead-of-raft-and-what-s-the-difference-f6a04ce40b5e85a1.md): Neon · 2022-08-02 · Hard · 14 min read · Consensus, Replication, PostgreSQL, Distributed databases, Formal methods
  Neon replaces Postgres's storage layer with distributed storage, so stateless compute nodes act as Paxos proposers and a fixed set of disk-backed safekeepers act as acceptors.
- [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.
- [How we built a general purpose key value store for Facebook with ZippyDB](https://swe.quest/articles/how-we-built-a-general-purpose-key-value-store-for-facebook-with-zippydb-852970eb82fe8238.md): Meta Engineering · 2021-08-06 · Hard · 10 min read · Distributed databases, Replication, Consistency models, Consensus, Multi-tenancy
  ZippyDB is Facebook's largest strongly consistent, geo-distributed key-value store, built by layering a reusable replication library (Data Shuttle) on RocksDB, Shard Manager and a ZooKeeper-based config service.

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)
