consul无client模式

1、推consul的镜像到生产应用全部服务器。
每个consul的server模式的容器,都需要单独的物理服务器。

主节点:
docker run -d --net=host --name=consul_pre1 consul:0.9.0 agent -server -bind=10.0.0.20 -node=consul_pre1 -bootstrap-expect 2 -client 0.0.0.0 -ui
#docker run -d --net=host --name=consul_node_1 consul:0.9.0 agent -server -bootstrap-expect=2 -ui -client=0.0.0.0 -node=consul_node1 -advertise=10.0.0.8

从节点:
docker run -d --net=host --name=consul_pre2 consul:0.9.0 agent -bind=10.0.0.12 -node=consul_pre2 -retry-join=10.0.0.20
#docker run -d --net=host --name=consul_node_2 consul:0.9.0 agent -server -ui -client=0.0.0.0 -node=consul_node2 -retry-join=10.0.0.8 -advertise=10.0.0.9

#docker run -d --net=host --name=consul_node_3 consul:0.9.0 agent -server -ui -client=0.0.0.0 -node=consul_node3 -retry-join=10.0.0.8 -advertise=10.0.0.10

nginx反向代理consul:

vim /usr/local/nginx/conf/nginx.conf

server {
listen 8500;
server_name consul.server.com;
location / {
include proxy.conf;
proxy_pass http://consul;
}
}

vim /usr/local/nginx/conf/upstream.conf

upstream consul {
server 10.0.0.8:8500;
server 10.0.0.9:8500;
server 10.0.0.10:8500;

dns解析添加A记录:

vim /var/named/chroot/var/named/server.com.zone

consul.server.com. IN A 192.168.1.30

 

 

 

参考:

https://hub.docker.com/_/consul/

转载于:https://www.cnblogs.com/hello-init/p/9328041.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值