Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update _index.md #2856

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ RpcContext.getContext().setAttachment("registry_zone", "qingdao");

### 2.2 多注册中心地址聚合
```xml
<dubbo:registry address="multiple://127.0.0.1:2181?separator=;&reference-registry=zookeeper://address11?backup=address12,address13;zookeeper://address21?backup=address22,address23" />
<dubbo:registry address="multiple://127.0.0.1:2181?separator=!&reference-registry=zookeeper://address11?backup=address12,address13#zookeeper://address21?backup=address22,address23" />
```

这里增加了一个特殊的 multiple 协议开头的注册中心,其中:
* `multiple://127.0.0.1:2181` 并没有什么具体含义,只是一个特定格式的占位符,地址可以随意指定
* `reference-registry` 指定了要聚合的注册中心集群的列表,示例中有两个集群,分别是 `zookeeper://address11?backup=address12,address13` 和 `zookeeper://address21?backup=address22,address23`,其中还特别指定了集群分隔符 `separator=";"`
* `reference-registry` 指定了要聚合的注册中心集群的列表,示例中有两个集群,分别是 `zookeeper://address11?backup=address12,address13` 和 `zookeeper://address21?backup=address22,address23`,其中还特别指定了集群分隔符 `separator="!"`

如下图所示,不同注册中心集群的地址会被聚合到一个地址池后在消费端做负载均衡或路由选址。

Expand All @@ -139,7 +139,7 @@ RpcContext.getContext().setAttachment("registry_zone", "qingdao");
在 3.1.0 版本及之后,还支持每个注册中心集群上设置特定的 attachments 属性,以实现对该注册中心集群下的地址做特定标记,后续配合 Router 组件扩展如 TagRouter 等就可以实现跨机房间的流量治理能力。

```xml
<dubbo:registry address="multiple://127.0.0.1:2181?separator=;&reference-registry=zookeeper://address11?attachments=zone=hangzhou,tag=middleware;zookeeper://address21" />
<dubbo:registry address="multiple://127.0.0.1:2181?separator=!&reference-registry=zookeeper://address11?attachments=zone=hangzhou,tag=middleware;zookeeper://address21" />
```

增加 `attachments=zone=hangzhou,tag=middleware` 后,所有来自该注册中心的 URL 地址将自动携带 `zone` 和 `tag` 两个标识,方便消费端更灵活的做流量治理。
Expand Down Expand Up @@ -192,4 +192,4 @@ CRM 需同时调用中文站和国际站的 PC2 服务,PC2 在中文站和国
<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" />
```
```
Loading