WIP
authorKai Moritz <kai@juplo.de>
Mon, 24 Oct 2022 16:50:34 +0000 (18:50 +0200)
committerKai Moritz <kai@juplo.de>
Mon, 24 Oct 2022 16:50:34 +0000 (18:50 +0200)
docker-compose.yml
kafka-1.properties [new file with mode: 0644]
kafka-2.properties [new file with mode: 0644]
kafka-3.properties [new file with mode: 0644]

index b3dc0f3..1100b21 100644 (file)
@@ -2,31 +2,14 @@ version: '3.2'
 services:
   kafka-1:
     image: confluentinc/cp-kafka:7.2.2
-    environment:
-      KAFKA_BROKER_ID: 1
-      KAFKA_PROCESS_ROLES: broker,controller
-      KAFKA_CONTROLLER_QUORUM_VOTERS: 1@kafka-1:9092,2@kafka-2:9092,3@kafka-3:9092
-      KAFKA_LISTENERS: DOCKER://:9092, LOCALHOST://:9081
-      KAFKA_ADVERTISED_LISTENERS: DOCKER://kafka-1:9092, LOCALHOST://localhost:9081
-      KAFKA_INTER_BROKER_LISTENER_NAME: DOCKER
-      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: DOCKER:PLAINTEXT, LOCALHOST:PLAINTEXT
-      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 3
-      KAFKA_AUTO_CREATE_TOPICS_ENABLE: "false"
     ports:
       - 9081:9081
+    volumes:
+      - ./kafka-1.properties:/etc/kafka/kafka.properties:ro
+      - data-1:/var/lib/data/kafka
 
   kafka-2:
-    image: confluentinc/cp-kafka:7.1.3
-    environment:
-      KAFKA_BROKER_ID: 2
-      KAFKA_PROCESS_ROLES: broker,controller
-      KAFKA_CONTROLLER_QUORUM_VOTERS: 1@kafka-1:9092,2@kafka-2:9092,3@kafka-3:9092
-      KAFKA_LISTENERS: DOCKER://:9092, LOCALHOST://:9082
-      KAFKA_ADVERTISED_LISTENERS: DOCKER://kafka-2:9092, LOCALHOST://localhost:9082
-      KAFKA_INTER_BROKER_LISTENER_NAME: DOCKER
-      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: DOCKER:PLAINTEXT, LOCALHOST:PLAINTEXT
-      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 3
-      KAFKA_AUTO_CREATE_TOPICS_ENABLE: "false"
+    image: confluentinc/cp-kafka:7.2.2
     ports:
       - 9092:9082
       - 9082:9082
@@ -34,21 +17,17 @@ services:
       default:
         aliases:
           - kafka
+    volumes:
+      - ./kafka-2.properties:/etc/kafka/kafka.properties:ro
+      - data-2:/var/lib/data/kafka
 
   kafka-3:
-    image: confluentinc/cp-kafka:7.1.3
-    environment:
-      KAFKA_BROKER_ID: 3
-      KAFKA_PROCESS_ROLES: broker,controller
-      KAFKA_CONTROLLER_QUORUM_VOTERS: 1@kafka-1:9092,2@kafka-2:9092,3@kafka-3:9092
-      KAFKA_LISTENERS: DOCKER://:9092, LOCALHOST://:9083
-      KAFKA_ADVERTISED_LISTENERS: DOCKER://kafka-3:9092, LOCALHOST://localhost:9083
-      KAFKA_INTER_BROKER_LISTENER_NAME: DOCKER
-      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: DOCKER:PLAINTEXT, LOCALHOST:PLAINTEXT
-      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 3
-      KAFKA_AUTO_CREATE_TOPICS_ENABLE: "false"
+    image: confluentinc/cp-kafka:7.2.2
     ports:
       - 9083:9083
+    volumes:
+      - ./kafka-3.properties:/etc/kafka/kafka.properties:ro
+      - data-3:/var/lib/data/kafka
 
   setup:
     image: juplo/toolbox
@@ -88,3 +67,8 @@ services:
           --topic __consumer_offsets --from-beginning \
           --formatter "kafka.coordinator.group.GroupMetadataManager\$$OffsetsMessageFormatter"
       '
+
+volumes:
+  data-1:
+  data-2:
+  data-3:
diff --git a/kafka-1.properties b/kafka-1.properties
new file mode 100644 (file)
index 0000000..2bc6a8f
--- /dev/null
@@ -0,0 +1,11 @@
+inter.broker.listener.name=DOCKER
+process.roles=broker,controller
+controller.quorum.voters=1@kafka-1:9092,2@kafka-2:9092,3@kafka-3:9092
+auto.create.topics.enable=false
+advertised.listeners=DOCKER://kafka-1:9092, LOCALHOST://localhost:9081
+listener.security.protocol.map=DOCKER:PLAINTEXT, LOCALHOST:PLAINTEXT
+broker.id=1
+listeners=DOCKER://:9092, LOCALHOST://:9081
+zookeeper.connect=zookeeper:2181
+log.dirs=/var/lib/kafka/data
+offsets.topic.replication.factor=3
diff --git a/kafka-2.properties b/kafka-2.properties
new file mode 100644 (file)
index 0000000..209385a
--- /dev/null
@@ -0,0 +1,10 @@
+inter.broker.listener.name=DOCKER
+process.roles=broker,controller
+controller.quorum.voters=1@kafka-1:9092,2@kafka-2:9092,3@kafka-3:9092
+auto.create.topics.enable=false
+advertised.listeners=DOCKER://kafka-2:9092, LOCALHOST://localhost:9082
+listener.security.protocol.map=DOCKER:PLAINTEXT, LOCALHOST:PLAINTEXT
+broker.id=2
+listeners=DOCKER://:9092, LOCALHOST://:9082
+log.dirs=/var/lib/kafka/data
+offsets.topic.replication.factor=3
diff --git a/kafka-3.properties b/kafka-3.properties
new file mode 100644 (file)
index 0000000..a3afb96
--- /dev/null
@@ -0,0 +1,11 @@
+inter.broker.listener.name=DOCKER
+process.roles=broker,controller
+controller.quorum.voters=1@kafka-1:9092,2@kafka-2:9092,3@kafka-3:9092
+auto.create.topics.enable=false
+advertised.listeners=DOCKER://kafka-3:9092, LOCALHOST://localhost:9083
+listener.security.protocol.map=DOCKER:PLAINTEXT, LOCALHOST:PLAINTEXT
+broker.id=3
+listeners=DOCKER://:9092, LOCALHOST://:9083
+zookeeper.connect=zookeeper:2181
+log.dirs=/var/lib/kafka/data
+offsets.topic.replication.factor=3