devyoon
devyoon

Reputation: 69

I can't run Kafka on windows

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)

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'

Upvotes: 6

Views: 10725

Answers (11)

Change the directory of Kafka to keep simple

Like:

From kafka_2.13-3.0.0 to kafka

It works for me

Upvotes: 0

krishna
krishna

Reputation: 1

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

worked for me.

Upvotes: 0

tonydn
tonydn

Reputation: 45

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.

Upvotes: 0

ADR
ADR

Reputation: 1

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

Upvotes: 0

Imranmadbar
Imranmadbar

Reputation: 5460

Change the directory of Kafka to keep simple

Like:

From kafka_2.13-3.0.0 to kafka

It's worked for me.

Upvotes: 4

Vishal R
Vishal R

Reputation: 1379

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.

Upvotes: -1

mehnet ali
mehnet ali

Reputation: 133

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

d:\kafka\

Upvotes: 1

Batkhuyag Ochirkhuyag
Batkhuyag Ochirkhuyag

Reputation: 31

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

Upvotes: 3

Aarya
Aarya

Reputation: 131

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

Upvotes: 0

Shambhu Nath
Shambhu Nath

Reputation: 119

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

Upvotes: 0

Robin Moffatt
Robin Moffatt

Reputation: 32090

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

Upvotes: 0

Related Questions