I can't run Kafka on windows
Asked Answered
M

11

6

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'

Mackay answered 11/1, 2019 at 17:27 Comment(5)
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 errorCosette
@cricket_007 I added an image!Mackay
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 ourselvesCosette
@cricket_007, I get same error as:The input line is too long. The syntax of the command is incorrect.Antilepton
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 goneDivulsion
S
4

Change the directory of Kafka to keep simple

Like:

From kafka_2.13-3.0.0 to kafka

It's worked for me.

Stead answered 17/1, 2022 at 6:5 Comment(0)
E
3

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

Enteritis answered 17/7, 2020 at 22:26 Comment(1)
this work for me i just renamed long Kafka-version-blah.. to only kafkaElectrolier
B
1

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

d:\kafka\
Break answered 1/1, 2021 at 15:16 Comment(0)
E
0

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

Enos answered 11/1, 2019 at 18:2 Comment(0)
G
0

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

Gupton answered 11/1, 2019 at 23:3 Comment(1)
Thanks, but it doesn't work for me. I can see Jps onlyMackay
G
0

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

Ganger answered 22/1, 2019 at 12:35 Comment(0)
R
0

I put the kafka folder under c: drive like C:\kafka_2 and also moved the properties files to the windows folder (because it was saying invalid input). Executed the command like : C:\kafka_2\bin\windows>zookeeper-server-start.bat zookeeper.properties, and it worked like magic

Razz answered 16/10, 2022 at 2:42 Comment(0)
P
0

I faced the same issue as you and the way I solved it, I keep the directory to shortest as possible: On my side: E:/kafka and the rest of the directories like (bin, config, etc..) will be inside kafka I hope it works for you.

Perea answered 15/1, 2023 at 16:1 Comment(0)
S
0

I have moved path to: .\bin\windows\zookeeper-server-start.bat .\config\zookeeper.properties

worked for me.

Santos answered 1/6, 2023 at 16:5 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Uncertainty
U
0

Change the directory of Kafka to keep simple

Like:

From kafka_2.13-3.0.0 to kafka

It works for me

Unisexual answered 22/6 at 15:1 Comment(0)
K
-1

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.

Katinakatine answered 28/1, 2021 at 9:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.