1、Dubbo支持的注册中心

Zookeeper(官方推荐)

优点:支持分布式.很多周边产品.

缺点:受限于Zookeeper软件的稳定性.Zookeeper专门分布式辅助软件,稳定较优

Multicast

优点:去中心化,不需要单独安装软件.

缺点:Provider、Consumer和Registry不能跨机房(路由)

Redis

优点:支持集群,性能高

缺点:要求服务器时间同步,否则可能出现集群失败问题

Simple

优点:标准RPC服务,没有兼容问题

缺点:不支持集群

Nacos(官方推荐)

优点:Nacos 支持几乎所有主流类型的“服务”的发现、配置和管理: Kubernetes Service gRPC & Dubbo RPC Service Spring Cloud RESTful Service

缺点:使用基数较少,文档不多。

dubbo多配置注册中心

dubbo官网基于dubbo 2.7  的多注册中心配置

Dubbo 支持同一服务向多注册中心同时注册,或者不同服务分别注册到不同的注册中心上去,甚至可以同时引用注册在不同注册中心上的同名服务

provider

单服务多注册中心注册

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd"><dubbo:application name="world"  /><!-- 多注册中心配置 --><dubbo:registry id="hangzhouRegistry" address="10.20.141.150:9090" /><!--杭州注册中心--><dubbo:registry id="qingdaoRegistry" address="10.20.141.151:9010" default="false" /><!--青岛注册中心--><!-- 一个服务向多个注册中心注册 --><dubbo:service interface="com.alibaba.hello.api.HelloService" version="1.0.0" ref="helloService" registry="hangzhouRegistry,qingdaoRegistry" />
</beans>

不同服务使用不同注册中心

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd"><dubbo:application name="world"  /><!-- 多注册中心配置 --><dubbo:registry id="chinaRegistry" address="10.20.141.150:9090" /><dubbo:registry id="intlRegistry" address="10.20.154.177:9010" default="false" /><!-- 向中文站注册中心注册 --><dubbo:service interface="com.alibaba.hello.api.HelloService" version="1.0.0" ref="helloService" registry="chinaRegistry" /><!-- 向国际站注册中心注册 --><dubbo:service interface="com.alibaba.hello.api.DemoService" version="1.0.0" ref="demoService" registry="intlRegistry" />
</beans>

consumer

多注册中心引用

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd"><dubbo:application name="world"  /><!-- 多注册中心配置 --><dubbo:registry id="chinaRegistry" address="10.20.141.150:9090" /><dubbo:registry id="intlRegistry" address="10.20.154.177:9010" default="false" /><!-- 引用中文站服务 --><dubbo:reference id="chinaHelloService" interface="com.alibaba.hello.api.HelloService" version="1.0.0" registry="chinaRegistry" /><!-- 引用国际站站服务 --><dubbo:reference id="intlHelloService" interface="com.alibaba.hello.api.HelloService" version="1.0.0" registry="intlRegistry" />
</beans>

如果只是测试环境临时需要连接两个不同注册中心,使用竖号分隔多个不同注册中心地址:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd"><dubbo:application name="world"  /><!-- 多注册中心配置,竖号分隔表示同时连接多个不同注册中心,同一注册中心的多个集群地址用逗号分隔 --><dubbo:registry address="10.20.141.150:9090|10.20.154.177:9010" /><!-- 引用服务 --><dubbo:reference id="helloService" interface="com.alibaba.hello.api.HelloService" version="1.0.0" />
</beans>

Dubbo多注册中心配置相关推荐

  1. springboot整合dubbo之多注册中心配置(服务提供者和消费者均配置 2.7.0版本)

    一开始之前怎么配置都不能运行,会绕过远程连接的地址直接去链接127.0.0.1:2181这个地址,一直报错.再换回去单注册中心还是会一直多连一个莫须有的注册中心一直一直启动不开.类似于下面这样 ,因为 ...

  2. 亲!你的专属Dubbo启动注册中心,请注意查收!

    现在来说一下dubbo注册中心的大致结构,请看下图: Java学习笔记开源框架--dubbo启动之注册中心(Registry) 服务注册 对于服务提供方,它需要发布服务,而且由于应用系统的复杂性,服务 ...

  3. 微服务 注册中心的作用_微服务架构Dubbo之注册中心(Zookeeper)

    注册中心简介 在微服务架构中,注册中心是核心的基础服务之一.在微服务架构流行之前,注册中心就已经开始出现在分布式架构的系统中.Dubbo是一个在国内比较流行的分布式框架,被大量的中小型互联网公司所采用 ...

  4. Dubbo学习-注册中心

    Dubbo支持多种注册中心,比如Nacos,Zookeeper, Multicast,Redis ,Simple等注册中心.主流的方式应该是Nacos和Zookeeper.最近项目中使用了Nacos注 ...

  5. Apollo注册到自己的Eureka注册中心+配置中心集群

    ##重要提示:在任何步骤开始之前,谨记下面的东西## 在对apollo-master这个文件进行处理的时候,要找到文件夹scripts下的文件build.bat,苹果用户请找到build.sh,并且在 ...

  6. Eureka注册中心配置登录验证

    一.创建一个父工程,并且在父工程中指定SpringCloud的版本,并且将packaing修改为pom <packaging>pom</packaging> ​ <dep ...

  7. Spring Cloud -Eureka 注册中心配置

    Spring Cloud简介 1.简介 Spring Cloud是Spring旗下的项目之一,官网地址:http://projects.spring.io/spring-cloud/ Spring最擅 ...

  8. java微服务环境配置——注册中心 配置中心Nacos

    一.使用步骤(注册中心) 1.启动nocas服务 1)先下载Nacos,解压之后启动.解压之后的目录如下: 2) 注意有的版本默认是集群启动,可以修改启动脚本.如下: 3)也可以使用bin目录下命令行 ...

  9. Spring boot整合nacos注册中心/配置中心报错:java.lang.IllegalArgumentException: no server available

    1.问题描述 我是近期在使用Springboot整合nacos,由于springboot和springcloud都是用最新版本,啪的一下,很快啊,就出现问题了,于是自己把版本降下来了,年轻人不讲武德降 ...

最新文章

  1. Bio-protocol实验视频大赛中奖率提升至100%
  2. linux磁盘分配方案,安装Linux系统磁盘分配方案.doc
  3. 封装对MongoDB数据库的增删改查访问方法(基于MongoDB官方发布的C#驱动)
  4. windows文件服务器双机热备_遇到ZFS文件系统如此棘手的问题,这种办法简单又高效!...
  5. DL之yolov3:使用yolov3算法时需要对Ubuntu系统进行配置的简介、过程步骤之详细攻略
  6. linux怎么取消文件隐藏命令,Linux基础命令:显示隐藏的文件
  7. Win7+Ubuntu双系统结构下,Ubuntu克隆至新硬盘,启动成功
  8. Android中导入第三方jar
  9. ZooKeeper,策展人以及微服务负载平衡的工作方式
  10. ice库c语言例子,很不多的ICE架构入门学习例子
  11. pytorch 池化
  12. bzoj 3609: [Heoi2014]人人尽说江南好(博弈)
  13. GPS章节要义(补充计算题)
  14. 风筝 vpn_风筝将其AI驱动的代码完成功能引入JavaScript
  15. CES2020即将完结!盘点这些脑洞产品,保证你看一眼就被种草
  16. ​红旗首款奢华纯电动SUV车型上市;一起教育登陆纳斯达克;恒隆与凯悦在昆明打造君悦酒店 | 美通企业周刊...
  17. linux部署qq机器人记录
  18. 华为重回Android,华为Mate 20 Pro重回Android Q名单中
  19. 百度千言-中文文本相似度实战
  20. 这么多嵌入式设计创意,哪个你曾想过?

热门文章

  1. SAP成都研究院李三郎:SCP Application Router简介
  2. mysql保存emoji特殊表情处理
  3. 小学计算机金山画王教案,小学金山画王教案样稿.doc
  4. 论文投稿指南——中文核心期刊推荐(电子、通信技术3)
  5. Excel技能总结(WPS)
  6. unity支持的模型数据格式_Unity3D开发:向Unity3D中导入外部模型
  7. 基于51单片机多路温度检测proteus仿真 ds18b20
  8. 32位操作系统是什么意思
  9. SOAP报文转成JAVA对象
  10. linux 平铺式桌面,Linux下5 个很酷的平铺窗口管理器