From d2a077fb30ca2069554b18f153500bd41907c0a8 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sun, 29 Jan 2023 15:25:55 +0100 Subject: [PATCH] =?utf8?q?README.sh=20f=C3=BCr=20die=20=C3=9Cbung=20`rest-?= =?utf8?q?producer--headers`=20umgestellt?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- README.sh | 93 +++++-------------------------------------------------- 1 file changed, 7 insertions(+), 86 deletions(-) diff --git a/README.sh b/README.sh index f227f47..16e19a6 100755 --- a/README.sh +++ b/README.sh @@ -33,91 +33,12 @@ docker-compose -f docker/docker-compose.yml logs setup docker-compose -f docker/docker-compose.yml up -d producer while ! [[ $(http 0:8080/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for producer..."; sleep 1; done -# tag::hashed[] -echo -n Nachricht 1 an klaus über producer | http -v :8080/klaus -# end::hashed[] -echo -n Nachricht 2 an klaus über producer | http -v :8080/klaus -# tag::hashed[] -echo -n Nachricht 1 an peter über producer | http -v :8080/peter -# end::hashed[] -echo -n Nachricht 3 an klaus über producer | http -v :8080/klaus -echo -n Nachricht 2 an peter über producer | http -v :8080/peter -echo -n Nachricht 3 an peter über producer | http -v :8080/peter - -echo Nachrichten in Partition 0: -kafkacat -b :9092 -t test -o 0 -p0 -f'key: %k\toffset: %o\tvalue: %s\n' -qe -echo -echo Nachrichten in Partition 1: -kafkacat -b :9092 -t test -o 0 -p1 -f'key: %k\toffset: %o\tvalue: %s\n' -qe -echo - -docker-compose -f docker/docker-compose.yml exec -T cli bash << 'EOF' -echo "Altering number of partitions from 2 to 3..." -kafka-topics --bootstrap-server kafka:9092 --describe --topic test -# tag::repartitioning[] -kafka-topics --bootstrap-server kafka:9092 --alter --topic test --partitions 3 -# end::repartitioning[] -kafka-topics --bootstrap-server kafka:9092 --describe --topic test -EOF - -docker-compose -f docker/docker-compose.yml restart producer -while ! [[ $(http 0:8080/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for producer..."; sleep 1; done - -echo -n Nachricht 4 an klaus über producer | http -v :8080/klaus -echo -n Nachricht 5 an peter über producer | http -v :8080/peter -echo -n Nachricht 4 an peter über producer | http -v :8080/peter -echo -n Nachricht 5 an klaus über producer | http -v :8080/klaus -echo -n Nachricht 6 an klaus über producer | http -v :8080/klaus -echo -n Nachricht 6 an peter über producer | http -v :8080/peter - -echo Nachrichten in Partition 0: -# tag::kafkacat[] -kafkacat -b :9092 -t test -o 0 -p0 -f'key: %k\toffset: %o\tvalue: %s\n' -qe -# end::kafkacat[] -echo -echo Nachrichten in Partition 1: +# tag::http[] +echo -n bar | http -v :8080/foo +echo -n foo | http -v :8080/bar X-id:6 +echo -n foo | http -v :8000/bar X-id:66 +echo -n foo | http -v :8001/bar X-id:666 +# end::http[] # tag::kafkacat[] -kafkacat -b :9092 -t test -o 0 -p1 -f'key: %k\toffset: %o\tvalue: %s\n' -qe +kafkacat -b :9092 -t test -f "%p|%o|%k=%s|%h\n" -e # end::kafkacat[] -echo -echo Nachrichten in Partition 2: -kafkacat -b :9092 -t test -o 0 -p2 -f'key: %k\toffset: %o\tvalue: %s\n' -qe - - -docker-compose -f docker/docker-compose.yml restart setup -sleep 1 -docker-compose -f docker/docker-compose.yml up -d producer-0 producer-1 -while ! [[ $(http 0:8000/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for producer-0..."; sleep 1; done -while ! [[ $(http 0:8001/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for producer-1..."; sleep 1; done - -# tag::fixed[] -echo -n Nachricht 1 über producer-0 | http -v :8000/klaus -echo -n Nachricht 1 über producer-1 | http -v :8001/klaus -echo -n Nachricht 2 über producer-0 | http -v :8000/peter -echo -n Nachricht 2 über producer-1 | http -v :8001/peter -# end::fixed[] - -docker-compose -f docker/docker-compose.yml exec -T cli bash << 'EOF' -echo "Altering number of partitions from 2 to 3..." -kafka-topics --bootstrap-server kafka:9092 --describe --topic test -kafka-topics --bootstrap-server kafka:9092 --alter --topic test --partitions 3 -kafka-topics --bootstrap-server kafka:9092 --describe --topic test -EOF - -docker-compose -f docker/docker-compose.yml restart producer-0 producer-1 -while ! [[ $(http 0:8000/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for producer-0..."; sleep 1; done -while ! [[ $(http 0:8001/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for producer-1..."; sleep 1; done - -echo -n Nachricht 3 über producer-0 | http -v :8000/klaus -echo -n Nachricht 3 über producer-1 | http -v :8001/klaus -echo -n Nachricht 4 über producer-0 | http -v :8000/peter -echo -n Nachricht 4 über producer-1 | http -v :8001/peter - -echo Nachrichten in Partition 0: -kafkacat -b :9092 -t test -o 0 -p0 -f'key: %k\toffset: %o\tvalue: %s\n' -qe -echo -echo Nachrichten in Partition 1: -kafkacat -b :9092 -t test -o 0 -p1 -f'key: %k\toffset: %o\tvalue: %s\n' -qe -echo -echo Nachrichten in Partition 2: -kafkacat -b :9092 -t test -o 0 -p2 -f'key: %k\toffset: %o\tvalue: %s\n' -qe -- 2.20.1