Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Delete Kafka topics with matching names
TOPIC_NAME_REGEX='(CI|TST|IT)[0-9]'
ZOOKEEPER_ADDR=127.0.0.1:2181
for topic in $(kafka-topics --zookeeper $ZOOKEEPER_ADDR --list | egrep $TOPIC_NAME_REGEX)
do
kafka-topics --zookeeper $ZOOKEEPER_ADDR --delete --topic $topic
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment