Achieving high availability in Kafka.

Instruction: Explain the strategies and configurations necessary to ensure high availability in a Kafka deployment.

Context: This question evaluates the candidate's understanding of Kafka's high availability mechanisms, including replication, failover, and disaster recovery practices.

Updated

Official answer

Define availability and recovery objectives for producers, consumers and administration separately. Surviving one failure requires independent healthy capacity, not merely multiple processes on the same host.

Place partition replicas across appropriate failure domains. A common starting policy is replication factor three, acks=all and min.insync.replicas=2, with adequate capacity for one broker's loss. Verify the actual deployed feature/configuration behavior. Keep unsafe unclean leader election disabled unless the business explicitly accepts its data-loss tradeoff. Current eligible-leader-replica support can permit safe election outside the current ISR, so “only a fully caught-up ISR replica can ever lead” is not a complete modern rule.

Current Kafka uses KRaft controllers, not a ZooKeeper ensemble. Protect the controller quorum independently: three voters require two to remain available; five require three. Do not restart or lose enough voters simultaneously to remove the majority. Broker replica placement and controller quorum resilience are separate concerns.

Monitor unavailable and under-replicated partitions, ISR/ELR state, controller health, storage, client errors and completed-work lag. Maintain disk/network/CPU headroom for recovery, use bounded rolling maintenance and stop when safety checks fail.

Regional disaster recovery normally adds independent clusters and asynchronous mirroring. Test replication lag, writer fencing, offset translation, application routing and failback; mirroring is not an automatic zero-loss regional failover. Include credential/schema dependencies and protected backups where required. Recovery drills provide evidence for the stated failure model, not a promise against every outage.

KRaft quorum, eligible leader replicas, geo-replication

Related Questions