/dump-all-topics.sh Secret
Created
May 19, 2021 09:39
Kafka - dump all topics
This file contains 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
#!/usr/bin/env bash | |
TOPICS=$(kubectl exec kafka-0 --namespace kafka -- ./opt/bitnami/kafka/bin/kafka-topics.sh --list --zookeeper kafka-zookeeper:2181 --exclude-internal) | |
while IFS= read -r topic; do | |
kubectl exec kafka-0 --namespace kafka -- ./opt/bitnami/kafka/bin/kafka-console-consumer.sh --bootstrap-server kafka:9092 --topic $topic --from-beginning --timeout-ms 5000 > /tmp/$topic | |
done <<< "$TOPICS" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment