apache kafka – Kakfa createTopics is getting failed

I am new to Kafka and I am trying to create a topic using the command line and it is giving me the following error:

  C:\kafka\bin\windows>kafka-topics.bat --create --topic tutorialspedia --bootstrap-server localhost:9092
    Error while executing topic command : Call(callName=createTopics, deadlineMs=1684812803022, tries=1, nextAllowedTryMs=1684812803141) timed out at 1684812803041 after 1 attempt(s)
    [2023-05-23 09:03:23,047] ERROR org.apache.kafka.common.errors.TimeoutException: Call(callName=createTopics, deadlineMs=1684812803022, tries=1, nextAllowedTryMs=1684812803141) timed out at 1684812803041 after 1 attempt(s)
    Caused by: org.apache.kafka.common.errors.DisconnectException: Cancelled createTopics request with correlation id 3 due to node 0

 being disconnected
 (kafka.admin.TopicCommand$)

I have zookeeper and Kakfa running.

I have also tried following the code as suggested in other posts but getting the error:

C:\kafka\bin\windows>kafka-topics --zookeeper 127.0.0.1:2181 --topics first_topic --create --partitions 3 --replication-factor 1
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:567)
        at kafka.admin.TopicCommand$.main(TopicCommand.scala:47)
        at kafka.admin.TopicCommand.main(TopicCommand.scala)

Am I missing anything?

Read more here: Source link