Skip to content

Instantly share code, notes, and snippets.

@markuskont
Last active August 24, 2017 09:20
Show Gist options
  • Save markuskont/1281eb7f832a5a08c79a45f11270dcf2 to your computer and use it in GitHub Desktop.
Save markuskont/1281eb7f832a5a08c79a45f11270dcf2 to your computer and use it in GitHub Desktop.
# clear all messages in kafka topics by temorarily changing retention time in (in ms)
# doing this with kafka-topics.sh may be deprecated in future
MS=1000
IP=127.0.0.1
for topic in `./kafka-topics.sh --list --zookeeper $IP:2181` ; do ./kafka-topics.sh --zookeeper $IP:2181 --alter --topic $topic --config retention.ms=$MS ; done
MS=259200000
...
# show consumer groups
./kafka-consumer-groups.sh --zookeeper $IP:2181 --list
# show actual offsets in kafka
./kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list $IP:9092 --topic $TOPIC --time -1 --offsets 1
# show offsets in zookeeper for particular consumer group
./zookeeper-shell.sh $IP:2181
# /consumers/$GROUP/offsets/$TOPIC/$PARTITION
> get /consumers/kafka-node-group/offsets/asd/0
# change offset to something more appropriate
> set /consumers/kafka-node-group/offsets/asd/0 12345
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment