How to setup and Install Kafka on Windows

How to setup and run Apache kafka on Windows

Prerequisite for Apache Kafka

1.    Install JRE

2.    Install and Configure Apache Zookeeper.


Configuring Apache ZooKeeper on Windows

Instructions:

  • 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 command prompt and type zkserver


 Kafka on Windows


 Kafka on Windows2



Configuring Apache Kafka on Windows

  •  Download the binary (not source) file from https://kafka.apache.org/downloads
  •  Go to config folder in Apache Kafka and edit “server.properties” 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 basics


kafka server start


kafka server start2


Configuring a Topic in Kafka and Publish/Subscribe to Messages

Commands:

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


kafka server start4


Using Kafka Tool (GUI) to manage Kafka cluster


 manage kafka cluster


zookeeper browser


zookeeper browser2


zookeeper browser 3