Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Script to delete all kafka topics on a given cluster
#!/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
You can’t perform that action at this time.