Stephane Barbarie | 7ba064f | 2017-06-20 10:57:20 -0400 | [diff] [blame] | 1 | ########################################################################################### |
| 2 | # |
| 3 | # Deploy a Zookeeper/Kafka messaging cluster |
| 4 | # |
| 5 | # It is meant to be deployed within a swarm cluster using the docker stack functionality. |
| 6 | # This file will deploy 3 zookeeper containers and 1 kafka container per swarm node. |
| 7 | # |
| 8 | # This file will also create an overlay network which can be referred by other services. |
| 9 | # |
| 10 | # Example: |
| 11 | # |
| 12 | # docker stack deploy -c docker-compose-kafka-ha-cluster.yml kafka |
| 13 | # |
| 14 | ########################################################################################### |
| 15 | |
| 16 | version: '3' |
| 17 | services: |
| 18 | zk1: |
| 19 | image: zookeeper |
| 20 | networks: |
| 21 | - net |
| 22 | environment: |
| 23 | ZOO_MY_ID: 1 |
| 24 | ZOO_SERVERS: server.1=0.0.0.0:2888:3888 server.2=zk2:2888:3888 server.3=zk3:2888:3888 |
| 25 | |
| 26 | zk2: |
| 27 | image: zookeeper |
| 28 | networks: |
| 29 | - net |
| 30 | environment: |
| 31 | ZOO_MY_ID: 2 |
| 32 | ZOO_SERVERS: server.1=zk1:2888:3888 server.2=0.0.0.0:2888:3888 server.3=zk3:2888:3888 |
| 33 | |
| 34 | zk3: |
| 35 | image: zookeeper |
| 36 | networks: |
| 37 | - net |
| 38 | environment: |
| 39 | ZOO_MY_ID: 3 |
| 40 | ZOO_SERVERS: server.1=zk1:2888:3888 server.2=zk2:2888:3888 server.3=0.0.0.0:2888:3888 |
| 41 | |
| 42 | kafka: |
| 43 | deploy: |
| 44 | mode: global |
| 45 | image: wurstmeister/kafka |
| 46 | environment: |
| 47 | KAFKA_ADVERTISED_PORT: 9092 |
| 48 | KAFKA_ZOOKEEPER_CONNECT: zk1:2181,zk2:2181,zk3:2181 |
| 49 | KAFKA_HEAP_OPTS: -Xmx256M -Xms128M |
| 50 | volumes: |
| 51 | - /var/run/docker.sock:/var/run/docker.sock |
| 52 | networks: |
| 53 | - net |
| 54 | - voltha-net |
| 55 | ports: |
| 56 | - 9092:9092 |
| 57 | |
| 58 | networks: |
| 59 | net: |
| 60 | driver: overlay |
schowdhury | d908496 | 2017-06-21 14:51:49 -0700 | [diff] [blame] | 61 | driver_opts: |
| 62 | encrypted: "true" |
Stephane Barbarie | 7ba064f | 2017-06-20 10:57:20 -0400 | [diff] [blame] | 63 | |
| 64 | voltha-net: |
| 65 | external: |
| 66 | name: voltha_net |
| 67 | |