Shashant Gour
Shashant Gour

Reputation: 31

Ambiguity in the number of partition in server.properties and in topic creation --partition parameter in apache kafka

In kafka I have created the topic with the ./kafka-topics.sh command. the command would be like

./kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 8 --topic test

With 8 partitions for the topic test, there is server.properties configuration in the kafka broker, which also has num.partitionsparameter which is default is 1.

Now my specific question is it will not create ambiguity in the partition for the topic test. It will consider partition that were mentioned at the time of topic creation or num.partition in the server.properties

Upvotes: 3

Views: 808

Answers (1)

D. Krauchanka
D. Krauchanka

Reputation: 274

Kafka can be configured to create topics on demand. It means that if you try to send message to the topic that not exists, topic will be created automatically with the number of partitions that was specified as num.partitions property in server.properties. If you are going to create topic by yourself using

./kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 8 --topic test

the topic will be created with the number of partitions specified as --partitions, in your case it will be 8, and property num.partitions will be ignored.

Upvotes: 1

Related Questions