[Fixed] Missing required argument “[partitions]”

This is the error message you get when you try to create the Kafka topic in the command line. Kafka organizes message feeds into categories called topics. Each topic has a name that is unique across the entire Kafka cluster.

Let me show you, what command I ran and got this error.

kafka-topics --zookeeper 127.0.0.1:2181 --topic first-topic --create

The theory of Kafka says that, when creating a topic, you need to mention the number of partitions in the command. Let’s change the command and rerun it as below.

kafka-topics --zookeeper 127.0.0.1:2181 --topic first-topic --create --partitions 3

When we run this command, we come across another error as below –

Missing required argument “[replication-factor]”

So, when you define the partitions, you also need to define the replication-factor as well. Change the command as follows.

kafka-topics --zookeeper 127.0.0.1:2181 --topic first-topic --create --partitions 3 --replication-factor 1

Now, we get the topic created.

Thank you All!!! Hope you find this useful.


Up ↑

%d bloggers like this: