下载
https://releases.hashicorp.com/consul/1.11.4/consul_1.11.4_linux_amd64.zip
解压
mkdir -p /data/consul/{conf,data,logs,bin}
unzip consul_1.11.4_linux_amd64.zip -d /data/consul/bin/
自动补全
consul -autocomplete-install
complete -C /usr/local/bin/consul consul
编辑配置文件 vim /data/consul/conf/consul.json
{
"bind_addr": "192.168.1.100",
"bootstrap_expect": 1,
"client_addr": "192.168.1.100",
"data_dir": "/data/consul/data/",
"datacenter": "dec1",
"disable_update_check": false,
"enable_syslog": true,
"log_level": "INFO",
"server": true,
"syslog_facility": "local0",
"ui": true,
"performance": {
"raft_multiplier": 1
}
}
创建启动脚本 vim /usr/lib/systemd/system/consul.service
[Unit]
Description="HashiCorp Consul - A service mesh solution"
Documentation=https://www.consul.io/
Requires=network-online.target
After=network-online.target
[Service]
Type=notify
User=root
ExecStart=/data/consul/bin/consul agent -config-dir=/data/consul/conf/
ExecReload=/bin/kill --signal HUP $MAINPID
KillMode=process
KillSignal=SIGTERM
Restart=on-failure
LimitNOFILE=10240
LimitNPROC=10240
[Install]
WantedBy=multi-user.target
启动
systemctl daemon-reload
systemctl start consul
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有