From a4ff2a4b45f4927231f06f67077b55cb43b3254a Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sun, 3 Apr 2022 09:26:56 +0200 Subject: [PATCH] =?utf8?q?Setup=20aus=20der=20Intro-=C3=9Cbung=20=C3=BCber?= =?utf8?q?nommen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- README.sh | 22 ++++++++++++++++++++-- docker-compose.yml | 9 --------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/README.sh b/README.sh index 8dcc24c..624f99d 100755 --- a/README.sh +++ b/README.sh @@ -6,9 +6,27 @@ then exit fi -trap 'kill $(jobs -p) 2>/dev/null' EXIT - docker-compose up -d 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 ps + +echo +echo "Hilfe-Ausgabe von kafkacat" +echo +docker-compose exec -T cli kafkacat -h +echo +echo "Nachrichten schreiben mit kafkacat" +echo +docker-compose exec -T cli kafkacat -P -b kafka:9092 -t test << EOF +Hallo Welt! +Nachricht #1 +Nachricht #2 +Nachricht #3 +EOF +echo +echo "Nachrichten lesen mit kafkacat" +echo +docker-compose exec cli kafkacat -C -b kafka:9092 -t test -o beginning -e diff --git a/docker-compose.yml b/docker-compose.yml index d38ebec..9930e9b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,21 +17,12 @@ services: KAFKA_INTER_BROKER_LISTENER_NAME: DOCKER KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: DOCKER:PLAINTEXT, LOCALHOST:PLAINTEXT KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 - KAFKA_AUTO_CREATE_TOPICS_ENABLE: "false" ports: - 9092:9082 - 9082:9082 depends_on: - zookeeper - setup: - image: juplo/toolbox - command: > - bash -c " - kafka-topics --bootstrap-server kafka:9092 --delete --if-exists --topic test - kafka-topics --bootstrap-server kafka:9092 --create --topic test --partitions 2 - " - cli: image: juplo/toolbox command: sleep infinity -- 2.20.1