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
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
--topic __consumer_offsets --from-beginning \
--formatter "kafka.coordinator.group.GroupMetadataManager\$$OffsetsMessageFormatter"
'
+
+volumes:
+ data-1:
+ data-2:
+ data-3:
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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