我要啦免费统计

Set Up Kafka On Windows (Actually Working)

In this tutorial, I will show how to set up and run Apache Kafka on Windows. Getting Kafka 0.8.1 running on Windows isn’t straightforward if you follow Apache Kafka’s documentation. They are somewhat misleading, and the bat files included in the Kafka package are significantly outdated and could not work properly. However, with correct instructions and updated bat files it’s easy and can be done under 10 minutes.

Kafka comes with two sets of scripts to run Kafka. In the bin folder, the sh files are used to set up Kafka in a Linux environment. In the bin\windows folder, there are also some bat files corresponds to those sh files which are supposed to work in a Windows environment. But these bat files are not well-maintained. For example, Kafka sh scripts merged kafka-list-topic.sh and kafka-create-topic.sh to kafka-topics.sh instead ago; but the windows bat files still uses the old kafka-list-topics.bat and kafka-create-topic.sh. Some say you can use Cygwin to execute the sh scripts in order to run Kafka. However, they are many additional steps involved, and in the end you may not get the desired outcome. With the correct bat files, there is no need to use Cygwin, and only Server JRE is required to run Kafka on Windows.

Step 0: Preparation

Install Java SE Server JRE

You need Java SE Server JRE in order to run Kafka. If you have JDK installed, you already have Server JRE installed, just check if the folder {JRE_PATH}\bin\server exists. If it is not, follow the following steps to install Java SE Server JRE:

  1. Download Java SE Server JRE from http://www.oracle.com/technetwork/java/javase/downloads/index.html

  2. Unpack it to a folder, for example C:\JREServer.

  3. Update the system environment variable PATH to include C:\JREServer\jre\bin, follow this guide provided by Java.

Download Kafka

  1. Download the binaries from http://kafka.apache.org/downloads.html

  2. Unpack it to a folder, for example C:\kafka

    Read More