构造consul的docker集群
sudo docker run -d --name=node0 consul agent -server -client=0.0.0.0 -node=node0 -bootstrap-expect=1 -bind=172.17.0.2 -data-dir=/tmp/consul -ui-dir /ui sudo docker run -d --name=node1 consul agent -node-id=$(uuidgen | awk '{print tolower($0)}') -server -client=0.0.0.0 -node=node1 -bind=172.17.0.3 -join=172.17.0.2 sudo docker run -d --name=node2 consul agent -node-id=$(uuidgen | awk '{print tolower($0)}') -server -client=0.0.0.0 -node=node2 -bind=172.17.0.4 -join=172.17.0.2 sudo docker run -d --name=node3 consul agent -node-id=$(uuidgen | awk '{print tolower($0)}') -client=0.0.0.0 -node=node3 -bind=172.17.0.5 -join=172.17.0.2 |
参看集群状态
sudo docker exec -t node0 consul info |
Network Coordinates in consul
curl http://172.17.0.2:8500/v1/coordinate/datacenters |
curl http://172.17.0.2:8500/v1/coordinate/nodes |
健康检查
curl http://172.17.0.3:8500/v1/health/service/consul |
Render by hexo-renderer-org with Emacs 25.3.2 (Org mode 8.2.10)