日韩久久久精品,亚洲精品久久久久久久久久久,亚洲欧美一区二区三区国产精品 ,一区二区福利

Dubbo Zookeeper Registry

系統(tǒng) 1836 0

http://code.alibabatech.com/wiki/display/dubbo/User+Guide#UserGuide-RequiredDependencies

Zookeeper Registry

?

建議使用dubbo-2.3.3以上版本的zookeeper注冊中心客戶端

?

Zookeeper說明
Zookeeper是Apacahe Hadoop的子項目,是一個樹型的目錄服務,支持變更推送,適合作為Dubbo服務的注冊中心,工業(yè)強度較高,可用于生產環(huán)境,并推薦使用,參見: http://zookeeper.apache.org

?

Zookeeper安裝
安裝方式參見:? Zookeeper安裝手冊 ,只需搭一個原生的Zookeeper服務器,并將 Quick Start 中Provider和Consumer里的conf/dubbo.properties中的dubbo.registry.addrss的值改為zookeeper://127.0.0.1:2181即可使用

?


Dubbo Zookeeper Registry

?

?

流程說明:

  • 服務提供者啟動時
    • 向/dubbo/com.foo.BarService/providers目錄下寫入自己的URL地址。
  • 服務消費者啟動時
    • 訂閱/dubbo/com.foo.BarService/providers目錄下的提供者URL地址。
    • 并向/dubbo/com.foo.BarService/consumers目錄下寫入自己的URL地址。
  • 監(jiān)控中心啟動時
    • 訂閱/dubbo/com.foo.BarService目錄下的所有提供者和消費者URL地址。

支持以下功能:

  • 當提供者出現(xiàn)斷電等異常停機時,注冊中心能自動刪除提供者信息。
  • 當注冊中心重啟時,能自動恢復注冊數(shù)據(jù),以及訂閱請求。
  • 當會話過期時,能自動恢復注冊數(shù)據(jù),以及訂閱請求。
  • 當設置<dubbo:registry check="false" />時,記錄失敗注冊和訂閱請求,后臺定時重試。
  • 可通過<dubbo:registry username="admin" password="1234" />設置zookeeper登錄信息。
  • 可通過<dubbo:registry group="dubbo" />設置zookeeper的根節(jié)點,缺省為dubbo。
  • 支持*號通配符<dubbo:reference group="*" version="*" />,可訂閱服務的所有分組和所有版本的提供者。

在provider和consumer中增加zookeeper客戶端jar包依賴:

< dependency >
???? < groupId >org.apache.zookeeper</ groupId >
???? < artifactId >zookeeper</ artifactId >
???? < version >3.3.3</ version >
</ dependency >

或直接下載: http://repo1.maven.org/maven2/org/apache/zookeeper/zookeeper

支持zkclient和curator兩種Zookeeper客戶端實現(xiàn):

?

ZKClient Zookeeper Registry

從2.2.0版本開始缺省為zkclient實現(xiàn),以提升zookeeper客戶端的健狀性。

ZKClient是Datameer開源的一個Zookeeper客戶端實現(xiàn),開源比較早,參見: https://github.com/sgroschupf/zkclient

缺省配置:

< dubbo:registry ? ... client = "zkclient" ? />

或:

dubbo.registry.client=zkclient

或:

zookeeper://10.20.153.10:2181?client=zkclient

需依賴:

< dependency >
???? < groupId >com.github.sgroschupf</ groupId >
???? < artifactId >zkclient</ artifactId >
???? < version >0.1</ version >
</ dependency >

或直接下載: http://repo1.maven.org/maven2/com/github/sgroschupf/zkclient

?

Curator Zookeeper Registry

從2.3.0版本開始支持可選curator實現(xiàn)。

Curator是Netflix開源的一個Zookeeper客戶端實現(xiàn),比較活躍,參見: https://github.com/Netflix/curator

如果需要改為curator實現(xiàn),請配置:

< dubbo:registry ? ... client = "curator" ? />

或:

dubbo.registry.client=curator

或:

zookeeper://10.20.153.10:2181?client=curator

需依賴:

< dependency >
???? < groupId >com.netflix.curator</ groupId >
???? < artifactId >curator-framework</ artifactId >
???? < version >1.1.10</ version >
</ dependency >

或直接下載: http://repo1.maven.org/maven2/com/netflix/curator/curator-framework

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 Zookeeper Registry


更多文章、技術交流、商務合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯(lián)系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發(fā)表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 武平县| 进贤县| 延长县| 健康| 六枝特区| 喜德县| 商河县| 宁安市| 札达县| 株洲县| 延寿县| 波密县| 万全县| 蓬莱市| 塘沽区| 宁海县| 古田县| 宁阳县| 苍梧县| 新宾| 基隆市| 延吉市| 萍乡市| 信丰县| 朝阳市| 沛县| 鄂托克前旗| 三江| 区。| 伊吾县| 普格县| 吴川市| 高安市| 大化| 双桥区| 林西县| 紫阳县| 怀化市| 临汾市| 富源县| 玉环县|