3 Tools for testing your kafka connection
José Marcos
Posted on October 23, 2020
Today, I needed to test whether my kafka broker was active. I used telnet for this, but I could also have used cUrl. These are 3 tools that you can use to test your kafka connection:
Tool 1 - telnet
Telnet is a tool that we use to make remote connections based on the telnet protocol.
The command is quite simple:
telnet [host/ip] [port]
Run the following command in your terminal:
telnet kafka-01 9092
Your terminal should look like this:
$ telnet kafka-01 9092
Trying 192.168.15.20...
Connected to kafka-01.
Escape character is '^]'.
Tool 2 - cUrl
cURL is a command-line tool that we use for transferring data from or to a server using various network protocols. I have been using this tool for testing connectivity from a pod running inside a Kubernetes cluster.
The commad syntax is:
curl [options...] url
--
$ curl -v telnet://kafka-01:9092
Trying 192.168.15.20:9092...
TCP_NODELAY set
Connected to kafka-01 (192.168.15.20) port 9092 (#0
Tool 3 - kafkacat
kafkacat is a powerful tool that you can use to produce, consume, list topics, and partitions. This tool is capable of creating or destroying your entire cluster. Be careful with this tool!
Run the following command in your terminal:
kafkacat -L -b kafka-01:9092
The arguments are -L for listing mode and -b for which Kafka broker to talk to.
Your terminal should look like this:
$ kafkacat -L -b kafka-01:9092
Metadata for all topics (from broker -1: kafka-01:9092/bootstrap):
1 brokers:
broker 0 at kafka-01:9092 (controller)
1 topics:
topic "topic-one" with 1 partition:
plus: You can also use these tools for testing your Azure Event Hubs connections.
Azure Event Hubs is a distributed stream processing platform and event ingestion service managed by Microsoft. You do not need to set up, configure, and manage your own Kafka clusters.
This is a terminal output for telnet:
$ telnet eventhub-01.servicebus.windows.net 9093
Trying [ip]...
Connected to [hostname].cloudapp.net.
Escape character is '^]'.
Posted on October 23, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.