How to Install Kafka on Windows 10 with pictures

In this article, we will explain how to install Kafka on Windows 10 operating system with simple steps.



Kafka setup on Windows 10:

Prerequisites:

1.Java 11 Installation and configuration are mandatory because Kafka and Zookeeper are written Java so we will need JDK as well.

2. You will need to install and configure Apache Zookeeper for Apache Kafka.

Installation of Kafka:

Step 1: Download Kafka from apache official website:

Apache Kafka Download

1.After downloading Kafka zip file the go to your Kafka config directory, like  C:\kafka_2.11-0.9.0.0\config

2. Then Edit the file “server.properties”

3.Open server.properties file in Notepad++ for better convenient then find & edit the line “log.dirs = \tmp\kafka-logs” to “log.dir = C:\kafka_2xx-x.x.x.x\kafka-logs”




4. For Kafka server running on default port is 9092, in case if you want to change then simply changed it but don’t forget after that and it is directly connected to Zookeeper server default port which is 2181.

How to Run Kafka Server on Windows 10:

  1. Here will explain how Kafka server is running on Windows 10 operating system first you will go to your Kafka Installation directory C:\kafka_2.xx-x.x.x.x\
  2. Open a command prompt here by pressing shift+right click and choose “Open command window here” option)
  3. Now type “.\bin\windows\kafka-server-start.bat .\config\server.properties” and press enter
  4. .\bin\windows\kafka-server-start.bat  .\config\server.properties

How to Create a Kafka Topic:

Once running Kafka server then type below command for creating Kafka topic

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

How to Create a Kafka Topic for Producer:

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

How to Create a Kafka Topic for Consumer:

.\bin\windows\kafka-console-consumer.bat --broker -list localhost:9092 --topic test

 

Below commands for Kafka developers and Admins:

How to checklist topics in Kafka using below command :

.\bin\windows\kafka-topics.bat --list --zookeeper localhost:2181

How to describe Topic in Kafka using below command :

.\bin\windows\kafka-topics.bat –describe –zookeeper localhost

How to read messages from the beginning:

.\bin\windows\kafka-console-consumer.bat --zookeeper localhost :2181 --topic [Topic Name] -- from - beginning

How  to Delete Topic in Kafka :

.\bin\windows\kafka-run.class.bat Kafka.admin.TopicCommand 99delete --topic[topic_to_delete] --zookeeper localhost :2181