til
til copied to clipboard
Delete all messages from the topic
kf-config() { ./bin/kafka-configs.sh --bootstrap-server localhost:9092 --entity-type topics $@; }
topics=($(./bin/kafka-topics.sh --list --zookeeper localhost:2181 | grep 'prefix.' | xargs))
for topic in "${topics[@]}"; do echo "Topic: ${topic} ..." && kf-config --describe --entity-name "${topic}"; done
for topic in "${topics[@]}"; do echo "Topic: ${topic} ..." && kf-config --alter --add-config retention.ms=1000 --entity-name "${topic}"; done
for topic in "${topics[@]}"; do echo "Topic: ${topic} ..." && kf-config --describe --entity-name "${topic}"; done
for topic in "${topics[@]}"; do echo "Topic: ${topic} ..." && kf-config --alter --delete-config retention.ms --entity-name "${topic}"; done