Skip to content

Instantly share code, notes, and snippets.

@cemo
Forked from filipefigcorreia/kafka-cheat-sheet.md
Created February 19, 2018 19:14
Show Gist options
  • Save cemo/0e2b0a77ce9474f8b9c9514812b8ae3f to your computer and use it in GitHub Desktop.
Save cemo/0e2b0a77ce9474f8b9c9514812b8ae3f to your computer and use it in GitHub Desktop.
Apache Kafka Cheat Sheet

Purging a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic MyTopic --config retention.ms=1000

... wait a minute ...

bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic MyTopic --delete-config retention.ms

Get the earliest offset of a topic

bin/kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list kafkasrv:9092 --topic mytopic --time -2

Get the latest offset of a topic

bin/kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list kafkasrv:9092 --topic mytopic --time -1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment