从zookeeper中获取对应dubbo服务的ip和port

1、用zkclint,获取服务"xxx"下面的所有provider信息

2、正则表达式获取ip和port

3、ip:port为test3环境zookeeper链接信息

ZkClient zkClient = new ZkClient("ip:port", 5000);
list = zkClient.getChildren("/dubbo/xxx/providers");
Iterator it = list.iterator();
while (it.hasNext()) {

    str = (String)it.next();
    System.out.println("返回provider信息:"+str);
    break;
    }
ip = getip(str);
port =getport(str);

你可能感兴趣的:(从zookeeper中获取对应dubbo服务的ip和port)