---
title: "KIP-595 explained: the Raft protocol behind KRaft"
description: "KIP-595 in plain words: how Kafka controllers elect a leader, replicate the metadata log and catch up after a failure, using Raft built on the Kafka log."
url: https://monedula.dev/kafka/kips/kip-595/
---

# KIP-595: Raft for the Kafka metadata quorum

Cluster and operations · Shipped · since Kafka 3.3 · status checked November 2026.

KIP-595 is the consensus protocol inside KRaft. The controllers elect one leader by majority vote, the leader appends metadata records to a log, and a record counts as committed once a majority has it. It is Raft, adapted to Kafka: followers pull the log with fetch requests, just as follower replicas do for topic partitions.

## At a glance

- Proposal: KIP-595, A Raft Protocol for the Metadata Quorum
- Status: Shipped. Shipped with KRaft; production-ready since Kafka 3.3.
- Area: Cluster and operations
- Proposal page: [KIP-595 on the Apache Kafka wiki](https://cwiki.apache.org/confluence/display/KAFKA/KIP-595%3A+A+Raft+Protocol+for+the+Metadata+Quorum)

## Why it was needed

Replacing ZooKeeper (KIP-500) needed a way for several controllers to agree on one ordered history of metadata changes and to survive the loss of a minority of them. Kafka already had a replicated log, but its leader election depended on a controller, which is exactly what was being built. The quorum needed to elect its own leader.

## What it changes

Each controller is a voter. When the leader stops sending, a voter raises the epoch and asks for votes; it wins only with a majority and only if its log is at least as up to date as each voter that grants a vote. The leader appends records, followers fetch them, and the high watermark moves when a majority has the record. A voter that was down catches up by fetching, or by loading a snapshot if it is far behind.

## Where it stands

Implemented as the core of KRaft. It has run production clusters since Kafka 3.3 and is the only metadata mode since Kafka 4.0. The voter set was static at first; KIP-853 in Kafka 3.9 made it changeable at runtime.

## What comes next

Stable. Improvements arrive as smaller KIPs on top: changing the voter set at runtime (KIP-853), automatic joining of new controllers in Kafka 4.2, and unregistering controllers in Kafka 4.4 (KIP-1312).

## See it in the simulator

- [Kafka KRaft controller failover and metadata log catch-up](https://monedula.dev/kafka-simulator/scenarios/controller-failover-catchup/) (Controller failover & metadata catch-up), step 10: Active c0 dies; c1 elected. The active controller c0 is killed before the standbys replicated offset 4. c1 is elected and the controller EPOCH bumps 0→1 (a new term). The simulator shows c1 at 3, behind c0's 4, and holds it in a catch-up window before it serves. In KRaft c1 already has every committed record: offset 4 was only on c0, so it was never committed, and c0 truncates it when it rejoins. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=15.1.3&t=9)
- [Kafka KRaft controller failover and metadata log catch-up](https://monedula.dev/kafka-simulator/scenarios/controller-failover-catchup/) (Controller failover & metadata catch-up), step 8: c2 replays the log. c2 replays __cluster_metadata via the replication loop and reaches offset 3. It is fully caught up and back in sync with the rest of the quorum. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=15.1.3&t=7)
- [Kafka KRaft controller failover and metadata log catch-up](https://monedula.dev/kafka-simulator/scenarios/controller-failover-catchup/) (Controller failover & metadata catch-up), step 3: Standbys replicate. The metadata_replicate loop fires: standbys c1 and c2 pull the new record and advance to offset 1. The quorum is level again - every voter holds the same committed log. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=15.1.3&t=2)

## Sources

- [KIP-595: A Raft Protocol for the Metadata Quorum](https://cwiki.apache.org/confluence/display/KAFKA/KIP-595%3A+A+Raft+Protocol+for+the+Metadata+Quorum)
- [KIP-853: KRaft Controller Membership Changes](https://cwiki.apache.org/confluence/display/KAFKA/KIP-853%3A+KRaft+Controller+Membership+Changes)

## Related KIPs

- [KIP-500 explained: KRaft replaces ZooKeeper](https://monedula.dev/kafka/kips/kip-500/)
- [KIP-853 explained: adding and removing KRaft controllers](https://monedula.dev/kafka/kips/kip-853/)
