Last active
October 25, 2017 03:20
-
-
Save kelein/84a6f8a49fcb5af9737f13dca6e26328 to your computer and use it in GitHub Desktop.
Consul Cluster on Docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '2' | |
services: | |
consul_server_1: | |
image: consul | |
ports: | |
- '8510:8500' | |
- '8610:8600' | |
volumes: | |
- /etc/timezone:/etc/timezone | |
- /etc/localtime:/etc/localtime | |
- ./etc/consul.d:/etc/consul.d | |
command: [ | |
'consul', | |
'agent', | |
'-server', | |
'-node=kallen-1', | |
'-client=0.0.0.0', | |
'-bind={{ GetInterfaceIP "eth0" }}', | |
'-bootstrap-expect=3', | |
'-data-dir=/tmp/consul/data', | |
'-enable-script-checks=true', | |
'-config-dir=/etc/consul.d', | |
'-retry-join=consul_server_1:8301', | |
'-ui' | |
] | |
hostname: 'consul_server_1' | |
#links: | |
#- consul_server2 | |
consul_server_2: | |
image: consul | |
ports: | |
- '8520:8500' | |
- '8620:8600' | |
volumes: | |
- /etc/timezone:/etc/timezone | |
- /etc/localtime:/etc/localtime | |
- ./etc/consul.d:/etc/consul.d | |
command: [ | |
'consul', | |
'agent', | |
'-server', | |
'-node=kallen-2', | |
'-client=0.0.0.0', | |
'-bind={{ GetInterfaceIP "eth0" }}', | |
'-bootstrap-expect=3', | |
'-data-dir=/tmp/consul/data', | |
'-enable-script-checks=true', | |
'-config-dir=/etc/consul.d', | |
'-retry-join=consul_server_1:8301', | |
#'-ui' | |
] | |
hostname: 'consul_server_2' | |
links: | |
- consul_server_1 | |
consul_server_3: | |
image: consul | |
ports: | |
- '8530:8500' | |
- '8630:8600' | |
volumes: | |
- /etc/timezone:/etc/timezone | |
- /etc/localtime:/etc/localtime | |
- ./etc/consul.d:/etc/consul.d | |
command: [ | |
'consul', | |
'agent', | |
'-server', | |
'-node=kallen-3', | |
'-client=0.0.0.0', | |
'-bind={{ GetInterfaceIP "eth0" }}', | |
'-bootstrap-expect=3', | |
'-data-dir=/tmp/consul/data', | |
'-enable-script-checks=true', | |
'-config-dir=/etc/consul.d', | |
'-retry-join=consul_server_1:8301', | |
#'-ui' | |
] | |
hostname: 'consul_server_3' | |
links: | |
- consul_server_1 | |
consul_agent_1: | |
image: consul | |
ports: | |
- '8540:8500' | |
- '8640:8600' | |
volumes: | |
- /etc/timezone:/etc/timezone | |
- /etc/localtime:/etc/localtime | |
- ./etc/consul.d:/etc/consul.d | |
command: [ | |
'consul', | |
'agent', | |
'-node=kallen-4', | |
'-client=0.0.0.0', | |
'-bind={{ GetInterfaceIP "eth0" }}', | |
'-data-dir=/tmp/consul/data', | |
'-enable-script-checks=true', | |
'-config-dir=/etc/consul.d', | |
'-retry-join=consul_server_1:8301', | |
'-ui' | |
] | |
hostname: 'consul_agent_1' | |
links: | |
- consul_server_1 | |
consul_agent_2: | |
image: consul | |
ports: | |
- '8550:8500' | |
- '8650:8600' | |
volumes: | |
- /etc/timezone:/etc/timezone | |
- /etc/localtime:/etc/localtime | |
- ./etc/consul.d:/etc/consul.d | |
command: [ | |
'consul', | |
'agent', | |
'-node=kallen-5', | |
'-client=0.0.0.0', | |
'-bind={{ GetInterfaceIP "eth0" }}', | |
'-data-dir=/tmp/consul/data', | |
'-enable-script-checks=true', | |
'-config-dir=/etc/consul.d', | |
'-retry-join=consul_server_1:8301', | |
'-ui' | |
] | |
hostname: 'consul_agent_2' | |
links: | |
- consul_server_1 | |
consul_agent_3: | |
image: consul | |
ports: | |
- '8560:8500' | |
- '8660:8600' | |
volumes: | |
- /etc/timezone:/etc/timezone | |
- /etc/localtime:/etc/localtime | |
- ./etc/consul.d:/etc/consul.d | |
command: [ | |
'consul', | |
'agent', | |
'-node=kallen-6', | |
'-client=0.0.0.0', | |
'-bind={{ GetInterfaceIP "eth0" }}', | |
'-data-dir=/tmp/consul/data', | |
'-enable-script-checks=true', | |
'-config-dir=/etc/consul.d', | |
'-retry-join=consul_server_1:8301', | |
'-ui' | |
] | |
hostname: 'consul_agent_3' | |
links: | |
- consul_server_1 |
Author
kelein
commented
Oct 23, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment