码迷,mamicode.com
首页 > 其他好文 > 详细

dubbo注册中心介绍

时间:2018-02-05 14:29:55      阅读:152      评论:0      收藏:0      [点我收藏+]

标签:file   图片   cli   XML   开放   false   bsp   keep   gpo   

作者:微子Lee
链接:https://www.jianshu.com/p/2f4cfb6ed048

Dubbo的注册中心有好多种,包括Multicast、Zookeeper、Redis、Simple等。Dubbo官方推荐使用Zookeeper注册中心,我所使用过的也只是Zookeeper注册中心。

首先介绍一下Zookeeper:
ZooKeeper是一个分布式的,开放源码的分布式应用程序协调服务,是Google的Chubby一个开源的实现,是Hadoop和Hbase的重要组件。它是一个为分布式应用提供一致性服务的软件,提供的功能包括:配置维护、域名服务、分布式同步、组服务等。

建议使用dubbo-2.3.3以上版本的zookeeper注册中心客户端

 
技术分享图片
Paste_Image.png

流程说明:

服务提供者启动时
    向/dubbo/com.foo.BarService/providers目录下写入自己的URL地址。
服务消费者启动时
    订阅/dubbo/com.foo.BarService/providers目录下的提供者URL地址。
    并向/dubbo/com.foo.BarService/consumers目录下写入自己的URL地址。
监控中心启动时
    订阅/dubbo/com.foo.BarService目录下的所有提供者和消费者URL地址。

支持以下功能:

当提供者出现断电等异常停机时,注册中心能自动删除提供者信息。
当注册中心重启时,能自动恢复注册数据,以及订阅请求。
当会话过期时,能自动恢复注册数据,以及订阅请求。
当设置<dubbo:registry check="false" />时,记录失败注册和订阅请求,后台定时重试。
可通过<dubbo:registry username="admin" password="1234" />设置zookeeper登录信息。
可通过<dubbo:registry group="dubbo" />设置zookeeper的根节点,不设置将使用无根树。
支持*号通配符<dubbo:reference group="*" version="*" />,可订阅服务的所有分组和所有版本的提供者。

ZKClient Zookeeper Registry

从2.2.0版本开始缺省为zkclient实现,以提升zookeeper客户端的健状性。

缺省配置:
<dubbo:registry ... client="zkclient" />
或:
dubbo.registry.client=zkclient
或:
zookeeper://10.20.153.10:2181?client=zkclient

Curator Zookeeper Registry

从2.3.0版本开始支持可选curator实现。
如果需要改为curator实现,请配置:
<dubbo:registry ... client="curator" />
或:
dubbo.registry.client=curator
或:
zookeeper://10.20.153.10:2181?client=curator

Zookeeper单机配置:
<dubbo:registry address="zookeeper://10.20.153.10:2181" />
Or:
<dubbo:registry protocol="zookeeper" address="10.20.153.10:2181" />
Zookeeper集群配置:
<dubbo:registry address="zookeeper://10.20.153.10:2181?backup=10.20.153.11:2181,10.20.153.12:2181" />
Or:
<dubbo:registry protocol="zookeeper" address="10.20.153.10:2181,10.20.153.11:2181,10.20.153.12:2181" />
同一Zookeeper,分成多组注册中心:
<dubbo:registry id="chinaRegistry" protocol="zookeeper" address="10.20.153.10:2181" group="china" />
<dubbo:registry id="intlRegistry" protocol="zookeeper" address="10.20.153.10:2181" group="intl" />

dubbo注册中心介绍

标签:file   图片   cli   XML   开放   false   bsp   keep   gpo   

原文地址:https://www.cnblogs.com/frankyou/p/8417087.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!