You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2018/09/21 08:59:11 UTC

[GitHub] 356082462 opened a new issue #2545: 使用域名指向注册中心集群导致的单点问题

356082462 opened a new issue #2545: 使用域名指向注册中心集群导致的单点问题
URL: https://github.com/apache/incubator-dubbo/issues/2545
 
 
   - [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列表。

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org