Skip to content

Instantly share code, notes, and snippets.

@claudiu-stanciu
Last active April 22, 2021 10:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save claudiu-stanciu/24b0340a42e860555fa8a6f1ee11486e to your computer and use it in GitHub Desktop.
Save claudiu-stanciu/24b0340a42e860555fa8a6f1ee11486e to your computer and use it in GitHub Desktop.
Kafka bin commands

describe offsets

./kafka-consumer-groups.sh --bootstrap-server $KAFKA_BROKERS --group $GROUP_ID --describe

set/reset offsets

use --to-latest/--to-earliest
./kafka-consumer-groups.sh --bootstrap-server $KAFKA_BROKERS --group $GROUP_ID --topic $TOPIC --reset-offsets --to-latest --dry-run

./kafka-consumer-groups.sh --bootstrap-server $KAFKA_BROKERS --group $GROUP_ID --topic $TOPIC --reset-offsets --to-latest --execute

delete offsets

./kafka-consumer-groups.sh --bootstrap-server $KAFKA_BROKERS --group $GROUP_ID --topic $TOPIC --delete-offsets 

consume data and print key

./kafka-console-consumer.sh --bootstrap-server $KAFKA_BROKERS --group $GROUP_ID --topic $TOPIC --property print.key=true --property key.separator="|" --from-beginning
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment