安装-consul服务发现集群
Posted qing-840
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了安装-consul服务发现集群相关的知识,希望对你有一定的参考价值。
centos 7.4.x
consul 1.2.2
list:
172.16.16.103
172.16.16.112
172.16.16.115
下载:
#cd /usr/local/
#wget https://releases.hashicorp.com/consul/1.2.2/consul_1.2.2_linux_amd64.zip
#tar zxvf xxxxxx.zip
#第一台启动
#nohup ./consul agent -bind=172.16.16.112 -server -ui -bootstrap-expect 1 -data-dir=/data/consul/ -node=n1 -client=0.0.0.0 &
第二台启动:
#nohup ./consul agent -bind=172.16.16.112 -server -ui -data-dir=/data/consul/ -node=n2 -client=0.0.0.0 &
#./consul join 172.16.16.112
第三台启动:
#nohup ./consul agent -bind=172.16.16.115 -server -ui -data-dir=/data/consul/ -node=n3 -client=0.0.0.0 &
#./consul join 172.16.16.112
访问web:
http://172.16.16.103:8500/ui/dc1/services
增加服务发现:
curl -X PUT -d ‘{"id": "nginx-1","name": "nginx-1","address": "127.0.0.1","port": 8800,"tags": ["dev"],"checks": [{"http": "http://127.0.0.1:8800/","interval": "5s"}]}‘ http://127.0.0.1:8500/v1/agent/service/register
以上是关于安装-consul服务发现集群的主要内容,如果未能解决你的问题,请参考以下文章