We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 52f9cb2 commit 2f8587bCopy full SHA for 2f8587b
local/full/kafka-client/create-topics.sh
@@ -1,5 +1,6 @@
1
#!/bin/bash
2
3
+/opt/kafka/bin/kafka-topics.sh --list --zookeeper zookeeper:2181 > exists-topics.txt
4
while read topic; do
- /opt/kafka/bin/kafka-topics.sh --create --zookeeper zookeeper:2181 --partitions 1 --replication-factor 1 --topic $topic
5
-done < topics.txt
+ /opt/kafka/bin/kafka-topics.sh --create --if-not-exists --zookeeper zookeeper:2181 --partitions 1 --replication-factor 1 --topic $topic
6
+done < <(sort topics.txt exists-topics.txt exists-topics.txt | uniq -u)
0 commit comments