1

As the question says - Kafka - is it possible for a broker to be leader and follower for the same partition? As in , Will kafka stores the partition and replica ( of same partition ) on same broker. It is NOT clear from the documentation.

Other distributed systems like bigdata, elastic search considers storing partition and replica (of same partition) on different machines

Nag
  • 1,818
  • 3
  • 24
  • 41
  • 1
    Does this answer your question? [What is the maximum replication factor for a partition of kafka topic](https://stackoverflow.com/questions/58806481/what-is-the-maximum-replication-factor-for-a-partition-of-kafka-topic) – mazaneicha May 16 '20 at 17:16

1 Answers1

3

No, this is not possible. Kafka will throw an Error if you try to set the replication factor of a topic higher than the number of brokers:

kafka-topics --bootstrap-server localhost:9092 --create --replication-factor 10 --partitions 1 --topic LeaderFollowerTest
Error while executing topic command : org.apache.kafka.common.errors.InvalidReplicationFactorException: Replication factor: 10 larger than available brokers: 1.
[2020-05-16 19:01:10,106] ERROR java.util.concurrent.ExecutionException: org.apache.kafka.common.errors.InvalidReplicationFactorException: Replication factor: 10 larger than available brokers: 1.

=> you can only have one replica (leader or follower) on each broker.

Michael Heil
  • 16,250
  • 3
  • 42
  • 77