0
0
KafkaHow-ToBeginner · 3 min read

How to Use Kafdrop in Kafka for Topic and Broker Monitoring

To use Kafdrop with Kafka, run the Kafdrop Docker container or Java jar pointing it to your Kafka broker address using the --kafka.brokerConnect option. Then open the Kafdrop web UI in your browser to view topics, partitions, and messages visually.
📐

Syntax

The basic syntax to run Kafdrop using Docker is:

  • docker run -d -p 9000:9000 -e KAFKA_BROKERCONNECT=<broker-address> obsidiandynamics/kafdrop
  • Or using the jar file:
  • java -jar kafdrop.jar --kafka.brokerConnect=<broker-address>

Here, <broker-address> is your Kafka broker's host and port, e.g., localhost:9092.

bash
docker run -d -p 9000:9000 -e KAFKA_BROKERCONNECT=localhost:9092 obsidiandynamics/kafdrop

java -jar kafdrop.jar --kafka.brokerConnect=localhost:9092
💻

Example

This example shows how to start Kafdrop using Docker to connect to a local Kafka broker and access the web UI on port 9000.

bash
docker run -d -p 9000:9000 -e KAFKA_BROKERCONNECT=localhost:9092 obsidiandynamics/kafdrop
Output
Unable to find image 'obsidiandynamics/kafdrop:latest' locally latest: Pulling from obsidiandynamics/kafdrop ... Digest: sha256:... Status: Downloaded newer image for obsidiandynamics/kafdrop:latest <container_id>
⚠️

Common Pitfalls

  • Incorrect broker address: Using the wrong Kafka broker host or port will prevent Kafdrop from connecting.
  • Network issues: If Kafka is inside Docker or a remote server, ensure network access and ports are open.
  • Missing ZooKeeper info: Kafdrop no longer requires ZooKeeper connection; only broker address is needed.
  • Port conflicts: Make sure port 9000 is free on your machine before running Kafdrop.
bash
docker run -d -p 9000:9000 -e KAFKA_BROKERCONNECT=wronghost:9092 obsidiandynamics/kafdrop
# This will fail to connect

# Correct usage:
docker run -d -p 9000:9000 -e KAFKA_BROKERCONNECT=localhost:9092 obsidiandynamics/kafdrop
📊

Quick Reference

Summary tips for using Kafdrop:

  • Use docker run or java -jar with --kafka.brokerConnect to specify Kafka broker.
  • Access the UI at http://localhost:9000 by default.
  • Check Kafka broker network accessibility before starting.
  • Use Kafdrop to browse topics, partitions, consumer groups, and messages easily.

Key Takeaways

Run Kafdrop with the Kafka broker address using the --kafka.brokerConnect option.
Access Kafdrop's web UI on port 9000 to monitor Kafka topics and messages visually.
Ensure the Kafka broker address is correct and reachable from where Kafdrop runs.
Kafdrop no longer needs ZooKeeper connection, only the broker address.
Use Docker or the jar file to start Kafdrop quickly without complex setup.