Skip to content

Instantly share code, notes, and snippets.

@noemi-dresden
Created July 18, 2019 12:32
Show Gist options
  • Save noemi-dresden/64eadabb54b21f890da46e6263c7c858 to your computer and use it in GitHub Desktop.
Save noemi-dresden/64eadabb54b21f890da46e6263c7c858 to your computer and use it in GitHub Desktop.
Kafka cluster using docker swarm and confluentinc image, managed by kafka-manager
version: "3"
services:
zookeeper-1:
image: confluentinc/cp-zookeeper:latest
hostname: zookeeper-1
ports:
- "12181:12181"
environment:
ZOOKEEPER_SERVER_ID: 1
ZOOKEEPER_CLIENT_PORT: 12181
ZOOKEEPER_TICK_TIME: 2000
ZOOKEEPER_INIT_LIMIT: 5
ZOOKEEPER_SYNC_LIMIT: 2
ZOOKEEPER_SERVERS: zookeeper-1:12888:13888;zookeeper-2:22888:23888;zookeeper-3:32888:33888
networks:
- myNetwork
deploy:
placement:
constraints: [node.hostname == performanz]
zookeeper-2:
image: confluentinc/cp-zookeeper:latest
hostname: zookeeper-2
ports:
- "22181:22181"
environment:
ZOOKEEPER_SERVER_ID: 2
ZOOKEEPER_CLIENT_PORT: 22181
ZOOKEEPER_TICK_TIME: 2000
ZOOKEEPER_INIT_LIMIT: 5
ZOOKEEPER_SYNC_LIMIT: 2
ZOOKEEPER_SERVERS: zookeeper-1:12888:13888;zookeeper-2:22888:23888;zookeeper-3:32888:33888
networks:
- myNetwork
deploy:
placement:
constraints: [node.hostname == performanz-2]
zookeeper-3:
image: confluentinc/cp-zookeeper:latest
hostname: zookeeper-3
container_name: zookeeper-3
ports:
- "32181:32181"
environment:
ZOOKEEPER_SERVER_ID: 3
ZOOKEEPER_CLIENT_PORT: 32181
ZOOKEEPER_TICK_TIME: 2000
ZOOKEEPER_INIT_LIMIT: 5
ZOOKEEPER_SYNC_LIMIT: 2
ZOOKEEPER_SERVERS: zookeeper-1:12888:13888;zookeeper-2:22888:23888;zookeeper-3:32888:33888
networks:
- myNetwork
deploy:
placement:
constraints: [node.hostname == performanz-3]
kafka-1:
image: confluentinc/cp-kafka:latest
hostname: kafka-1
ports:
- "9092:9092"
depends_on:
- zookeeper-1
- zookeeper-2
- zookeeper-3
environment:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: zookeeper-1:12181,zookeeper-2:22181,zookeeper-3:32181
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://ip-of-performanz-4:9092
KAFKA_ADVERTISED_HOST:
networks:
- myNetwork
deploy:
placement:
constraints: [node.hostname == performanz-4]
kafka-2:
image: confluentinc/cp-kafka:latest
hostname: kafka-2
ports:
- "9093:9093"
depends_on:
- zookeeper-1
- zookeeper-2
- zookeeper-3
environment:
KAFKA_BROKER_ID: 2
KAFKA_ZOOKEEPER_CONNECT: zookeeper-1:12181,zookeeper-2:22181,zookeeper-3:32181
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://ip-of-performanz-5:9093
networks:
- myNetwork
deploy:
placement:
constraints: [node.hostname == performanz-5]
kafka-3:
image: confluentinc/cp-kafka:latest
hostname: kafka-3
ports:
- "9094:9094"
depends_on:
- zookeeper-1
- zookeeper-2
- zookeeper-3
environment:
KAFKA_BROKER_ID: 3
KAFKA_ZOOKEEPER_CONNECT: zookeeper-1:12181,zookeeper-2:22181,zookeeper-3:32181
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://ip-of-performanz-6:9094
networks:
- myNetwork
deploy:
placement:
constraints: [node.hostname == performanz-6]
kafka_manager:
image: hlebalbau/kafka-manager:stable
ports:
- "9000:9000"
networks:
- myNetwork
environment:
ZK_HOSTS: "zookeeper-1:12181,zookeeper-2:22181,zookeeper-3:32181"
APPLICATION_SECRET: "random-secret"
command: -Dpidfile.path=/dev/null
deploy:
placement:
constraints: [node.hostname == performanz]
networks:
movebis:
external:
name: myNetwork
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment