How to setup and Install Kafka on Windows

24 Mar 2021

blog details

How to setup and Install Kafka on Windows

By: RSDigitech | Published At : 24 Mar 2021    

How to setup and run Apache Kafka on Windows:

This blog explains the detailed steps from requirements to setup, install, and how to run Apache Kafka on Windows. Follow the below steps to install JRE and configure the zookeeper for the successful installation of Kafka on windows.

Prerequisite for Apache Kafka:

1.    Install JRE

2.    Install and Configure Apache Zookeeper.

Configuring Apache ZooKeeper on Windows


  • Copy and Rename “zoo_sample.cfg” to “zoo.cfg” in C:\software_install\zookeeper-3.4.9\conf
  • Find & edit dataDir=/tmp/zookeeper C:\software_install\apache-zookeeper-3.5.6\data using any text editor like notepad or notepad++. (change the zookeeper version as yours)
  • Add entries in System Environment Variables.
  • Add in System Variables ZOOKEEPER_HOME = C:\software_install\zookeeper-3.4.9.
  • Edit System Variable named “Path” and append this in the last; %ZOOKEEPER_HOME%\bin;
  • Open the command prompt and type zkserver.

 Kafka on Windows

 Kafka on Windows2

Steps to configure Apache Kafka on Windows

  •  Download the binary (not source) file from
  •  Go to config folder in Apache Kafka and edit “” using any text editor.
  •  Find log.dirs and replace after “=/tmp/kafka-logs” to “=C:\software_install\kafka-2.4.0\logs” (change your version number)

log basicskafka server start

kafka server start2

Configuring a Topic in Kafka and Publish/Subscribe to Messages


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

kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic chat-message --from-beginning 

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

kafka-topics.bat --list --zookeeper localhost:2181

zookeeper-shell.bat localhost:2181 ls /brokers/ids

kafka server start3