X-Git-Url: https://juplo.de/gitweb/?a=blobdiff_plain;f=README.sh;h=d0a59bdaa5f9801b5d5a777069ff49ed359f1ef1;hb=ece4cdf8b47768f518c21aea12bcd0dadc7c91e1;hp=8b568c9537e2f6086e44052c1d18447bdb928339;hpb=50da4f6f74a8f4f567b7af8556480f81256c61dc;p=demos%2Fkafka%2Ftraining diff --git a/README.sh b/README.sh index 8b568c9..d0a59bd 100755 --- a/README.sh +++ b/README.sh @@ -9,7 +9,7 @@ then exit fi -docker-compose up -d zookeeper kafka cli +docker-compose up -d zookeeper kafka-1 kafka-2 kafka-3 cli if [[ $(docker image ls -q $IMAGE) == "" || @@ -25,75 +25,42 @@ fi echo "Waiting for the Kafka-Cluster to become ready..." docker-compose exec cli cub kafka-ready -b kafka:9092 1 60 > /dev/null 2>&1 || exit 1 docker-compose up setup +docker-compose up -d producer-0 producer-1 +while ! [[ $(http -b :8000/actuator/health | jq -r .status) =~ "UP" ]]; do echo Waiting for producer-0; sleep 1; done +while ! [[ $(http -b :8001/actuator/health | jq -r .status) =~ "UP" ]]; do echo Waiting for producer-1; sleep 1; done +docker-compose up -d consumer -docker-compose up -d - -sleep 15 -http :8081/status -http :8082/status -http :8083/status -http :8084/status -http :8085/status -http :8000/seen +echo foo | http -v :8000/foo +echo foo | http -v :8001/foo +echo foo | http -v :8001/foo +echo foo | http -v :8000/bar +echo foobar | http -v :8000/bar +echo foofoo | http -v :8000/bar +echo barbar | http -v :8000/bar +echo barfoo | http -v :8000/bar +echo bar | http -v :8000/bar -http post :8081/stop -http :8081/status -http :8082/status -http :8083/status -http :8084/status -http :8085/status -http :8000/seen +docker-compose logs consumer -http post :8081/start - -sleep 1 -http :8081/status -http :8082/status -http :8083/status -http :8084/status -http :8085/status -http :8000/seen -sleep 1 -http :8081/status -http :8082/status -http :8083/status -http :8084/status -http :8085/status -http :8000/seen -sleep 1 -http :8081/status -http :8082/status -http :8083/status -http :8084/status -http :8085/status -http :8000/seen -sleep 1 -http :8081/status -http :8082/status -http :8083/status -http :8084/status -http :8085/status -http :8000/seen -sleep 1 -http :8081/status -http :8082/status -http :8083/status -http :8084/status -http :8085/status -http :8000/seen +docker-compose up -d +docker-compose exec cli kafkacat -C -b kafka:9092 -t test -o 0 -f'p=%p|o=%o|k=%k|v=%s\n' -q -c20 -http post :8081/stop -http :8081/status -http post :8082/stop -http :8082/status -http post :8083/stop -http :8083/status -http post :8084/stop -http :8084/status -http post :8085/stop -http :8085/status +docker-compose exec -T cli bash << 'EOF' +echo "Altering number of partitions from 3 to 7..." +kafka-topics --bootstrap-server kafka:9092 --describe --topic test +kafka-topics --bootstrap-server kafka:9092 --describe --topic test +kafka-topics --bootstrap-server kafka:9092 --alter --topic test --partitions 7 +kafka-topics --bootstrap-server kafka:9092 --describe --topic test +EOF -http :8000/seen -http post :8000/stop +docker-compose restart producer-0 producer-1 +while ! [[ $(http -b :8000/actuator/health | jq -r .status) =~ "UP" ]]; do echo Waiting for :8000/actuator/health; sleep 1; done +while ! [[ $(http -b :8001/actuator/health | jq -r .status) =~ "UP" ]]; do echo Waiting for :8001/actuator/health; sleep 1; done +docker-compose exec cli kafkacat -C -b kafka:9092 -t test -o 0 -f'p=%p|o=%o|k=%k|v=%s\n' -q -c20 -docker-compose logs producer +echo "Messages from peter" +docker-compose logs consumer | grep k=peter +echo "Messages from beate" +docker-compose logs consumer | grep k=beate +echo "Messages from foo" +docker-compose logs consumer | grep k=foo