服务是可以使用 HTTP API 进行动态修改 (HTTP API 可以用来进行动态的添加,删除,修改服务)
命令汇总
wget https://releases.hashicorp.com/consul/0.6.4/consul_0.6.4_linux_amd64.zip
sha256sum consul_0.6.4_linux_amd64.zip
unzip consul_0.6.4_linux_amd64.zip
file consul
./consul --help
./consul version
cp consul /usr/local/bin/
consul version
consul agent -dev -bind=192.168.100.104
netstat -tunpea | grep consul
consul members --help
consul members -detailed
curl localhost:8500/v1/catalog/nodes?pretty
netstat -tunpea | grep consul | grep 8600
dig @127.0.0.1 -p 8600 h104.node.consul
consul members
mkdir /etc/consul.d
echo '{"service": {"name": "web", "tags": ["rails"], "port": 80}}' > /etc/consul.d/web.json
cat /etc/consul.d/web.json
consul agent -dev -bind=192.168.100.104 -config-dir /etc/consul.d/
dig @127.0.0.1 -p 8600 web.service.consul
dig @127.0.0.1 -p 8600 web.service.consul SRV
dig @127.0.0.1 -p 8600 rails.web.service.consul
curl http://localhost:8500/v1/health/service/web?passing
curl http://localhost:8500/v1/health/service/web?pretty
原文地址