(相关资料图)
配置中心如何解决的呢?配置中心的思路是把项目中的配置参数全部放在一个集中的地方来管理,并提供一套标准的接口,当各个服务需要获取配置的时候就来拉取信息,当配置中心有更新的时候,也能通知其他服务,实时同步最新消息。
1.添加配置信息
2.获取配置信息
GET http://192.168.88.144:8500/v1/kv/mic/pro/pro[ { "LockIndex":0, "Key":"mic/pro/pro", "Flags":0, "Value":"ewoJImhvc3QiOiIxMjcuMC4wLjEiLAogICJwcm90IjogMzMwNiwKICAidXNlciI6InRlc3QiLAogICJwd2QiOiIxMjcuMC4wLjEiCn0=", "CreateIndex":473, "ModifyIndex":473 }]
补充一下单点服务器Consul集群的步骤,我的虚拟机ip 192.168.88.144
,配置3个节点, Consul v1.12.1
server01@server01-virtual-machine:~$ consul versionConsul v1.12.1
wget https://releases.hashicorp.com/consul/1.12.1/consul_1.12.1_darwin_arm64.zipunzip consul_1.12.1_darwin_arm64.zipmv consul /usr/local/bin/consul
目录:
├── client1├── client2├── condifg├── data├── server1│ ├── basic.json│ ├── data│ ├── log│ └── nohup.out├── server2│ ├── basic.json│ ├── data│ ├── log│ └── nohup.out└── server3 ├── basic.json ├── data ├── log └── nohup.out
server1 basic.json详细参数,执行命令consul agent -config-dir=/home/server01/soft/consul/server1/basic.json
{ "bind_addr":"127.0.0.1", "client_addr":"0.0.0.0", "ports":{ "http":8500, "dns":8600, "serf_lan":8011, "serf_wan":8002, "server":8700 }, "datacenter":"dc1", "data_dir":"/home/server01/soft/consul/server1/data", "log_level":"INFO", "log_file":"/home/server01/soft/consul/server1/log/consul.log", "node_name":"consul-server-1", "disable_host_node_id":true, "server":true, "ui":true, "bootstrap_expect":3, "rejoin_after_leave":true, "retry_join":[ "127.0.0.1:8011", "127.0.0.1:8101", "127.0.0.1:8201" ]}
server2 basic.json详细参数,执行命令consul agent -config-dir=/home/server01/soft/consul/server2/basic.json
{ "bind_addr":"127.0.0.1", "client_addr":"0.0.0.0", "ports":{ "http":8501, "dns":8601, "serf_lan":8111, "serf_wan":8102, "server":8701 }, "datacenter":"dc1", "data_dir":"/home/server01/soft/consul/server2/data", "log_level":"INFO", "log_file":"/home/server01/soft/consul/server2/log/consul.log", "node_name":"consul-server-2", "disable_host_node_id":true, "server":true, "ui":true, "bootstrap_expect":3, "rejoin_after_leave":true, "retry_join":[ "127.0.0.1:8011", "127.0.0.1:8111", "127.0.0.1:8211" ]}
server3 basic.json详细参数,执行命令consul agent -config-dir=/home/server01/soft/consul/server3/basic.json
{ "bind_addr":"127.0.0.1", "client_addr":"0.0.0.0", "ports":{ "http":8502, "dns":8602, "serf_lan":8211, "serf_wan":8202, "server":8702 }, "datacenter":"dc1", "data_dir":"/home/server01/soft/consul/server3/data", "log_level":"INFO", "log_file":"/home/server01/soft/consul/server3/log/consul.log", "node_name":"consul-server-3", "disable_host_node_id":true, "server":true, "ui":true, "bootstrap_expect":3, "rejoin_after_leave":true, "retry_join":[ "127.0.0.1:8011", "127.0.0.1:8111", "127.0.0.1:8211" ]}
X 关闭
配置中心如何解决的呢?配置中心的思路是把项目中的配置参数全部放在...
人民健康是民族昌盛和国家强盛的重要标志。
保罗谈首发出场时间:你不是来这看球的,你是来这干活的,虎扑,快船...
合阳教育系统2023年“小手拉大手共创文明城”主题教育活动启动
本文原创,请勿抄袭和搬运,违者必究马斯克有一个梦想,那就是实现...
近年来,人工智能技术飞速发展,对人类社会的经济进步以及生产生活...
1、应该是微信朋友圈点赞吧。以上就是【红心游戏大厅官方下载官网,...
第十一届贵州人才博览会技能人才论坛在贵阳举行
“清纯妹妹”背后的连环套路两人利用招嫖信息诈骗被判刑
德甲第29轮,拜仁慕尼黑客场1-3遭美因茨逆转。本赛季,纳格尔斯曼带...
Copyright © 2015-2022 太平洋产业园区网版权所有 备案号:豫ICP备2022016495号-17 联系邮箱:93 96 74 66 9@qq.com