LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

kcat

generic non-JVM producer and consumer for Apache Kafka

TLDR

Consume messages from topic
$ kcat -b [localhost:9092] -t [topic] -C
copy
Produce message to topic
$ echo "[message]" | kcat -b [localhost:9092] -t [topic] -P
copy
List metadata
$ kcat -b [localhost:9092] -L
copy
Consume with custom format
$ kcat -b [localhost:9092] -t [topic] -C -f '%k: %s\n'
copy
Consume from beginning
$ kcat -b [localhost:9092] -t [topic] -C -o beginning
copy
Query watermarks
$ kcat -b [localhost:9092] -t [topic] -Q
copy

SYNOPSIS

kcat [options] mode

DESCRIPTION

kcat (formerly kafkacat) is a generic non-JVM producer and consumer for Apache Kafka. Written in C using librdkafka, it provides a lightweight CLI for interacting with Kafka clusters. Supports producing, consuming, and listing metadata.

PARAMETERS

-b brokers

Kafka broker list.
-t topic
Topic to produce/consume.
-C
Consumer mode.
-P
Producer mode.
-L
Metadata list mode.
-Q
Query mode for offsets.
-f format
Output format string.
-o offset
Starting offset.
-G group
Consumer group.

HISTORY

Originally named kafkacat, the tool was renamed to kcat. Both names may still be in use depending on the installation.

SEE ALSO

Copied to clipboard
Kai