centos7 部署 consul 集群服务
2022-11-21 本文已影响0人
玖月初识
# 下载包
wget https://releases.hashicorp.com/consul/1.11.1/consul_1.11.1_linux_amd64.zip
# 安装解压库 unzip
yum install -y unzip
# 解压包到指定路径: /usr/local
unzip consul_1.11.1_linux_amd64.zip -d /usr/local
# 添加软连接
ln -s /usr/local/consul /usr/local/bin/consul
# 创建文件夹存放 log
mkdir /var/log/consul/
#启动主节点带ui (10.21.39.122为主节点机器, 另外两个为从节点机器)
nohup consul agent -server -ui -bootstrap-expect=3 -data-dir=/hadoop/consul -node=server-1 -client=0.0.0.0 -bind=10.21.39.122 -datacenter=cn_dc1 >> /var/log/consul/consul.log &
#启动从节点 注意 node bind datacenter 相关参数变更
nohup consul agent -server -ui -bootstrap-expect=3 -data-dir=/hadoop/consul -node=server-2 -client=0.0.0.0 -bind=10.21.39.123 -datacenter=cn_dc1 -join 10.21.39.122 >> /var/log/consul/consul.log &
nohup consul agent -server -ui -bootstrap-expect=3 -data-dir=/hadoop/consul -node=server-3 -client=0.0.0.0 -bind=10.21.39.124 -datacenter=cn_dc1 -join 10.21.39.122 >> /var/log/consul/consul.log &
# 查看输出日志
tailf /var/log/consul/consul.log