2
votes

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'

6
I have ran something like .\bin\windows\zookeeper-server-start.bat .\config\zookeeper.properties before, and it works fine for me. Please show the entire contents of your CMD and the full error - OneCricketeer
@cricket_007 I added an image! - devyoon
Is it possible to try to change the language of your prompt? It's hard to reproduce your problem when we cannot read the commands / errors ourselves - OneCricketeer
@cricket_007, I get same error as:The input line is too long. The syntax of the command is incorrect. - Mandroid
I believe the error caused by long directory placement. I have similar problem and I solved it by moving the kafka folder to a shallower place like C:\Users\myname\kafka and the problem is gone - Dendi Handian

6 Answers

0
votes

Best thing to do is run Docker, and Kafka under that. You can find docker images here, and an example Docker Compose here

0
votes

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

0
votes

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

0
votes

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

0
votes

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

d:\kafka\
-1
votes

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.