Jack
Jack

Reputation: 5880

how does Kafka replica becomes leader when there is replica lag

For example I have have three replicas: replica1(leader),replica2(follower),replica3(follower). But now there are lag between leader and followers, and the leader dead now.

So the followers don't have the newest messages(because of lag). Then how does kafka elect the new leader, whatever, there would be a data lost, so how does kafka deal with this.

Upvotes: 0

Views: 1010

Answers (1)

dossani
dossani

Reputation: 1948

unclean.leader.election.enable configuration property is set to true by default. It allows out-of-snyc replica to be the leader. If out-of-sync replica is allowed to become the new leader, yes, some data will be lost and also cause some inconsistencies in Consumers.

If out-of-sync replica is not allowed, partition will remain offline until old leader is brought back online.

In nutshell, setting the value of unclean.leader.election.enable, is a choice between data loss and availability!

Hope it helps.

Thanks.

Upvotes: 5

Related Questions