赞
踩
1.consul
启动节点:consul agent -dev -config-dir /etc/consul.d/
查看节点:consul members
服务查询:
dns方式:dig @127.0.0.1 -p 8600 dev.firstservice.service.consul
http方式:curl http://localhost:8500/v1/catalog/service/firstservice
dev.firstservice.service.consul是固定的格式组合:格式为:tag.servicename.service.consul,即tag和servicename为服务创建时自定义配置内容
Docker下部署:
docker pull consul
docker run consul version
docker run -p 8500:8500/tcp consul agent -server -ui -bootstrap-expect=1 -client=0.0.0.0
配置集群:
docker run -d -p 8500:8500 -e CONSUL_BIND_INTERFACE='eth0' --name=consul_server_1 consul agent -server -bootstrap -ui -node=1 -client='0.0.0.0'
docker run -d -e CONSUL_BIND_INTERFACE='eth0' --name=consul_server_2 consul agent -server -node=2 -join='172.17.0.2'
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。