3 Zookeeper, die sich nicht kennen, ergibt 3 Cluster
authorKai Moritz <kai@juplo.de>
Thu, 13 Jun 2024 10:08:42 +0000 (12:08 +0200)
committerKai Moritz <kai@juplo.de>
Wed, 25 Sep 2024 10:20:59 +0000 (12:20 +0200)
docker/docker-compose.yml

index 86b65c3..a4dcaad 100644 (file)
@@ -1,19 +1,39 @@
 version: '3.2'
 services:
-  zookeeper:
+  zookeeper-1:
     image: confluentinc/cp-zookeeper:7.5.1
     environment:
       ZOOKEEPER_CLIENT_PORT: 2181
     ports:
       - 2181:2181
     volumes:
-      - zookeeper-data:/var/lib/zookeeper/data
-      - zookeeper-log:/var/lib/zookeeper/log
+      - zookeeper-1-data:/var/lib/zookeeper/data
+      - zookeeper-1-log:/var/lib/zookeeper/log
+
+  zookeeper-2:
+    image: confluentinc/cp-zookeeper:7.5.1
+    environment:
+      ZOOKEEPER_CLIENT_PORT: 2181
+    ports:
+      - 2182:2181
+    volumes:
+      - zookeeper-2-data:/var/lib/zookeeper/data
+      - zookeeper-2-log:/var/lib/zookeeper/log
+
+  zookeeper-3:
+    image: confluentinc/cp-zookeeper:7.5.1
+    environment:
+      ZOOKEEPER_CLIENT_PORT: 2181
+    ports:
+      - 2183:2181
+    volumes:
+      - zookeeper-3-data:/var/lib/zookeeper/data
+      - zookeeper-3-log:/var/lib/zookeeper/log
 
   kafka-1:
     image: confluentinc/cp-kafka:7.5.1
     environment:
-      KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
+      KAFKA_ZOOKEEPER_CONNECT: zookeeper-1: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
@@ -27,12 +47,12 @@ services:
       - 9081:9081
     stop_grace_period: 120s
     depends_on:
-      - zookeeper
+      - zookeeper-1
 
   kafka-2:
     image: confluentinc/cp-kafka:7.5.1
     environment:
-      KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
+      KAFKA_ZOOKEEPER_CONNECT: zookeeper-2: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
@@ -51,12 +71,12 @@ services:
           - kafka
     stop_grace_period: 120s
     depends_on:
-      - zookeeper
+      - zookeeper-2
 
   kafka-3:
     image: confluentinc/cp-kafka:7.5.1
     environment:
-      KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
+      KAFKA_ZOOKEEPER_CONNECT: zookeeper-3: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
@@ -70,7 +90,7 @@ services:
       - 9083:9083
     stop_grace_period: 120s
     depends_on:
-      - zookeeper
+      - zookeeper-3
 
   schema-registry:
     image: confluentinc/cp-schema-registry:7.5.1
@@ -161,10 +181,12 @@ services:
     environment:
       HTTP_PORT: 80
       CONNECTION_JUPLO_NAME: juplo
-      CONNECTION_JUPLO_CONN: zookeeper:2181
+      CONNECTION_JUPLO_CONN: zookeeper-1:2181
       AUTO_CONNECT_CONNECTION_ID: JUPLO
     depends_on:
-      - zookeeper
+      - zookeeper-1
+      - zookeeper-2
+      - zookeeper-3
 
   akhq:
     image: tchiotludo/akhq:0.23.0
@@ -196,8 +218,12 @@ services:
     command: kafka:9092 test my-group consumer
 
 volumes:
-  zookeeper-data:
-  zookeeper-log:
+  zookeeper-1-data:
+  zookeeper-1-log:
+  zookeeper-2-data:
+  zookeeper-2-log:
+  zookeeper-3-data:
+  zookeeper-3-log:
   kafka-1-data:
   kafka-2-data:
   kafka-3-data: