zoukankan      html  css  js  c++  java
  • 多注册中心 registry

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

    比如:CRM 有些服务是专门为国际站设计的,有些服务是专门为中文站设计的。

    <!-- 多注册中心配置 -->
    <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" />

    多注册中心引用

    比如:CRM 需同时调用中文站和国际站的 PC2 服务,PC2 在中文站和国际站均有部署,接口及版本号都一样,但连的数据库不一样。

    <!-- 多注册中心配置 -->
    <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" />

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

    <!-- 多注册中心配置,竖号分隔表示同时连接多个不同注册中心,同一注册中心的多个集群地址用逗号分隔 -->
    <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" />
  • 相关阅读:
    LeetCode OJ-- LRU Cache ***@
    LeetCode OJ-- Maximal Rectangle ***@
    LeetCode OJ-- Maximum Subarray @
    LeetCode OJ--Merge Intervals @
    导出你的GAC Assembly中的DLLS -- 金大昊(jindahao)
    Unity3d学习日记(六)
    如何不冲会员高速下载百度网盘上的资源
    3dContactPointAnnotationTool开发日志(三四)
    3dContactPointAnnotationTool开发日志(三三)
    3dContactPointAnnotationTool开发日志(三二)
  • 原文地址:https://www.cnblogs.com/yifanSJ/p/9153980.html
Copyright © 2011-2022 走看看