I can't run Kafka on windows

Viewed 5259

I'm learning about Microservice Architecture these days and I need to run Kafka to follow some tutorials. However, zookeeper-server-start on cmd which is the first step for running up Kafka doesn't work for me. It says 'the syntax of the command is incorrect'

I followed process below

  1. download kafka and extarct (https://kafka.apache.org/downloads - kafka_2.11-2.1.0.tgz (binary download))

  2. open cmd and write command

These are what I've tried so far (at kafka directory)

  • bin\windows\zookeeper-server-start.bat zookeeper.properties
  • .\bin\windows\zookeeper-server-start.bat .\config\zookeeper.properties
  • \bin\windows\zookeeper-server-start.bat \config\zookeeper.properties
  • zookeeper-server-start.bat ../../config/zookeeper.properties

and so on... plus, kafka directory is not too long to cause the error.(C:\kafka)

This is an capture image. Second line means 'the syntax of the command is incorrect'

7 Answers

I have moved Kafka folder directly to a different directory and renamed long Kafka-version as well. After that, it works fine.

Change the directory of Kafka to keep simple

Like:

From kafka_2.13-3.0.0 to kafka

It's worked for me.

Let's consider you have unzip kafka_xxx.tgz in folder (C:\kafka) then you can use as below command: C:\kafka\bin\windows>zookeeper-server-start.bat C:\kafka\config\zookeeper.properties
You may get message as "The syntax of the command is incorrect", But you can ignore it. It will not cause any problem.

If you would like to verify zookeeper is running or not then you can open other command prompt and use below command: C:\User> jps
Output:
12896 Jps
13264 QuorumPeerMain

Kafka in window zookeeper-3.4.10\conf\zoo-sample.cfg rename: zoo-sample.cfg to zoo.cfg and change into zoo.cfg

dataDir=C:\\Users\\Sumit\\zookeeper-3.4.10\\zookeeper

Now start{zookeeper bin folder}: zkserver


open kafka directory and type following code in cmd-promot

.\bin\windows\kafka-server-start.bat .\config\server.properties

check for correct Path , use from English characters to Path and Use a shorter address. example :

d:\kafka\

I faced a similar issue [on windows].
tried changing the dataDir variable to C://path-to-tmp/folder.
It did not work.
Then changed the drive letter to small i.e.
c:/path-to-tmp/folder
and lo and behold it works like a charm.

True Story.

Related