Reputation: 707
The kafka cluster consists of 3 nodes.
I can create a topic and specify its patitiions by running commad:
kafka-topics.sh --zookeeper xxx --create --partitions 1 --replication-factor 3 --topic mytopic
Meanwhile, there is a parameter named nums.partitions=1
in a configuration file kafka/config/server.properties
.What is the relationship between them?
What happens when I have different combination of these two parameters under condition that they are less than/more than/equal to the number of nodes/partitions?
--partitions 1 & nums.partitions=1
--partitions 2 & nums.partitions=1
--partitions 3 & nums.partitions=1
--partitions 4 & nums.partitions=1
--partitions 1 & nums.partitions=2
--partitions 2 & nums.partitions=2
--partitions 3 & nums.partitions=2
--partitions 4 & nums.partitions=2
--partitions 1 & nums.partitions=3
--partitions 2 & nums.partitions=3
--partitions 3 & nums.partitions=3
--partitions 4 & nums.partitions=3
--partitions 1 & nums.partitions=4
--partitions 2 & nums.partitions=4
--partitions 3 & nums.partitions=4
--partitions 4 & nums.partitions=4
Upvotes: 1
Views: 271
Reputation: 1229
The config file is used usually for the server level , which means it will be default configurations when you start up kafka server.
If you specify something else in your command like —-partitions 1
it will overwrite the default configurations.
So, basically you should follow one way of them, and avoid mixing configurations in different places. Specially If you are going to use kafka cluster with another application.
Upvotes: 2