| 1 |
# kafka-console-consumer |
| 2 |
|
| 3 |
A simple command line tool to consume partitions of a topic and print the |
| 4 |
messages on the standard output. |
| 5 |
|
| 6 |
### Installation |
| 7 |
|
| 8 |
go get github.com/Shopify/sarama/tools/kafka-console-consumer |
| 9 |
|
| 10 |
### Usage |
| 11 |
|
| 12 |
# Minimum invocation |
| 13 |
kafka-console-consumer -topic=test -brokers=kafka1:9092 |
| 14 |
|
| 15 |
# It will pick up a KAFKA_PEERS environment variable |
| 16 |
export KAFKA_PEERS=kafka1:9092,kafka2:9092,kafka3:9092 |
| 17 |
kafka-console-consumer -topic=test |
| 18 |
|
| 19 |
# You can specify the offset you want to start at. It can be either |
| 20 |
# `oldest`, `newest`. The default is `newest`. |
| 21 |
kafka-console-consumer -topic=test -offset=oldest |
| 22 |
kafka-console-consumer -topic=test -offset=newest |
| 23 |
|
| 24 |
# You can specify the partition(s) you want to consume as a comma-separated |
| 25 |
# list. The default is `all`. |
| 26 |
kafka-console-consumer -topic=test -partitions=1,2,3 |
| 27 |
|
| 28 |
# Display all command line options |
| 29 |
kafka-console-consumer -help |