- Service Discovery
- Failure Detection
- Multi Datacenter
- Key/Value Storage
$ mkdir consul
$ wget https://dl.bintray.com/mitchellh/consul/0.3.1_linux_amd64.zip
$ unzip -d consul 0.3.1_linux_amd64.zip
$ ln -s /opt/consul/consul /usr/local/
$ consul agent -server -bootstrap -client=172.17.0.31 -dc=local -node=consul1 -data-dir=/root/consul -ui-dir=/opt/consul/dist -bind=172.17.0.31
$ consul agent -dc=local -node=consul2 -data-dir=/tmp/consul2 -bind=172.17.0.32 -join=172.17.0.31
$ curl -s http://172.17.0.62:8500/v1/catalog/nodes | jq .
$ curl -s http://172.17.0.62:8500/v1/health/node/consul2 | jq .
- <node>.node.<datacenter>.<domain>
- <tag>.<service>.service.<datacenter>.<domain>
$ dig @172.17.0.62 -p 8600 node.consul any
$ dig @172.17.0.62 -p 8600 consul.service.consul any
$ curl -s http://172.17.0.62:8500/v1/health/checks/database | jq .
$ cat services/database.json
{
"service": {
"name": "database",
"tags": [ "mysql" ],
"port": 5000,
"check": {
"script": "<Some Awesome Script>"
"interval": "10s"
}
}
}
$ cat services/unicorn.json
{
"service": {
"name": "unicorn",
"tags": [ "ver1" ],
"port": 3000
}
}