vvra
vvra

Reputation: 2922

How Kafka distributes the topic partitions among the brokers

I have 3 Kafka brokers in 3 different VMs, with one additionally running a Zookeeper. I now create a topic with 8 partitions. The Producer pushes messages to these group of brokers on the created "topic".

Upvotes: 18

Views: 6230

Answers (1)

Gwen Shapira
Gwen Shapira

Reputation: 5168

  • When you create a new topic, Kafka places the partitions and replicas in a way that the brokers with least number of existing partitions are used first, and replicas for same partition are on different brokers.

  • When you add a new broker, it is used for new partitions (since it has lowest number of existing partitions), but there is no automatic balancing of existing partitions to the new broker. You can use the replica-reassignment tool to move partitions and replicas to the new broker.

  • Yes, you can add partitions to an existing topic.

Upvotes: 32

Related Questions