centos7 部署 consul 集群服务

# 下载包
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 (x.x.x.1为主节点机器, 另外两个为从节点机器)
nohup consul agent -server -ui -bootstrap-expect=3 -data-dir=/hadoop/consul -node=server-1 -client=0.0.0.0 -bind=x.x.x.1 -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=x.x.x.2 -datacenter=cn_dc1 -join x.x.x.1 >> /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=x.x.x.3 -datacenter=cn_dc1 -join x.x.x.1 >> /var/log/consul/consul.log &

# 查看输出日志
tailf /var/log/consul/consul.log
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容