Logo

dev-resources.site

for different kinds of informations.

Apache Kafka with Docker

Published at
12/25/2024
Categories
programming
devops
kafka
Author
Zahid Ahmed
Categories
3 categories in total
programming
open
devops
open
kafka
open
Apache Kafka with Docker

Apache Kafka, a robust distributed streaming platform, is essential for building dynamic data pipelines and real-time applications. Pairing it with Docker makes setting up Kafka seamless, empowering developers to explore and innovate effortlessly. In this guide, we’ll dive into the step-by-step process of running Apache Kafka with Docker

Create Docker Compose File

https://github.com/zahido/Docker.git

This docker-compose.yml file contains kafka, zookeeper & GUI redpanda.

Spin Docker Compose

docker-compose up -d

Verify Container is Running

docker ps

Create Topic

docker exec -it <kafka-container-id> /opt/kafka/bin/kafka-topics.sh --create --zookeeper zookeeper:2181 --replication-factor 1 --partitions 1 --topic my-topic

Replace with the actual container ID of the Kafka container (you can find it using docker ps).

Produce & Consume Messages

docker exec -it <kafka-container-id> /opt/kafka/bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic my-topic --from-beginning

Replace with the actual container ID of the Kafka container.

You’ve successfully set up and run Apache Kafka on Docker well done! This guide offers you a straightforward yet effective way to experiment with Kafka. 🚀

Featured ones: