Kafka console consumer: How to get only the last N messages from a topic instead of everything from the beginning?

If you want to stick with the bundled binaries, you need to use the simple consumer shell:

bin/kafka-simple-consumer-shell.sh --broker-list mybroker:9092 --topic
mytopic --partition mypartition --offset myoffset

I recommend kt; it’s much faster, more lightweight and has better options.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)