I'm super new to Kafka. I've installed kafka and zookeeper using homebrew on my mac, and I'm playing around with the quickstart guide.
I've been able to push messages onto Kafka using the following command and STDIN
kafka-console-producer --broker-list localhost:9092 --topic test
and I can read things off using
kafka-console-consumer --bootstrap-server localhost:9092 --topic test --from-beginning
What's not clear to me is how I use offsets. It's my understanding that each message added to a topic will have a numerical, incremental offset value. However, if I try to do something like this
kafka-console-consumer --bootstrap-server localhost:9092 --topic test --offset 1
I get a non-zero status code and shows me no messages (other than the usual help/usage information)
I also can't get the latest or earliest keywords to work
kafka-console-consumer --bootstrap-server localhost:9092 --topic test --offset earliest
kafka-console-consumer --bootstrap-server localhost:9092 --topic test --offset latest
Both of the above also return non-zero status codes.
Do I fundamentally misunderstand offsets? If not, is there a way to list all messages with their offsets? Finally -- what's the simpliest example of the --offset
flag for the kafka-console-consumer
?