Skip to main content

๐Ÿณ Kafka KRaft (Raft-based) Setup with Docker Compose ๐Ÿณ

This guide demonstrates how to set up a KRaft-based Apache Kafka broker (no Zookeeper needed!) along with Kafka UI for topic/consumer inspection.

๐Ÿ“ฆ Docker Compose: Kafka KRaft + Kafka UI


๐Ÿ” Key Kafka KRaft Config Explanation


๐Ÿš€ Usage Commands

๐ŸŸข Start the Kafka Cluster

Kafka will be exposed on:
  • localhost:9094 โ†’ External client access
  • localhost:8088 โ†’ Kafka UI Dashboard

๐Ÿ”ด Stop and Clean Up


๐Ÿงช Working with Kafka Topics (No Zookeeper)

โœ… Create Topics

๐Ÿ“‹ List Topics

๐Ÿ“ฅ Consume from a Topic

๐Ÿ“ค Produce to a Topic


๐ŸŒ Kafka UI Dashboard

Access the Kafka dashboard at: ๐Ÿ‘‰ http://localhost:8088
You can:
  • View topics
  • Inspect partitions and messages
  • See consumer groups
  • Produce/consume messages directly from UI

โš ๏ธ Notes

  • No Zookeeper: This setup uses Kafka KRaft mode, available from Apache Kafka 3.x+, eliminating Zookeeper dependency.
  • Multiple Brokers: For multi-node Raft quorum, adjust KAFKA_CONTROLLER_QUORUM_VOTERS accordingly.
  • Production Security: Add SSL and authentication configs before exposing Kafka publicly.

๐Ÿ“š Summary