You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "zhangyz-hd (GitHub)" <gi...@apache.org> on 2019/12/03 07:02:24 UTC

[GitHub] [dubbo] zhangyz-hd commented on issue #5399: Optimize the configuration of “multiple-registry”

> Personally, I think the example configuration code is too complex.
> Could you please escribe your main concern of the previous mechanism?

multiple-registry的实现思路是非常ok的,但是配置方式非常不友好;
properties配置时,需要写成
```
dubbo.registry.address=multiple://127.0.0.1?application=vic&service-registry=reg1,reg2&reference-registry=reg1,reg2
```
或者
```
dubbo.registry.address=multiple://127.0.0.1?application=vic
dubbo.registry.parameters[service-registry]=reg1,reg2
dubbo.registry.parameters[reference-registry]=reg1,reg2
```
目前使用中发现这几个问题:
1. 人为拆分了service-registry和reference-registry属性,为何不参照dubbo-registry的register和subscribe属性去定义只注册/只订阅。
2. 多个注册中心用,(逗号)分割,但是zookeeper集群的多个ip地址之间默认就是,(逗号)分割,如zookeeper://ip1,ip2,ip3,这种在multiple-registry中就没法用了,也无法使用zookeper://ip1?backup=ip2,ip3的语法

如果不改变dubbo.xsd语法,比较友好的定义方式是:xml中
```
<dubbo:registry protocol="multiple">
    <dubbo:parameter key="child.z1" value="zookeeper://ip1,ip2,ip3"/>
    <dubbo:parameter key="child.z2" value="zookeeper://ip4,ip5,ip6" register="false"/><!-- 只订阅-->
    <dubbo:parameter key="child.r1"  value="redis://ip7"/>
</dubbo:registry>
```
或者properties中
```
dubbo.registry.protocol=multiple
dubbo.registry.parameters[child.z1]=zookeeper://ip1,ip2,ip3
dubbo.registry.parameters[child.z2]=zookeeper://ip4,ip5,ip6?register=false
dubbo.registry.parameters[child.r1]= redis://ip7
```

如果可以增加child-registry定义,那么也是可以做到1楼/2楼的语法描述。



[ Full content available at: https://github.com/apache/dubbo/issues/5399 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org