Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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
question from:https://stackoverflow.com/questions/66057059/what-does-partitions-parameter-mean-in-kafka

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
324 views
Welcome To Ask or Share your Answers For Others

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...