https://releases.hashicorp.com/consul/1.9.3/consul_1.9.3_linux_amd64.zip
cd /application/consul_1.9.3_linux_amd64
#################################################################
chmod 744 ./consul
./consul agent -server -bind=192.168.1.113 -client=0.0.0.0 -bootstrap-expect=2 -data-dir=/data/consul/data -node=server-113
./consul agent -server -bind=192.168.1.115 -client=0.0.0.0 -bootstrap-expect=2 -data-dir=/data/consul/data -node=server-115
./consul agent -server -bind=192.168.1.117 -client=0.0.0.0 -bootstrap-expect=2 -data-dir=/data/consul/data -node=client-117 -ui
117做主节点,其他两个上加入集群运行:
#关闭3台服务器防火墙
systemctl stop firewalld #停止防火墙
systemctl disable firewalld #禁用防火墙
cd /application/consul_1.9.3_linux_amd64
./consul join 192.168.1.117
#允许防火墙端口
firewall-cmd --zone=public --add-port=8501/tcp --permanent
firewall-cmd --reload
cd /application/consul_1.9.3_linux_amd64
./consul members
#浏览器访问:
http://192.168.1.117:8500/ui/