From 2f8587beb75952a034aceddf44d8c8d0a689fd45 Mon Sep 17 00:00:00 2001 From: xxcxy Date: Thu, 20 Feb 2020 11:12:06 +0800 Subject: [PATCH] Improve local setup 4 --- local/full/kafka-client/create-topics.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/local/full/kafka-client/create-topics.sh b/local/full/kafka-client/create-topics.sh index a4116901..f9a08910 100755 --- a/local/full/kafka-client/create-topics.sh +++ b/local/full/kafka-client/create-topics.sh @@ -1,5 +1,6 @@ #!/bin/bash +/opt/kafka/bin/kafka-topics.sh --list --zookeeper zookeeper:2181 > exists-topics.txt while read topic; do - /opt/kafka/bin/kafka-topics.sh --create --zookeeper zookeeper:2181 --partitions 1 --replication-factor 1 --topic $topic -done < topics.txt + /opt/kafka/bin/kafka-topics.sh --create --if-not-exists --zookeeper zookeeper:2181 --partitions 1 --replication-factor 1 --topic $topic +done < <(sort topics.txt exists-topics.txt exists-topics.txt | uniq -u)