It will give information about Installing and Configuring Apache Kafka & Zookeeper for Windows Operating System
Introduction
This tutorial aims to provide a step by step guide to run Apache Kafka on a windows OS. This guide will also provide instructions to setup Java & zookeeper. Apache
kafka is a fast & scalable messaging queue, capable of handeling real heavy loads in context of read & write. You can find more about kafka onhttp://kafka.apache.org/.
Apache kafka requires a zookeeper instance running which is used for reliable distributed cordination. Please find more about Zookeeper
onhttps://zookeeper.apache.org/.
Installation
a. Install & Setup Java Runtime Environment JRE
1. Start JRE installation and hit the check box Change destination folder, then click install.
1. Change the installation directory to any path without spaces in folder name. Ex C:\Java\jre1.8.0_xx\. By default it will be C:\Program Files\Java\jre1.8.0_xx then
click Next.
2. Now open system environment variables dialogue by opening Control Panel > System > Advanced system settings > Environment Variables
3. Hit New button in User variables section then type JAVA_HOME in Variable name & give your jre path in Variable value. It should look like:
Java path and version may change according to the version of Kafka you are using
If your command prompt some what looks like the image above, you are good to go. Else you need to recheck whether your setup version is matching with OS
architecture x86, x64 or environment variables path is correct in or not.
6. You can change the default zookeeper port in zoo.cfg file Default port 2181.
7. Run zookeeper by opening a new cmd & type zkserver.
8. You will see the command prompt with some details like image below.
Congratulations your zookeeper is up & running on port 2181.
c. Setting Up Kafka
Note:
Please ensure that your zookeeper is up & running before starting Kafka server.
1. Go to your kafka installation directory C:\kafka_2.110.9.0.0\
2. Open a command prompt here by pressing Shift + right click and choose Open command window here option
3. Now type .\bin\windows\kafkaserverstart.bat .\config\server.properties & press enter.
1. If everything went fine your command prompt will look like this one
1. Now your Kafka is up & running, so now you can create topics & produce or consume data from java/scala code & command prompt also.
1. Now create a topic with name test & replication factor 1 as we have only one Kafka server running. If you have a cluster with more than 1 Kafka servers
running, you can increase the replicationfactor accordingly which will increase the data availability & act like a faulttolerant system.
2. Open a new command prompt in the location C:\kafka_2.110.9.0.0\bin\windows
3. Type following command and hit enter
kafkatopics.bat create zookeeper localhost:2181 replicationfactor 1 partitions 1 topic test
1. Now type anything in the producer command prompt & press enter and you should be able to see the message in the other consumer command prompt.
1. If you are able to push & see your messages in consumer side, you are done with Kafka setup.
Reference Links
1. http://kafka.apache.org/documentation.html
2. https://zookeeper.apache.org/doc/trunk/zookeeperStarted.html
Conclusion
I am sure, this article will be helpful for Beginners & Intermediary Programmers to Start a kafka Server on their Windows Servers or Desktops.
Yours Friendly
Gopal Tiwari
License
This article, along with any associated source code and files, is licensed under The Code Project Open License
CPOL
Share
EMAIL TWITTER
Apache Hadoop for Windows Platform Smarter Security Camera: A POC Using the
Intel IoT Gateway
Apache Kafka 0.9 Scala Producer/Consumer Connecting to Microsoft Azure with Node
With Some RxScala Pixie Dust RED
Search Comments Go
General News Suggestion Question Bug Answer Joke Praise Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.
Permalink | Advertise | Privacy | Terms of Use | Mobile Layout: fixed | Article Copyright 2016 by GopalTiwari
Select Language
Web02 | 2.8.161101.1 | Last Updated 11 Jan 2016 fluid Everything else Copyright CodeProject, 19992016