- [x] I have searched the [issues](https://github.com/apache/incubator-dubbo/issues) of this repository and believe that this is not a duplicate. - [x] I have checked the [FAQ](https://github.com/apache/incubator-dubbo/blob/master/FAQ.md) of this repository and believe that this is not a duplicate.
### Environment * Dubbo version: 2.6.2 * 域名解析示例: 10.0.0.1 zk.foo.com 10.0.0.2 zk.foo.com 10.0.0.3 zk.foo.com 10.0.0.4 zk.foo.com 10.0.0.5 zk.foo.com * 注册中心:zookeeper 在生产环境中要求只能使用域名,注册中心的域名解析如示例中所示,Dubbo框架在创建注册中心时,会对域名进行解析,且只取其中一个IP,这会导致每次解析获得的IP有可能不一样,有可能出现如下问题: 1、解析获取到不一样的IP的时候,会再次创建一个注册中心实例,导致和注册中心建立多个连接。 2、如果始终解析到的是一个IP,如果该注册中心节点不可以,zookeeper客户端也没有可重试的IP,那么会导致应用与注册中心的会话失效,导致临时服务节点被删除。 下面是获取注册中心Key的代码: https://github.com/apache/incubator-dubbo/blob/e6b0bc8a856abd7f2d7a2e0f06ccc78dc90e2e0a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/AbstractRegistryFactory.java#L88 就是在该方法中将域名解析成单一的IP,是否可以考虑将该实现换成不解析域名的方法: https://github.com/apache/incubator-dubbo/blob/7a48fac84b14ac6a21c1bdfc5958705dd8dda84d/dubbo-compatible/src/main/java/com/alibaba/dubbo/common/URL.java#L498-L500 将域名解析的任务交给zookeeper客户端完成,zookeeper客户端默认会将域名解析成IP列表。 [ Full content available at: https://github.com/apache/incubator-dubbo/issues/2545 ] This message was relayed via gitbox.apache.org for [email protected]
