Zookeeper is not a recognized option

Running command :

.\bin\windows\kafka-topics.bat –create –zookeeper localhost:2181 –replication-factor 1 –partions 1 –topic TestTopic will give error:

Exception in thread "main" joptsimple.UnrecognizedOptionException: zookeeper is not a recognized option
        at joptsimple.OptionException.unrecognizedOption(OptionException.java:108)
        at joptsimple.OptionParser.handleLongOptionToken(OptionParser.java:510)
        at joptsimple.OptionParserState$2.handleArgument(OptionParserState.java:56)
        at joptsimple.OptionParser.parse(OptionParser.java:396)
        at kafka.admin.TopicCommand$TopicCommandOptions.<init>(TopicCommand.scala:517)
        at kafka.admin.TopicCommand$.main(TopicCommand.scala:47)
        at kafka.admin.TopicCommand.main(TopicCommand.scala)

Root cause:
Newer versions(2.2 and above) of Kafka no longer require ZooKeeper connection string ie --zookeeper localhost:2181 and throw Exception in thread "main".


Use the below command for creating a topic in Kafka:

./kafka-topics.sh --create --topic test-topic --bootstrap-server localhost:9092 --replication-factor 1 --partitions 4

For all the commands in kafka-topics.sh –help will give all the options available.


Leave a Reply

Your email address will not be published. Required fields are marked *

thirteen − six =