From b24180e89bb0b150dc71400eec952a2f8c6ca87c Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Fri, 6 Oct 2023 15:59:59 +0200 Subject: [PATCH] Setup mit Zookeeper anstat KRaft --- docker/docker-compose.yml | 57 +++++++++++++-------------------------- 1 file changed, 19 insertions(+), 38 deletions(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 39167d8..78cd643 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -1,33 +1,22 @@ version: '3.2' services: - kafka-0: - image: bitnami/kafka:3.5.1 + zookeeper: + image: bitnami/zookeeper:3.9 environment: - KAFKA_ENABLE_KRAFT: 'yes' - KAFKA_KRAFT_CLUSTER_ID: r7dMBY60T16TrNCGeXniLw - KAFKA_CFG_PROCESS_ROLES: controller - KAFKA_CFG_CONTROLLER_LISTENER_NAMES: CONTROLLER - KAFKA_CFG_LISTENERS: CONTROLLER://:9092 - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT - KAFKA_CFG_NODE_ID: 0 - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS: 0@kafka-0:9092 - KAFKA_CFG_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 - KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE: "false" + - ALLOW_ANONYMOUS_LOGIN=yes + ports: + - 2181:2181 volumes: - - kafka-0:/bitnami/kafka + - zookeeper:/bitnami kafka-1: image: bitnami/kafka:3.5.1 environment: - KAFKA_ENABLE_KRAFT: 'yes' - KAFKA_KRAFT_CLUSTER_ID: r7dMBY60T16TrNCGeXniLw - KAFKA_CFG_PROCESS_ROLES: broker - KAFKA_CFG_CONTROLLER_LISTENER_NAMES: CONTROLLER + KAFKA_CFG_ZOOKEEPER_CONNECT: zookeeper:2181 KAFKA_CFG_LISTENERS: BROKER://:9092, LOCALHOST://:9081 - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP: BROKER:PLAINTEXT, CONTROLLER:PLAINTEXT, LOCALHOST:PLAINTEXT + KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP: BROKER:PLAINTEXT, LOCALHOST:PLAINTEXT KAFKA_CFG_ADVERTISED_LISTENERS: BROKER://kafka-1:9092, LOCALHOST://localhost:9081 - KAFKA_CFG_NODE_ID: 1 - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS: 0@kafka-0:9092 + KAFKA_CFG_BROKER_ID: 1 KAFKA_CFG_INTER_BROKER_LISTENER_NAME: BROKER KAFKA_CFG_OFFSETS_TOPIC_REPLICATION_FACTOR: 3 KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE: "false" @@ -36,20 +25,16 @@ services: ports: - 9081:9081 depends_on: - - kafka-0 + - zookeeper kafka-2: image: bitnami/kafka:3.5.1 environment: - KAFKA_ENABLE_KRAFT: 'yes' - KAFKA_KRAFT_CLUSTER_ID: r7dMBY60T16TrNCGeXniLw - KAFKA_CFG_PROCESS_ROLES: broker - KAFKA_CFG_CONTROLLER_LISTENER_NAMES: CONTROLLER + KAFKA_CFG_ZOOKEEPER_CONNECT: zookeeper:2181 KAFKA_CFG_LISTENERS: BROKER://:9092, LOCALHOST://:9082 - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP: BROKER:PLAINTEXT, CONTROLLER:PLAINTEXT, LOCALHOST:PLAINTEXT + KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP: BROKER:PLAINTEXT, LOCALHOST:PLAINTEXT KAFKA_CFG_ADVERTISED_LISTENERS: BROKER://kafka-2:9092, LOCALHOST://localhost:9082 - KAFKA_CFG_NODE_ID: 2 - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS: 0@kafka-0:9092 + KAFKA_CFG_BROKER_ID: 2 KAFKA_CFG_INTER_BROKER_LISTENER_NAME: BROKER KAFKA_CFG_OFFSETS_TOPIC_REPLICATION_FACTOR: 3 KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE: "false" @@ -63,20 +48,16 @@ services: aliases: - kafka depends_on: - - kafka-0 + - zookeeper kafka-3: image: bitnami/kafka:3.5.1 environment: - KAFKA_ENABLE_KRAFT: 'yes' - KAFKA_KRAFT_CLUSTER_ID: r7dMBY60T16TrNCGeXniLw - KAFKA_CFG_PROCESS_ROLES: broker - KAFKA_CFG_CONTROLLER_LISTENER_NAMES: CONTROLLER + KAFKA_CFG_ZOOKEEPER_CONNECT: zookeeper:2181 KAFKA_CFG_LISTENERS: BROKER://:9092, LOCALHOST://:9083 - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP: BROKER:PLAINTEXT, CONTROLLER:PLAINTEXT, LOCALHOST:PLAINTEXT + KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP: BROKER:PLAINTEXT, LOCALHOST:PLAINTEXT KAFKA_CFG_ADVERTISED_LISTENERS: BROKER://kafka-3:9092, LOCALHOST://localhost:9083 - KAFKA_CFG_NODE_ID: 3 - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS: 0@kafka-0:9092 + KAFKA_CFG_BROKER_ID: 3 KAFKA_CFG_INTER_BROKER_LISTENER_NAME: BROKER KAFKA_CFG_OFFSETS_TOPIC_REPLICATION_FACTOR: 3 KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE: "false" @@ -85,7 +66,7 @@ services: ports: - 9083:9083 depends_on: - - kafka-0 + - zookeeper setup: @@ -141,7 +122,7 @@ services: - setup volumes: - kafka-0: + zookeeper: kafka-1: kafka-2: kafka-3: -- 2.20.1