X-Git-Url: https://juplo.de/gitweb/?p=demos%2Fkafka%2Fdeduplication;a=blobdiff_plain;f=README.sh;h=b71031cc4c7f121954164374f2401200b6238a48;hp=00383c44ed72413f3d89d733cc1d6876edc2001d;hb=150907d53cc99a98f4c888eacff892380ffd0feb;hpb=29eac6d5ee3ab76af19edef6d8863c6894313169 diff --git a/README.sh b/README.sh index 00383c4..b71031c 100755 --- a/README.sh +++ b/README.sh @@ -4,13 +4,14 @@ if [ "$1" = "cleanup" ] then docker-compose down mvn clean + rm *.txt exit fi -if [[ $(docker image ls -q juplo/deduplicator:streams) == "" ]] +if [[ $(docker image ls -q juplo/deduplicator:streams) == "" || "$1" = "build" ]] then - mvn package - docker build -t juplo/deduplicator:streams . + mvn package || exit + docker build -t juplo/deduplicator:streams . || exit else echo "Using image existing image:" docker image ls juplo/deduplicator:streams @@ -18,6 +19,11 @@ fi docker-compose up -d zookeeper kafka +if [ ! -e data.txt ]; +then + echo ./create-data.sh +fi + while ! [[ $(zookeeper-shell zookeeper:2181 ls /brokers/ids 2> /dev/null) =~ 1001 ]]; do echo "Waiting for kafka..."; @@ -40,10 +46,10 @@ cat data.txt | kafkacat -K: -b localhost:9092 -t input kafkacat -C -b localhost:9092 -t input -e | wc -l kafkacat -C -b localhost:9092 -t output -e | wc -l -kafkacat -C -b localhost:9092 -t output -e -f'%k:%s\n' | grep ^0 > result_0.txt -kafkacat -C -b localhost:9092 -t output -e -f'%k:%s\n' | grep ^1 > result_1.txt -kafkacat -C -b localhost:9092 -t output -e -f'%k:%s\n' | grep ^2 > result_2.txt -kafkacat -C -b localhost:9092 -t output -e -f'%k:%s\n' | grep ^3 > result_3.txt -kafkacat -C -b localhost:9092 -t output -e -f'%k:%s\n' | grep ^4 > result_4.txt -kafkacat -C -b localhost:9092 -t output -e -f'%k:%s\n' | grep ^5 > result_5.txt -kafkacat -C -b localhost:9092 -t output -e -f'%k:%s\n' | grep ^6 > result_6.txt +kafkacat -C -b localhost:9092 -t output -e -f'%k:%s\n' | awk -F: '/^peter/ { print $2 }' > result_peter.txt +kafkacat -C -b localhost:9092 -t output -e -f'%k:%s\n' | awk -F: '/^franz/ { print $2 }' > result_franz.txt +kafkacat -C -b localhost:9092 -t output -e -f'%k:%s\n' | awk -F: '/^ute/ { print $2 }' > result_ute.txt +kafkacat -C -b localhost:9092 -t output -e -f'%k:%s\n' | awk -F: '/^klaus/ { print $2 }' > result_klaus.txt +kafkacat -C -b localhost:9092 -t output -e -f'%k:%s\n' | awk -F: '/^paul/ { print $2 }' > result_paul.txt +kafkacat -C -b localhost:9092 -t output -e -f'%k:%s\n' | awk -F: '/^petra/ { print $2 }' > result_petra.txt +kafkacat -C -b localhost:9092 -t output -e -f'%k:%s\n' | awk -F: '/^siggi/ { print $2 }' > result_siggi.txt