From 46209b3feb3e0155ceda1af71bf559a81e24e527 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Mon, 16 Oct 2023 21:05:08 +0200 Subject: [PATCH] =?utf8?q?Setup=20zur=C3=BCck=20auf=20Confluent=20(Version?= =?utf8?q?=207.5.1)=20mit=20Zookeeper=20umestellt?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- README.sh | 2 +- docker/docker-compose.yml | 79 +++++++++++++++++++-------------------- 2 files changed, 40 insertions(+), 41 deletions(-) diff --git a/README.sh b/README.sh index 4c99f7a..d6bfa02 100755 --- a/README.sh +++ b/README.sh @@ -6,7 +6,7 @@ then exit fi -docker-compose -f docker/docker-compose.yml up -d --remove-orphans kafka-1 kafka-2 kafka-3 +docker-compose -f docker/docker-compose.yml up -d --remove-orphans zookeeper kafka-1 kafka-2 kafka-3 docker-compose -f docker/docker-compose.yml ps echo "Waiting for the Kafka-Cluster to become ready..." docker-compose -f docker/docker-compose.yml run --rm cli cub kafka-ready -b kafka:9092 3 60 > /dev/null 2>&1 || exit 1 diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 3a99d56..ead6274 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -1,39 +1,39 @@ version: '3.2' services: + zookeeper: + image: confluentinc/cp-zookeeper:7.5.1 + environment: + ZOOKEEPER_CLIENT_PORT: 2181 + ports: + - 2181:2181 kafka-1: - image: bitnami/kafka:3.4 + image: confluentinc/cp-kafka:7.5.1 environment: - KAFKA_ENABLE_KRAFT: 'yes' - KAFKA_KRAFT_CLUSTER_ID: r7dMBY60T16TrNCGeXniLw - KAFKA_CFG_CONTROLLER_LISTENER_NAMES: CONTROLLER - KAFKA_CFG_LISTENERS: CONTROLLER://:9093, BROKER://:9092, LOCALHOST://:9081 - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP: BROKER:PLAINTEXT, CONTROLLER:PLAINTEXT, LOCALHOST:PLAINTEXT - KAFKA_CFG_ADVERTISED_LISTENERS: BROKER://kafka-1:9092, LOCALHOST://localhost:9081 - KAFKA_CFG_NODE_ID: 1 - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS: 1@kafka-1:9093, 2@kafka-2:9093, 3@kafka-3:9093 - ALLOW_PLAINTEXT_LISTENER: 'yes' - KAFKA_CFG_INTER_BROKER_LISTENER_NAME: BROKER - KAFKA_CFG_OFFSETS_TOPIC_REPLICATION_FACTOR: 3 - KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE: "false" + KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 + KAFKA_LISTENERS: BROKER://:9092, LOCALHOST://:9081 + KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: BROKER:PLAINTEXT, LOCALHOST:PLAINTEXT + KAFKA_ADVERTISED_LISTENERS: BROKER://kafka-1:9092, LOCALHOST://localhost:9081 + KAFKA_BROKER_ID: 1 + KAFKA_INTER_BROKER_LISTENER_NAME: BROKER + KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 3 + KAFKA_AUTO_CREATE_TOPICS_ENABLE: "false" ports: - 9081:9081 + depends_on: + - zookeeper kafka-2: - image: bitnami/kafka:3.4 + image: confluentinc/cp-kafka:7.5.1 environment: - KAFKA_ENABLE_KRAFT: 'yes' - KAFKA_KRAFT_CLUSTER_ID: r7dMBY60T16TrNCGeXniLw - KAFKA_CFG_CONTROLLER_LISTENER_NAMES: CONTROLLER - KAFKA_CFG_LISTENERS: CONTROLLER://:9093, BROKER://:9092, LOCALHOST://:9082 - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP: BROKER:PLAINTEXT, CONTROLLER:PLAINTEXT, LOCALHOST:PLAINTEXT - KAFKA_CFG_ADVERTISED_LISTENERS: BROKER://kafka-2:9092, LOCALHOST://localhost:9082 - KAFKA_CFG_NODE_ID: 2 - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS: 1@kafka-1:9093, 2@kafka-2:9093, 3@kafka-3:9093 - ALLOW_PLAINTEXT_LISTENER: 'yes' - KAFKA_CFG_INTER_BROKER_LISTENER_NAME: BROKER - KAFKA_CFG_OFFSETS_TOPIC_REPLICATION_FACTOR: 3 - KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE: "false" + KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 + KAFKA_LISTENERS: BROKER://:9092, LOCALHOST://:9082 + KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: BROKER:PLAINTEXT, LOCALHOST:PLAINTEXT + KAFKA_ADVERTISED_LISTENERS: BROKER://kafka-2:9092, LOCALHOST://localhost:9082 + KAFKA_BROKER_ID: 2 + KAFKA_INTER_BROKER_LISTENER_NAME: BROKER + KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 3 + KAFKA_AUTO_CREATE_TOPICS_ENABLE: "false" ports: - 9092:9082 - 9082:9082 @@ -41,25 +41,24 @@ services: default: aliases: - kafka + depends_on: + - zookeeper kafka-3: - image: bitnami/kafka:3.4 + image: confluentinc/cp-kafka:7.5.1 environment: - KAFKA_ENABLE_KRAFT: 'yes' - KAFKA_KRAFT_CLUSTER_ID: r7dMBY60T16TrNCGeXniLw - KAFKA_CFG_CONTROLLER_LISTENER_NAMES: CONTROLLER - KAFKA_CFG_LISTENERS: CONTROLLER://:9093, BROKER://:9092, LOCALHOST://:9083 - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP: BROKER:PLAINTEXT, CONTROLLER:PLAINTEXT, LOCALHOST:PLAINTEXT - KAFKA_CFG_ADVERTISED_LISTENERS: BROKER://kafka-3:9092, LOCALHOST://localhost:9083 - KAFKA_CFG_NODE_ID: 3 - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS: 1@kafka-1:9093, 2@kafka-2:9093, 3@kafka-3:9093 - ALLOW_PLAINTEXT_LISTENER: 'yes' - KAFKA_CFG_INTER_BROKER_LISTENER_NAME: BROKER - KAFKA_CFG_OFFSETS_TOPIC_REPLICATION_FACTOR: 3 - KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE: "false" + KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 + KAFKA_LISTENERS: BROKER://:9092, LOCALHOST://:9083 + KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: BROKER:PLAINTEXT, LOCALHOST:PLAINTEXT + KAFKA_ADVERTISED_LISTENERS: BROKER://kafka-3:9092, LOCALHOST://localhost:9083 + KAFKA_BROKER_ID: 3 + KAFKA_INTER_BROKER_LISTENER_NAME: BROKER + KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 3 + KAFKA_AUTO_CREATE_TOPICS_ENABLE: "false" ports: - 9083:9083 - + depends_on: + - zookeeper setup: image: juplo/toolbox -- 2.20.1