Reputation: 1584
Can we have the ReplicationFactor to 1 and no. of replicas to 3 ?
[user@master01 kafka]$ ./bin/kafka-topics.sh --describe --zookeeper localhost:2181 --topic test
Topic:test PartitionCount:1 ReplicationFactor:1 Configs:
Topic: test Partition: 0 Leader: 3 Replicas: 3 Isr: 3
As I understand, if ReplicationFactor is n, Replicas can be <=n.
Can someone help me understand the following scenario? As the ReplicationFactor is set 1, where as Kafka show number of Replicas as 3.
Upvotes: 6
Views: 4273
Reputation: 26885
ReplicationFactor
tells how many replicas there are.
Replicas
lists the broker id of all the replicas.
In your example, ReplicationFactor
is 1 and this single replica is hosted on broker 3. It works the same way for Leader
and Isr
. So broker 3 is the leader for the partition and is also the in-sync replica (Isr).
In case you had 2 as the ReplicationFactor, you could see something like:
[user@master01 kafka]$ ./bin/kafka-topics.sh --describe --zookeeper localhost:2181 --topic test
Topic:test PartitionCount:1 ReplicationFactor:2 Configs:
Topic: test Partition: 0 Leader: 3 Replicas: 3,1 Isr: 3,1
Now broker 3 is still the leader for the partition, but there are two replicas and two Isr (broker 3 and 1)
Upvotes: 10