Divs
Divs

Reputation: 1618

Kafka Failover and Replica

Let's assume I have a Kafka Cluster of 3 brokers and 3 zookeeper.

I have a single topic accountsTopic which is setup as replication factor of 3 and ISR of 2.

If the Leader dies, kafka will elect the ISR as leader, but the 3rd one, (which say for arguments sake was not ISR), is it going to serve as a ISR of current leader in this 2 node fail-over setup?

Upvotes: 4

Views: 1111

Answers (1)

Mickael Maison
Mickael Maison

Reputation: 26895

What happens when the leader dies depends on your configuration.

By default since 0.11, only one of the replicas in-sync can be elected as a leader. If no replicas are in-sync, the partition goes offline. This is favoring consistency over availability.

You can set unclean.leader.election.enable=true on your brokers and in this case, if no replicas are in-sync, one of the out-of-sync replicas will be elected. This can lead to data loss but is favoring availability. Of course if some replicas are in-sync it will still elect one of them.

Upvotes: 3

Related Questions