How Kafka choose the follower nodes for replications? -


kafka replicates topic's partitions across multiple machines fault-tolerance. each partition has leader , 1 or more number of followers.

i want know how kafka chooses machines become followers of each topic/partition among possible candidates?

for example, let's there 1 topic 3 partitions {a,b,c} , replication factor 3. kafka running on 6 machines {1,2,...,6}.

one possible assignment is:

1 2 3 4 5 6 b c c b b c 

but following possible:

1 2 3 4 5 6 b c   b c     b c 

of course, there tons of possible assignments.

can give me idea how kafka doing this?

thanks

you may kafka sources on github see how replica assignment default - https://github.com/apache/kafka/blob/0.10.0/core/src/main/scala/kafka/admin/adminutils.scala#l47-l106


Comments