2
votes

I have downloaded kafka_2.12-2.1.0 and placed in folder path "C:\kafka_2.12-2.1.0". For starting kafka zookeeper, I executed the below command in command prompt,

C:\kafka_2.12-2.1.0>bin\windows\zookeeper-server-start.bat config\zookeeper.properties

I am getting error message as below,

The syntax of the command is incorrect. The filename, directory name, or volume label syntax is incorrect.

I could not understand what I am doing wrong. Can someone please help. I am successfully able to start zookeeper and kafka server in Linux "bin/zookeeper-server-start.sh config/zookeeper.properties"

1
You can follow the answer at stackoverflow.com/questions/25037263/…turong

1 Answers

3
votes

First of all, don't forget that you're in a windows operating system so don't forget the dot . before the path .\bin\...

Zookeeper Installation Locate your Zookeeper config directory. For example C:\zookeeper-3.4.7\conf.

Locate .cfg file and Copy and Rename zoo_sample.cfg to zoo.cfg in C:\Tools\zookeeper-3.4.9\conf

Open it with any text editor like Notepad++

Find and edit dataDir=/tmp/zookeeper to :\zookeeper-3.4.7\data

In addition, add an entry in the System Environment Variables as you did for Java. this means something like this

Add ZOOKEEPER_HOME = C:\zookeeper-3.4.7 to the System Variables.

add ;%ZOOKEEPER_HOME%\bin;

Run Zookeeper by opening a new cmd and type : zkserver.

KafkaServer

Running a Kafka Server type

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

Create Topic

in order to create topics now you should do this:

  • Now create a topic with the name “test” and a replication factor of 1, as we have only one Kafka server running. If you have a cluster with more than one Kafka server running, you can increase the replication-factor accordingly, which will increase the data availability and act like a fault-tolerant system.

  • Open a new command prompt in the location C:\kafka_2.12-2.1.0\bin\windows.

  • Type the following command and hit Enter:

kafka-topics.bat --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test

Creating a simple Producer and Consumer to Test

Open a new command prompt in the location C:\kafka_2.12-2.1.0\bin\windows and type this for the producer:

kafka-console-producer.bat --broker-list localhost:9092 --topic test

Again open a new command prompt in the same location and type:

kafka-console-consumer.bat --zookeeper localhost:2181 --topic test

Take a look at this post you will find it useful