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 &
分类:
注册服务 / Consul
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· PowerShell开发游戏 · 打蜜蜂
· 在鹅厂做java开发是什么体验
· 百万级群聊的设计实践
· WPF到Web的无缝过渡:英雄联盟客户端的OpenSilver迁移实战
· 永远不要相信用户的输入:从 SQL 注入攻防看输入验证的重要性