How does Kafka handle failure of a broker in the cluster?

Instruction: Describe Kafka's mechanism for handling broker failures to ensure system reliability.

Context: This question probes the candidate's knowledge of Kafka's fault tolerance capabilities, specifically regarding how the system continues to operate effectively in the event of broker failures.

Updated

Official answer

In Kafka 4.x, the active KRaft controller uses broker registration and heartbeat information to manage broker availability. The controller quorum stores metadata changes; ZooKeeper is not involved.

If a failed broker led a partition, Kafka can elect an eligible surviving replica. The applicable ISR/eligible-leader-replica rules depend on the deployed feature configuration. A replica merely existing on disk is not sufficient evidence that it can safely become leader.

Clients discover updated metadata and retry according to their configuration and API error contract. Some requests can fail or time out during the transition. Producer idempotence helps with supported retries; consumer applications still need to handle reassignment and replay correctly.

Availability is conditional. If no safe leader is available, the partition can remain offline. If the minimum in-sync requirement is not met, writes can fail despite having an elected leader. If the controller quorum is unavailable, metadata progress and recovery are constrained. Unclean election can sacrifice acknowledged data and needs an explicit risk decision.

Monitor offline/under-replicated partitions, quorum health, replication catch-up and client errors. Repair or replace the broker, restore replica placement and confirm recovery under representative load. Test single-broker and fault-domain failures rather than claiming that every broker outage causes zero interruption and zero loss.

KRaft, eligible leader replicas, Kafka 4.0 migration

Related Questions