Create Kafka Cluster

How to create Kafka Cluster?

Follow the below steps to create a kafka cluster and write/read message from kafka.
  1. Install Kafka

  2. Set up KAFKA_HOME as environment variable

  3. Set up PATH as environment variable.

  4. Start the Kafka Environment

  5. Start the Kafka Environment/zookeeper

  6. Set up Kafka Brokers

  7. Create a Topic

  8. Create a Producer for writing and publish messages

  9. Create a Consumer for consume or read the messages

  1. Download the "binary" file(not source code) from the Apache Kafka website https://kafka.apache.org/downloads

  2. kafka Download
  3. Create a folder as "kafka" in "C" directory, copy and paste into the kafka folder and extract the file.

  4. Kafka Setup Windows

  5. Go to the windows search box and type "environment variables for your account". Click on first option as per below screen.

  6. Kafka Setup Windows

  7. Click on "New". A popup window will be displayed on click on new button.
  8. Write "KAFKA_HOME" in the variable name's text field.
  9. Copy the path of extracted folder and paste into the next field then click on Ok as per below screen.

  10. Kafka Environment Variable Setup

  11. Click on "Path" then click on "Edit" as per below screen.
  12. Go to the bin folder of extracted directory and copy the path of bin folder as per below screen.
  13. Paste the bin directory copied path into a new text field at the last, then click on "OK".

  14. Kafka Setup environment variable on Windows

  15. 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.
  16. 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
                                

  17. 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