consul_cluster安装笔记

/ Linux服务安装搭建 / 1 条评论 / 311浏览

Download

$ wget https://releases.hashicorp.com/consul/1.5.1/consul_1.5.1_linux_amd64.zip
$ unzip consul_1.5.1_linux_amd64.zip && cp consul /opt

主机分布

ipname
192.168.0.204agent-1
192.168.0.206agent-2
192.168.0.253agent-3

supervisor conf

Consul1

[program:consul11]
command = /opt/consul agent -server -ui -bootstrap-expect=1 -data-dir=/data/consul -node=agent-1 -client=0.0.0.0 -bind=192.168.0.204 -datacenter=dc1
user=root
numprocs=1
stopsignal=KILL
environment=JAVA_HOME=/usr/local/jdk,PLAY_HOME=/usr/local/play/
startretries=1
autostart=true
redirect_stderr=true
stdout_logfile = /opt/supervisord/var/log/consul1.log

consul2

[program:consul2]
command = /opt/consul agent -server -ui -bootstrap-expect=3 -data-dir=/data/consul -node=agent-2 -client=0.0.0.0 -bind=192.168.0.206 -datacenter=dc1 -join 192.168.0.204
user=root
numprocs=1
stopsignal=KILL
environment=JAVA_HOME=/usr/local/jdk,PLAY_HOME=/usr/local/play/
startretries=1
autostart=true
redirect_stderr=true
stdout_logfile = /opt/supervisord/var/log/consul2.log

Consul3

[program:consul3]
command = /opt/consul agent -server -ui -bootstrap-expect=3 -data-dir=/data/consul -node=agent-3 -client=0.0.0.0 -bind=192.168.0.253 -datacenter=dc1 -join 192.168.0.204
user=root
numprocs=1
stopsignal=KILL
environment=JAVA_HOME=/usr/local/jdk,PLAY_HOME=/usr/local/play/
startretries=1
autostart=true
redirect_stderr=true
stdout_logfile = /opt/supervisord/var/log/consul3.log

UI

192.168.0.204:8500

[root@paa6-proxy opt]# ./consul members
Node     Address             Status  Type    Build  Protocol  DC   Segment
agent-1  192.168.0.204:8301  alive   server  1.5.1  2         dc1  <all>
agent-2  192.168.0.206:8301  alive   server  1.5.1  2         dc1  <all>
agent-3  192.168.0.253:8301  alive   server  1.5.1  2         dc1  <all>
  1. 大佬带带我

    回复