This does not sound like a ZK bug - the contract on ZooKeeper is the IP addresses resolved from the host DNS name extracted from the connection string should have ZK server process running.. so in this case either the 'bad' IP should be removed from the record or you can use the IP address instead of DNS name in zoo.cfg for connection string.
On Wed, Jul 20, 2016 at 6:24 PM, 蒋丽诗 <[email protected]> wrote: > Hi, > > I am using zookeeper 3.4.6. > I have created A records "test-zookeeper.domain.name" with 2 ips behinds. > One has the zookeeper running, the other not. > > 21 Jul 2016 01:12:24,616 [WARN] (main-SendThread) > org.apache.zookeeper.ClientCnxn: Session 0x0 for server null, unexpected > error, closing socket connection and attempting reconnect > java.net.ConnectException: Connection refused > at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) > at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717) > at > > org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361) > at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1141) > 21 Jul 2016 01:12:24,724 [ERROR] (main) KafkaProducerConfig: Failed to get > data from zookeeper, as KeeperErrorCode = ConnectionLoss for /brokers/ids > > My code: > ZooKeeper zk = new ZooKeeper("test-zookeeper.domain.name:2181", 60000, > null); //zookeeper will close the session after 60s > List<String> ids = zk.getChildren("/brokers/ids", false); > > =====Some debug I have already done=== > ConnectStringParser connectStringParser = new ConnectStringParser(" > test-zookeeper.domain.name:2181"); > Collection<InetSocketAddress> serverAddresses = > connectStringParser.getServerAddresses(); > StaticHostProvider test = new StaticHostProvider(serverAddresses); > LOG.info(test.size()); //the result is 2 > > -- > Thanks, > Lishi > -- Cheers Michael.
