How to install Kafka on Windows, easy 10 minutes

This tutorial shows you how to install Kafka on Windows. Apache Kafka is an open-source message broker project developed by the Apache Software Foundation written in Scala. Kafka is a high-throughput, low-latency platform capable of handling hundreds of megabytes of reads and writes per second from thousands of clients. Let start step by step:

How to install Kafka on Windows

Download and Setup ZooKeeper

At the moment of writing this tutorial, the latest stable release was zookeeper-3.5.6.

Choose the link apache-zookeeper-3.5.6-bin.tar.gz and download zookeeper for windows. Extract that file in somewhere on your local machine, e.g: D:apache-zookeeper-3.5.6 on my local.

Install Zookeeper on Windows

Follow the below steps:

  1. Navigate to the ZooKeeper directory then located under subfolder conf.
  2. Copy the file zoo_sample.cfg and rename to zoo.cfg.
  3. Open the newly created zoo.cfg in a text editor.
  4. Find the “dataDir=/tmp/zookeeper” entry and change it to “dataDir=D:/data/zookeeper”.
  5. Next, set the ‘ZOOKEEPER_HOME’ then Edit (or add if it doesn’t exist) the variable with name “PATH” and add “;%ZOOKEEPER_HOME%bin

Now that ZooKeeper is configured on your windows, verify it by running the command zkserver in the command prompt. You will see the output like this

Zookeeper start with port default 8080, you can see that in the console. It means Zookeeper is installed successfully.

Download and Setup Kafka

Open the Kafka releases page which contains the latest binary downloads then choose the highest supported version. At the moment of writing the latest stable release was kafka_2.13-2.4.0.tgz.

Extract the gzipped TAR file that you just download in somewhere in your windows, e.g: D:kafka_2.13-2.4.0, like this:

Install Kafka on Windows

Follow the below steps:

  1. Navigate to the Kafka directory (e.g: D:kafka_2.13-2.4.0) then located to subfolder config.
  2. Edit the file server.properties in a text editor.
  3. Find the “log.dirs=/tmp/kafka-logs” entry and change it to “log.dirs=D:/data/kafka-logs”.  That folder is located anywhere you want.

Now, it is time to start your Kafka. Let open the console then go to the Kafka directory (e.g: D:kafka_2.13-2.4.0) and run the command.

Note: You must start Zookeeper before starting Kafka.

When starting, you will see the output below. It means Kafka is started successfully.

How to install Kafka on Windows

So far, you have ZooKeeper and Kafka installed on Windows. I hope that you know how to install Kafka on Windows. You may be interested in the Spring Kafka tutorial

Please share it if you found this useful
Hide Buttons