Last active
October 30, 2023 04:32
-
-
Save hartfordfive/5928e7bca7c6239e4e1036346d326953 to your computer and use it in GitHub Desktop.
Script to delete all kafka topics on a given cluster
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
#!/bin/bash | |
TOPICS=$(kafka-topics --zookeeper [ZK_IP]:2181/kafka --list ) | |
for T in $TOPICS | |
do | |
if [ "$T" != "__consumer_offsets" ]; then | |
kafka-topics --zookeeper [ZK_IP]:2181/kafka --delete --topic $T | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment