2018-10-26 19:50:16 +01:00
|
|
|
# kafkacat
|
|
|
|
|
|
|
|
> Apache Kafka producer and consumer tool.
|
2019-06-05 08:55:45 +01:00
|
|
|
> More information: <https://github.com/edenhill/kafkacat>.
|
2018-10-26 19:50:16 +01:00
|
|
|
|
|
|
|
- Consume messages starting with the newest offset:
|
|
|
|
|
|
|
|
`kafkacat -C -t {{topic}} -b {{brokers}}`
|
|
|
|
|
|
|
|
- Consume messages starting with the oldest offset and exit after the last message is received:
|
|
|
|
|
|
|
|
`kafkacat -C -t {{topic}} -b {{brokers}} -o beginning -e`
|
|
|
|
|
|
|
|
- Consume messages as a Kafka consumer group:
|
|
|
|
|
|
|
|
`kafkacat -G {{group_id}} {{topic}} -b {{brokers}}`
|
|
|
|
|
2021-01-31 17:05:18 +00:00
|
|
|
- Publish message by reading from stdin:
|
2018-10-26 19:50:16 +01:00
|
|
|
|
|
|
|
` echo {{message}} | kafkacat -P -t {{topic}} -b {{brokers}}`
|
|
|
|
|
|
|
|
- Publish messages by reading from a file:
|
|
|
|
|
|
|
|
`kafkacat -P -t {{topic}} -b {{brokers}} {{path/to/file}}`
|
|
|
|
|
|
|
|
- List metadata for all topics and brokers:
|
|
|
|
|
|
|
|
`kafkacat -L -b {{brokers}}`
|
|
|
|
|
|
|
|
- List metadata for a specific topic:
|
|
|
|
|
|
|
|
`kafkacat -L -t {{topic}} -b {{brokers}}`
|
|
|
|
|
|
|
|
- Get offset for a topic/partition for a specific point in time:
|
|
|
|
|
2019-10-09 22:37:32 +01:00
|
|
|
`kafkacat -Q -t {{topic}}:{{partition}}:{{unix_timestamp}} -b {{brokers}}`
|