Install Apache Kafka
In this article, we'll explore how to install Apache Kafka and Kafka Tool to track the consumer, producers,topics,groups etc in Kafka UI.
Apache Kafka Tutorial :
- Apache Kafka Architecture
- Install Apache Kafka (Zookeeper+Broker) / Kafka Tool
- Spring Boot Apache Kafka String Message Example
- Spring Boot Apache Kafka JSON Message Example
- Apache Kafka Interview Questions and Answers
Java setup
- Download JDK:
If Java is not setup at your machine, download the JDK by visiting the following link. http://www.oracle.com/technetwork/java/javase/downloads/index.html - Extract the downloaded JDK at specific folder.
- Set the path: Under Environment Variables, set the JAVA_HOME and PATH variable as below.
JAVA_HOME =C:/jdk-1.8.0_60
PATH=%JAVA_HOME%\bin - Now, to confirm the Java installation, open cmd window and type "java -version" to see installed jdk version.
Kafka and Zookeeper Installation
- Download : Go to the download page of Apache Kafka https://kafka.apache.org/downloads.html and download the Scala 2.12 - kafka_2.12-0.10.2.1.tgz
- Unzip : it to a particular location - "D:\kafka_2.12-2.4.0"
- Start zookeeper : This Kafka installation comes with a built-in zookeeper. Zookeeper
is mainly used to track the status of the nodes present in the Kafka cluster and to keep
track of Kafka topics, messages, etc.
# Start the ZooKeeper service .\bin\windows\zookeeper-server-start.bat .\config\zookeeper.properties
- Start the Apache Kafka : Use below command to start the Apache Kafka
# Start the Kafka broker service .\bin\windows\kafka-server-start.bat .\config\server.properties
- You can notice, kafka has started at default port 9092
Install Apache Kafka Tool
-
Download the Kafka UI Tool for your operating system. Kafka tool is a GUI application
for managing Kafka clusters.
- Once it is downloaded,installed at your machine as per below steps:
- Click on Next.
- Click on accept and click on Next.
- Provide the path to installed Kafka Tool.
- Click on Finish.
- Once it is installed, open Kafka Tool.
- It'll show pop up message to configure connection for Kafka Cluster. Click on Ok
- Provide any cluster name and click on Yes.
- Once Cluster is configured, it'll listen to the zookeeper (2181) as mentioned in above step. You can start the zookeper and kafka server as mentioned in Kafka Install Section. You can run the Kafka Example1 or Example 2 to see the created broker, consumer,topic, partition, offset details etc.