Created
October 30, 2019 05:56
-
-
Save alces/8c936c9c3cb3f8ca14f0c187107962bc to your computer and use it in GitHub Desktop.
Delete Kafka topics with matching names
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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