thank you for your replay,

String servers = "zk01:2181,zk02:2181"; 
_zkclient = new ZkClient(servers, 4000, connectionTimeout, new
BytesPushThroughSerializer()); 

when zk01 is down this code will fail:

org.I0Itec.zkclient.exception.ZkException: Unable to connect to
zk01t:9002,localhost:2181
        at org.I0Itec.zkclient.ZkConnection.connect(ZkConnection.java:63)
        at org.I0Itec.zkclient.ZkClient.connect(ZkClient.java:872)
        at org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:90)
        at org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:76)
        at
com.audiocodes.raf.cluster.server.ResourceAllocationFrameworkFactory.initNodes(ResourceAllocationFrameworkFactory.java:133)
        at
com.audiocodes.raf.cluster.server.ResourceAllocationFrameworkFactory.createFactory(ResourceAllocationFrameworkFactory.java:120)
        at
com.audiocodes.raf.cluster.server.ResourceAllocationFrameworkFactory.<init>(ResourceAllocationFrameworkFactory.java:108)
        at
com.audiocodes.raf.cluster.server.ZooKeeperClusterTest.setUp(ZooKeeperClusterTest.java:37)
        at
com.intellij.junit3.TestRunnerUtil$SuiteMethodWrapper.run(TestRunnerUtil.java:262)
        at
com.intellij.junit3.JUnit3IdeaTestRunner.doRun(JUnit3IdeaTestRunner.java:109)
        at 
com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:65)
Caused by: java.net.UnknownHostException: zk01t
        at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
        at java.net.InetAddresslookupAllHostAddr(InetAddress.java:850)
        at java.net.InetAddress.getAddressFromNameService(InetAddress.java:1201)
        at java.net.InetAddress.getAllByName0(InetAddress.java:1154)
        at java.net.InetAddress.getAllByName(InetAddress.java:1084)
        at java.net.InetAddress.getAllByName(InetAddress.java:1020)
        at org.apache.zookeeper.ClientCnxn.<init>(ClientCnxn.java:386)
        at org.apache.zookeeper.ClientCnxn.<init>(ClientCnxn.java:331)
        at org.apache.zookeeper.ZooKeeper.<init>(ZooKeeper.java:377)
        at org.I0Itec.zkclient.ZkConnection.connect(ZkConnection.java:61)
        ... 21 more




--
View this message in context: 
http://zookeeper-user.578899.n2.nabble.com/fail-connect-to-zookeeper-tp7572649p7576094.html
Sent from the zookeeper-user mailing list archive at Nabble.com.

Reply via email to