当前位置:网站首页>Nacos hierarchical storage model - the cluster configuration and NacosRule load balance
Nacos hierarchical storage model - the cluster configuration and NacosRule load balance
2022-07-29 13:03:00 【Maosan】
As our services grow,More and more service instance(比如说userservice,有8081、8082、8083Three instances of ports),It's not safe for us to deploy all services in the same room,When dealing with emergencies,like eggs in one basket;很不安全,很不友好,All we need to deploy the computer room and the server separately;
A service can be deployed in multiple clusters,A server can deploy multiple services(但是一般不会这么做,Generally one server only deploy a service instance),一个集群可以有多个实例;
So how do we configure the cluster??
服务启动前,Configure the cluster properties,再进行启动:
例如:
给userservice配置集群HZ(杭州),启动两个userservice实例:8081、8082,At this point both instances are deployed inHZ集群上

此时,Change the cluster name again,启动一个userservice3,This instance is deployed inSH(上海)集群上了
可以再NacosSee the deployed service instance in:
点击“详情”:Can see clusters and deployed instances
总结:
NacosRule负载均衡
Above we putuserservice1(服务提供者)和userservice2(服务提供者)配置在了HZ(杭州)集群,userservice3(服务提供者)配置在了SH(上海)集群.
操作:把orderservice(服务消费者)也部署在HZ集群:
此时我们的orderservice(服务消费者)also configured toHZ集群,再调用userservice(服务提供者)时,Will use the default polling algorithm;regardless of cluster(userservice1、2、3will poll calls);
这是很不明智的,because in reality,When our service in Hangzhouorderservice(服务消费者),To call a remote service in Shanghaiuserservice13,Certainly more than the same clusteruserservice1、2更加慢,increased time loss,舍近而求远
So how do we set theorderservice(服务消费者)What about setting default access to services on the same cluster as yourself??
这就引出了我们的NacosRule负载均衡:
配置NacosRule负载均衡之后,Will give priority to service providers in the same cluster

注意:配置NacosRule之后,Please put the originalRibbonload balancing configuration replacement、注释或删除,不然NacosThe load balancing configuration does not take effect
在orderservice(服务消费者)配置好NacosRule负载均衡之后,It will automatically call services in the same cluster as itself,也就是userservice1和2,will not call the remote clusteruserservice3
在orderservice(服务消费者)multiple calls to the same clusteruserservice服务实例时,Random access service instance will be performed;也就是说这里的userservice1和2,会被orderservice随机访问,而3Because they are not in the same cluster,will not be given priority access.
那如果此时,同一个集群的userservice1、2服务宕机了,orderservice在调用时,When there is no service tunable in this cluster,orderservicewill call different clustersuserservice3吗?
会!但是会有警告:originally visitedHZ集群,But at this time there is a cross-cluster access,访问了SH集群的userservice3
总结:
Nacos服务实例的权重设置
边栏推荐
- Nacos分级存储模型-集群配置与NacosRule负载均衡
- TiDB升级与案例分享(TiDB v4.0.1 → v5.4.1)
- MarkDown Advanced Syntax Manual
- 金仓数据库KingbaseES安全指南--6.8. SSPI身份验证
- Container is changed | deploy MySQL cluster in the Rancher
- The IDEA of Database plug-in Database Navigator plug-in
- MLX90640 红外热成像仪测温传感器模块开发笔记(九)
- asyncawait和promise的区别
- SIP系统组成格式
- 金仓数据库KingbaseES安全指南--6.7. GSSAPI身份验证
猜你喜欢

npm出现报错 npm WARN config global `--global`, `--local` are deprecated. Use `--location=global

命里有时终须有--记与TiDB的一次次擦肩而过

TiCDC同步延迟问题处理

CSDN TOP1 "a virgo program ape" how to become a blogger, millions of fans writing

Nacos分级存储模型-集群配置与NacosRule负载均衡

npm install 报错问题解决合集

pycharm专业版使用
![[纯理论] FCOS](/img/a4/f4f28faf5764e1fdebd475e445e2b0.png)
[纯理论] FCOS

【微信小程序】一文解决button、input、image组件

TiDB升级与案例分享(TiDB v4.0.1 → v5.4.1)
随机推荐
Mysql各个大版本之间的区别
sleep()方法和wait()方法的区别?安全
WordPress 主题和插件
传奇人形怪爆率怎么设置?人形怪增加教程
峰米V10、极米Rs Pro2及当贝X3 Pro究竟孰优孰劣?
mongo根据时间字段进行时间格式化并进行统计
【多线程】——Callable创建多线程
What should I do if the webpage is hijacked and redirected?Release net repair method
TiCDC同步延迟问题处理
es6箭头函数讲解
国内首秀元宇宙Live House圆满收官,百事可乐虚拟偶像真的好会!!
PHP uedtior报错 errorHandler is not defined
TiDB 操作实践 -- 备份与恢复
JS advanced four (map, reduce, filter, sort, arrow function, class inheritance, yield)
Wu En teacher machine learning course notes 6 logistic regression
3D Laser SLAM: Interpretation of LeGO-LOAM Papers---Hardware System Part
服务器无法连通有哪些原因
金仓数据库KingbaseES客户端编程接口指南-ODBC(6. KingbaseES ODBC 的扩展属性)
Draw boxes of WPF screenshots controls and ellipse (4) "imitation WeChat"
[GO语言基础] 一.为什么我要学习Golang以及GO语言入门普及