Skip to content

Instantly share code, notes, and snippets.

@carlosocarvalho
Created January 7, 2020 19:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carlosocarvalho/b147c255d569ab64a73c209476ebc271 to your computer and use it in GitHub Desktop.
Save carlosocarvalho/b147c255d569ab64a73c209476ebc271 to your computer and use it in GitHub Desktop.
Kafka file for docker swarm
version: '3.3'
services:
kafka-1:
image: wurstmeister/kafka:1.1.0
environment:
KAFKA_BROKER_ID: '1'
KAFKA_CONTROLLER_SHUTDOWN_ENABLE: 'true'
KAFKA_DEFAULT_REPLICATION_FACTOR: '3'
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: '3000'
KAFKA_INTER_BROKER_LISTENER_NAME: INSIDE
KAFKA_LISTENERS: INSIDE://:9092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INSIDE:PLAINTEXT,OUTSIDE:PLAINTEXT
KAFKA_LOG_DIRS: /kafka/kafka-logs
KAFKA_LOG_RETENTION_BYTES: '-1'
KAFKA_LOG_RETENTION_DAYS: '2'
KAFKA_MIN_INSYNC_REPLICAS: '2'
KAFKA_UNCLEAN_LEADER_ELECTION_ENABLE: 'true'
KAFKA_ZOOKEEPER_CONNECT: zookeeper
volumes:
- kafaka_v1:/kafka/kafka-logs
networks:
- custom-network
logging:
driver: json-file
kafka-2:
image: wurstmeister/kafka:1.1.0
environment:
KAFKA_BROKER_ID: '2'
KAFKA_CONTROLLER_SHUTDOWN_ENABLE: 'true'
KAFKA_DEFAULT_REPLICATION_FACTOR: '3'
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: '3000'
KAFKA_INTER_BROKER_LISTENER_NAME: INSIDE
KAFKA_LISTENERS: INSIDE://:9092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INSIDE:PLAINTEXT,OUTSIDE:PLAINTEXT
KAFKA_LOG_DIRS: /kafka/kafka-logs
KAFKA_LOG_RETENTION_BYTES: '-1'
KAFKA_LOG_RETENTION_DAYS: '2'
KAFKA_MIN_INSYNC_REPLICAS: '2'
KAFKA_UNCLEAN_LEADER_ELECTION_ENABLE: 'true'
KAFKA_ZOOKEEPER_CONNECT: zookeeper
volumes:
- kafaka_v2:/kafka/kafka-logs
networks:
- custom-network
logging:
driver: json-file
kafka-3:
image: wurstmeister/kafka:1.1.0
environment:
KAFKA_BROKER_ID: '3'
KAFKA_CONTROLLER_SHUTDOWN_ENABLE: 'true'
KAFKA_DEFAULT_REPLICATION_FACTOR: '3'
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: '3000'
KAFKA_INTER_BROKER_LISTENER_NAME: INSIDE
KAFKA_LISTENERS: INSIDE://:9092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INSIDE:PLAINTEXT,OUTSIDE:PLAINTEXT
KAFKA_LOG_DIRS: /kafka/kafka-logs
KAFKA_LOG_RETENTION_BYTES: '-1'
KAFKA_LOG_RETENTION_DAYS: '2'
KAFKA_MIN_INSYNC_REPLICAS: '2'
KAFKA_UNCLEAN_LEADER_ELECTION_ENABLE: 'true'
KAFKA_ZOOKEEPER_CONNECT: zookeeper
volumes:
- kafaka_v3:/kafka/kafka-logs
networks:
- custom-network
logging:
driver: json-file
kafka-manager:
image: sheepkiller/kafka-manager:latest
environment:
APPLICATION_SECRET: 69139849-ef1d-4045-b56e-36e107d2379e
KM_ARGS: -Djava.net.preferIPv4Stack=true
ZK_HOSTS: zookeeper:2181
networks:
- custom-network
- proxy
logging:
driver: json-file
deploy:
labels:
traefik.http.routers.kafka.middlewares: kafka-redirect-https
traefik.http.routers.kafka-secure.entrypoints: https
traefik.http.middlewares.kafka-redirect-https.redirectscheme.scheme: https
traefik.http.routers.kafka.rule: Host(`kafka.carlosocarvalho.com.br`)
traefik.http.routers.kafka.entrypoints: http
traefik.http.routers.kafka-secure.rule: Host(`kafka.carlosocarvalho.com.br`)
traefik.http.services.kafka.loadbalancer.server.port: '9000'
traefik.http.routers.kafka-secure.tls: 'true'
traefik.http.routers.kafka-secure.tls.certresolver: le
traefik.docker.network: proxy
traefik.enable: 'true'
zookeeper:
image: wurstmeister/zookeeper:3.4.6
ports:
- 2181:2181
volumes:
- zookeeper:/opt/zookeeper-3.4.6/data
networks:
- custom-network
logging:
driver: json-file
networks:
custom-network:
external: true
proxy:
external: true
volumes:
kafaka_v1:
external: true
kafaka_v2:
external: true
kafaka_v3:
external: true
zookeeper:
external: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment