Why is kafka not creating a topic? bootstrap-server is not a recognized option
Asked Answered
A

1

29

I am new to Kafka and trying to create a new topic on my local machine.

I am following this link.

Here are the steps which i followed:

  1. Start zookeeper

    bin/zookeeper-server-start.sh config/zookeeper.properties
    
  2. Start kafka-server

    bin/kafka-server-start.sh config/server.properties
    
  3. Create a topic

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

but when creating the topic, i am getting the following error:

Exception in thread "main" joptsimple.UnrecognizedOptionException: bootstrap-server 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:358)
    at kafka.admin.TopicCommand$.main(TopicCommand.scala:44)
    at kafka.admin.TopicCommand.main(TopicCommand.scala)

Is there any other configuration required to create a topic? What wrong am i doing

Autotomize answered 3/4, 2019 at 12:16 Comment(0)
B
46

If you use version older than 2.2 you should use --zookeeper option and pass connection string to zookeeper

Command would be something like that:

bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test

Brent answered 3/4, 2019 at 12:18 Comment(4)
But the documentation uses bootstrap-server.Autotomize
Documentation is for version 2.2. I suppose you are using version 2.1 or older oneHuambo
Documentation is for 2.12 and i am using 2.11Autotomize
2.12 or 2.11 is scala version, not Kafka. kafka_2.12-2.1.0 means it is 2.1.0 Kafka versionHuambo

© 2022 - 2024 — McMap. All rights reserved.