consul_1.5.3单服务结点安装

Consul安装

下载consul:consul_1.5.3_linux_amd64.zip

服务端安装:

将文件解压缩到/opt/consul-server/ 下, 然后增加配置文件config.json, 内容如下:
{
"bind_addr": "172.16.10.208",
"server": true,
"data_dir": "/opt/consul-server/data",
"log_level": "INFO",
"enable_syslog": true,
"bootstrap_expect": 1,
"node_name": "ny-208",
"datacenter": "DevConsul"
}

启动consul-server:
nohup /opt/consul-server/consul agent -config-dir /opt/consul-server -client 172.16.10.208 -node consul-server -ui & >> /opt/consul-server/log

客户端安装

2. Consul agent(微服务所在机器)172.16.10.209、172.16.10.210:
   下载consul:consul_1.5.3_linux_amd64.zip
   将文件解压缩到/opt/consul-agent/ 下, 然后增加配置文件config.json, 内容如下:
  
  210机器配置文件
   {
   "client_addr": "0.0.0.0",
   "bind_addr": "172.16.10.210",
   "data_dir": "/opt/consul-agent/data",
   "log_level": "INFO",
   "node_name": "ny-210",
   "datacenter": "DevConsul",
   "enable_syslog": true
   }
   
   209机器配置文件
   {
   "client_addr": "0.0.0.0",
   "bind_addr": "172.16.10.209",
   "data_dir": "/opt/consul-agent/data",
   "log_level": "INFO",
   "node_name": "ny-209",
   "datacenter": "DevConsul",
   "enable_syslog": true
   }

注意:datacenter的值要与consul server的datacenter一致
启动consul agent:
/opt/consul-agent/consul agent -config-dir /opt/consul-agent/ -join 172.16.10.208 &
posted @ 2023-12-08 17:07  村尚chun叔  阅读(20)  评论(0编辑  收藏  举报