Install Apache Kafka – Step-by-Step Guide for Beginners
💡 Introduction
Apache Kafka is a distributed event-streaming platform used for real-time data pipelines and stream processing.
It allows different systems to communicate through publish-subscribe messaging with high throughput, reliability, and scalability.
In this tutorial, we’ll learn how to install and run Kafka on your local machine (Windows, Linux, or macOS) using both manual and Docker approaches.
⚙️ 1️⃣ What You’ll Need
Before you start, ensure you have:
-
☕ Java 8+ (JDK) installed and added to PATH
-
🧰 Apache Kafka (latest stable release)
-
🐧 Linux, 🪟 Windows, or 🍎 macOS
-
🐋 (Optional) Docker for containerized setup
📦 2️⃣ Download and Extract Kafka
🔹 For Manual Installation
-
Go to the official Kafka downloads page:
👉 https://kafka.apache.org/downloads -
Choose a binary version (e.g.,
kafka_2.13-3.7.0.tgz) and extract it:
🧠 3️⃣ Start Zookeeper
Kafka requires Zookeeper to manage brokers and cluster metadata.
Run Zookeeper using the built-in script:
If you’re on Windows:
📋 Tip:
By default, Zookeeper listens on port 2181.
📡 4️⃣ Start Kafka Broker
Open a new terminal and run:
On Windows:
✅ You should see a message like:
📋 Default Kafka ports:
| Component | Port |
|---|---|
| Zookeeper | 2181 |
| Kafka Broker | 9092 |
💬 5️⃣ Create a Kafka Topic
Let’s create a topic named jbpm-events:
✅ To list topics:
✉️ 6️⃣ Send and Read Messages
📨 Producer (send messages)
Type your messages and press Enter after each.
📥 Consumer (read messages)
Open another terminal:
You’ll see the same messages appear on the consumer terminal. 🎉
🐋 7️⃣ Optional: Run Kafka via Docker
For a faster setup, use Docker Compose.
Create a file docker-compose.yml:
Run:
✅ Kafka and Zookeeper will start automatically.
🧹 8️⃣ Stop and Clean Up
When done:
Or with Docker:
🧠 9️⃣ Common Issues & Fixes
| Issue | Cause | Fix |
|---|---|---|
Address already in use | Ports 9092/2181 busy | Stop old services or change ports |
Connection refused | Zookeeper not started | Start Zookeeper first |
Broker not available | Misconfigured listeners | Update server.properties host settings |
🧩 10️⃣ Next Steps
Once Kafka is running, you can:
-
Integrate it with jBPM for event-driven workflows
-
Use Spring Boot + Kafka for microservice messaging
-
Monitor with Prometheus + Grafana
-
Stream analytics using Kafka Streams or Flink
👉 Watch Install Apache Kafka in Action better:
🎯 You’ve successfully installed Apache Kafka!
Now you can start sending and receiving messages, and integrate it with powerful platforms like jBPM, Camunda, or Spring Boot to build real-time data pipelines and process automation.
💼 Professional Support Available
Technologies covered include Java, Spring Boot, PL/SQL, Azure, and workflow automation (jBPM, Camunda BPM, RHPAM).
📧 Contact: ishikhanirankari@gmail.com | info@realtechnologiesindia.com
🌐 Website: IT Trainings | Digital metal podium
Comments
Post a Comment