Wednesday, February 27, 2013

Kafka on Windows for people with zero idea about it

So I'm new to Scala and SBT and I just want to get Apache Kafka working on my Windows machine as well, how did I go about it? well it was fairly simple once I started using my eyes.

Step 1 - Grab the latest version of Apache Kafka from:
http://kafka.apache.org/downloads.html
However if you are not in the mood to rewrite all .sh files to .bat just grab a zip which includes the bat file from:
https://github.com/apache/kafka/tree/trunk/bin/windows
(I did this because I just wanted to get go go going)

Step 2 - Unzip and follow the Kafka Quickstart guide (http://kafka.apache.org/quickstart.html)
> cd kafka-<VERSION>
> ./sbt update
> ./sbt package

Step 3 - Do not start the server yet, the dependencies are not your classpath, so no point in starting the server at all instead I just added the dependencies to a dir where it just happened to be picking jars from
add the following jars if not already present to kafka-<VERSION>/core/lib dir:

jline-0.9.94
kafka-0.7.2
log4j-1.2.15
metrics-annotation-3.0.0-c0c8be71
metrics-core-3.0.0-c0c8be71
netty-3.2.2.Final
scala-library
slf4j-api-1.6.1
slf4j-log4j12-1.6.1
zkclient-20120522
zookeeper-3.4.5

obviously some of the jars were already there, I kept on adding the ones I needed by hit and trial

Step 4 - Start the zookeeper server as per the kafka quickstart guide
Step 5 - Before starting the kafka server take a look at the /conf/server.properties file, it aught to have "brokerid" property defined in it, it isn't present add it with value 0 from now.

Step 5 - Start Kafka server, and you are good to go.

Note: Wrote this in case someone wanted get started with Kafka quickly on a Windows machine, obviously its a bit of a hack but then again it was meant to be.







More >>