kcat
is a popular CLI tool that you can use to test and debug your StreamNative Cloud clusters using the Kafka protocol. You can use kcat to produce, consume, and list topic and partition information for Kafka topics. Described as “netcat for Kafka”, it is a swiss-army knife of tools for inspecting and creating data in Kafka.
It is similar to Kafka Console Producer (kafka-console-producer.sh
) and Kafka Console Consumer (kafka-console-consumer.sh
), but it offers more features and is easier to use.
-X key=value
, or in a configuration file specified by -F <config-file>
.
cloud.properties
and save it in a secure location. You will populate this file with credentials to access your StreamNative Cloud account so you must keep in a safe place. Add the following content to the file:-X
option rather than in the configuration file.bootstrap.servers
property in the cloud.properties
file.
cloud.properties
file.
kcat
to produce and consume messages. You will also need the bootstrap server of the cluster when you run the tool.
The following examples demonstrate how to use kcat
to produce and consume messages.
test_kcat
. Before running this command:
<bootstrap-server>
with your cluster’s actual bootstrap server addresscloud.properties
file location<api-key>
with your actual API key-K:
flag indicates that messages should be formatted as key:value
. Enter messages in this format at the prompt:
Ctrl-D
to send the messages to the topic.
test_kcat
using the following command. Before running this command:
<bootstrap-server>
with your cluster’s actual bootstrap server addresscloud.properties
file location<api-key>
with your actual API key