Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exception in thread "main" joptsimple.UnrecognizedOptionException: zookeeper is not a recognized option

Tags:

apache-kafka

I am new to kafka and zookepper, and I am trying to create a topic, but I am getting this 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)

I am using this command to create the topic -

.\bin\windows\kafka-topics.bat --create --zookeeper localhost:2181 --replication-factor 1 --partions 1 --topic TestTopic
like image 718
Yogeshwar Chaturvedi Avatar asked Sep 23 '21 09:09

Yogeshwar Chaturvedi


1 Answers

Newer versions(2.2+) of Kafka no longer requires ZooKeeper connection string

--zookeeper localhost:2181

It throws the following exception while creating a topic

Exception in thread "main" joptsimple.UnrecognizedOptionException: zookeeper is not a recognized option

Instead, add Kafka Broker --bootstrap-server localhost:9092 connection string.

./kafka-topics.sh --create --topic test-topic --bootstrap-server localhost:9092 --replication-factor 1 --partitions 4
like image 75
Pooja Joshi Avatar answered Oct 13 '22 01:10

Pooja Joshi