Start ZooKeeper and Kafka in Windows OS

In this post, we will start the Kafka and the ZooKeeper from Windows Operating System. First, we will start the Zookeeper and then the Kafka.

Apache Kafka is an open-source distributed event streaming platform used by thousands of companies for high-performance data pipelines, streaming analytics, data integration, and mission-critical applications.

ZooKeeper is a centralized service for maintaining configuration information, naming, providing distributed synchronization, and providing group services.


Configuration Changes

Go to the Kafka root directory and create a new folder named data. Inside that create 2 more folders named zookeeper and kafka respectively.

These two folders will hold the kafka and zookeeper data. Copy the zookeeper folder path. For my case, it is as below.


Now open the config folder from the kafka root folder. Open file using any editor. I am using Notepad. Replace the dataDir value with the path you copied.

Make sure to use forward slashes in the path. Save the file and close it.

Start Zookeeper

Open the command line tool and type the following command to start the zookeeper server.

zookeeper-server-start.bat config\

If you see this pointed message, then your zookeeper is up and running at the specified port. If you see any error message, make sure the port is not busy and try closing any application running on the specified port and try again.

Start Kafka

Open another command line tool to start the kafka. Make sure you do not close the first command line window where zookeeper is already running.

First we will make some configuration changes for kafka. Copy the data/kafka folder path. Open the config folder and open the file. Change the path for log.dirs property.

Make sure to use the forward slashes in the path. Save the file and close the editor.

Run the below command in new command line window to start the kafka.

kafka-server-start.bat config\

If you see the pointed message, you come to know that kafka has started.

If you open the respective folders in data. You would see that kafka and zookeeper has saved some bunch of files in them.

Now, you have the kafka running in one command line window and zookeeper running in another. If you want to start working with them, you will have to open another command line window and start writing commands.

Thank you All!!! Hope you find this useful.

One thought on “Start ZooKeeper and Kafka in Windows OS

Add yours

Leave a Reply

Up ↑