KRaft
- Locate producers, consumers and brokers beside the controller quorum that manages their cluster.
Select a component to trace its direct connections. Drag to pan · Ctrl + wheel or pinch to zoom.
- A topic is split into ordered partitions. P0, P1 and P2 are three partitions whose leaders run on different brokers.
- KRaft controllers track which brokers own each partition. Two of these three voters must agree to commit a change to that metadata.
- Broker A leads P0. The producer sends A an order and the consumer fetches it from A. The arrows show where the record travels.
Reading
- If voter B fails, voters A and C can elect a replacement. The P0 record stays on its brokers.
- If broker A fails, P0 needs a new partition leader. Both clients refresh their metadata to find it.
KRaft controllers and brokers
KRaft controllers and brokers
Apache Kafka 4.1 · illustrative cluster and offsets
Separate controller and broker roles
- Three controller processes maintain the replicated metadata log. One active controller manages broker membership, partition assignments and leader changes.
- The two other voters can elect a replacement. With three voters, two must communicate to commit new metadata. Place voters across independent failure domains.
- Brokers fetch and apply metadata. A client contacts a bootstrap broker for metadata and connects to the advertised broker for its target partition. Other requests can have other owners, including a group coordinator.
Dedicated controller settingsproperties
# Kafka 4.1 dynamic KRaft quorum · one dedicated controller fragment.
# Assign unique node IDs and format each directory for the same cluster.
# Bootstrap endpoints locate the quorum. Actual voters are recorded in metadata.
process.roles=controller
node.id=101
controller.listener.names=CONTROLLER
listeners=CONTROLLER://ctrl-a.example:9093
controller.quorum.bootstrap.servers=ctrl-a.example:9093,ctrl-b.example:9093,ctrl-c.example:9093
metadata.log.dir=/srv/kafka/metadata
# Configure listener security, certificates and access policy for the environment.
Choose the deployment shape
| Placement | Benefit | Failure and capacity tradeoff |
|---|---|---|
| Separate controllers and brokers | Scale data disk/IO independently from controller capacity | Additional nodes, listeners and lifecycle management |
| Combined process roles | Smaller local installation | Loss or saturation of one process affects both planes. Use dedicated roles for independent scaling |
| One controller | Simple disposable exercise | No controller failover when that voter is unavailable |
- For the dynamic quorum example, format storage with the intended cluster identity and establish its voter membership. The bootstrap endpoints help servers discover the quorum. They cannot create a safe new cluster from blank disks on restart.
Evaluate a failure by its owner
- One unavailable controller leaves two of three voters. An active-controller election may delay metadata operations.
- Losing the majority prevents metadata progress. An already healthy data partition may still serve some requests, but moving a leader or repairing metadata can stall.
- Loss of a data broker affects the partitions it leads or replicates. Check each partition’s ISR and leader availability separately from controller quorum health.