Create Kafka Cluster
How to create Kafka Cluster?
Follow the below steps to create a kafka cluster and write/read message from kafka.
Install Kafka
Set up KAFKA_HOME as environment variable
Set up PATH as environment variable.
Start the Kafka Environment
Start the Kafka Environment/zookeeper
Set up Kafka Brokers
Create a Topic
Create a Producer for writing and publish messages
Create a Consumer for consume or read the messages
-
Download the "binary" file(not source code) from the Apache Kafka website
https://kafka.apache.org/downloads
kafka Download
-
Create a folder as "kafka" in "C" directory, copy and paste into the kafka folder and extract the file.
Kafka Setup Windows
-
Go to the windows search box and type "environment variables for your account". Click on first
option as per below screen.
Kafka Setup Windows
-
Click on "New". A popup window will be displayed on click on new button.
-
Write "KAFKA_HOME" in the variable name's text field.
-
Copy the path of extracted folder and paste into the next field then click on Ok as per below screen.
Kafka Environment Variable Setup
-
Click on "Path" then click on "Edit" as per below screen.
-
Go to the bin folder of extracted directory and copy the path of bin folder as per below screen.
-
Paste the bin directory copied path into a new text field at the last, then click on "OK".
Kafka Setup environment variable on Windows
-
After completed above setup, you need to open command prompt and go to the bin/windows directory of kafka extracted folder in the command prompt.
-
Write the command below in the command prompt.
zookeeper-server-start.bat C:\kafka\config\zookeeper.properties
kafka-server-start.bat C:\kafka\config\server.properties
Kafka Start on Comand Prompt
In the next topic, you will understand about how to write kafka message in java. See the details of
Write Kafka Producer In Java