Partition Leader Election
Partition Leader Election is a process of electing a broker to be the leader of a partition.
Use kafka-leader-election.sh utility for preferred or unclean leader election.
Tip
|
Consult Demo: Using kafka-leader-election.sh. |
Note
|
kafka-preferred-replica-election.sh tool has been deprecated since Kafka 2.4.0 (cf. KIP-460: Admin Leader Election RPC).
|
Observe state.change.logger
(default: state-change.log
) to trace the process in the logs.
Internally, Kafka controller uses Election utility (and PartitionLeaderElectionAlgorithms) for the algorithms for partition leader election.
Unclean Partition Leader Election
Unclean Partition Leader Election allows a non-ISR replica to be elected as a partition leader (as the last resort, even though doing so may result in data loss).
unclean.leader.election.enable configuration property is used to enable it cluster-wide (for any topic) or per topic.
Enable INFO logging level for kafka.controller.KafkaController logger to observe the process in the logs.