码迷,mamicode.com
首页 > 其他好文 > 详细

安装-consul服务发现集群

时间:2018-09-06 03:01:36      阅读:225      评论:0      收藏:0      [点我收藏+]

标签:rap   serve   ash   127.0.0.1   https   ons   cli   expec   oca   

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服务发现集群

标签:rap   serve   ash   127.0.0.1   https   ons   cli   expec   oca   

原文地址:https://www.cnblogs.com/Qing-840/p/9595675.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!