Consul安装及部署

下载

wget https://releases.hashicorp.com/consul/1.7.2/consul_1.7.2_linux_amd64.zip

解压

unzip consul_1.7.2_linux_amd64.zip -d /usr/bin

创建启动文件

vim /lib/systemd/system/consul.service
[Unit]
Description=consul
[Service]
ExecStart=/usr/bin/consul agent -config-dir /etc/consul
KillSignal=SIGINT

创建配置文件

mkdir /etc/consul/
vim /etc/consul/server.json
{
"data_dir": "/tmp/consul",
"datacenter": "dc1",
"log_level": "INFO",
"node_name": "192.168.159.128",
"bind_addr": "192.168.259.128",
"ui":true,
"server": true,
"bootstrap_expect": 2,#节点数 建议大于2
"client_addr": "0.0.0.0" 
}

启动及加入节点

consul agent -config-file server.json #启动节点1
consul agent -config-file server.json -join 192.168.159.129 #启动节点2 并加入129节点

管理界面初探
Consul安装及部署_第1张图片

你可能感兴趣的:(微服务)