IntermediateOperations
How would you debug a 'LEADER_NOT_AVAILABLE' error in production?
Reference answer
The error means the client could not find an available leader for the partition it wanted. Kafka elects a partition's leader from its in-sync replicas, so with unclean.leader.election.enable at its default of false the partition stays unavailable for as long as no in-sync replica is up. A common debugging approach: 1) Run kafka-topics.sh --describe on the topic to see each partition's leader and ISR. 2) Check whether the brokers hosting the replicas are up and healthy. 3) Look at the controller: the OfflinePartitionsCount metric (the number of offline partitions the controller observes) and the controller logs for election activity. 4) Check network connectivity between the brokers and the controller. Usually the error clears once a replica comes back or a new leader is elected; clients handle transient errors by retrying (the retries setting, bounded by delivery.timeout.ms). Enabling unclean leader election would restore availability sooner but can lose committed messages.
Expected key concepts: leader, ISR, kafka-topics.sh, --describe, OfflinePartitionsCount, controller, unclean.leader.election.enable, retries, delivery.timeout.ms, brokers
How did that feel?
Your own verdict, not the score. It shows up next to this question in the list, so you can come back to the shaky ones.