You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@zookeeper.apache.org by Yosef Arraf <yo...@gmail.com> on 2012/05/23 06:07:15 UTC

fail connect to zookeeper

Hi,
I'm faceing  a problem when i'm working with cluster zookeper and one of
the cluser servers is down:
when *zk01:2181 *is down the following code will fail:

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

it is not as mention
"If establishment of the connection fails, another server in the connect
string will be tried"


please help me to find out how to start ZkClient when one of the zk servers
is down

Thanks,
Yosef

Re: fail connect to zookeeper

Posted by nileader <ni...@gmail.com>.
So,now,what's the problem. @Yosef Arraf

Maybe https://issues.apache.org/jira/browse/ZOOKEEPER-1480, the issue will
help you

*
*



2012/6/18 fuyou001 <fu...@gmail.com>

> 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)
>
>
>   check the zk01t  host is normal ,you can ping zk01t for test
>
> --
> View this message in context:
> http://zookeeper-user.578899.n2.nabble.com/fail-connect-to-zookeeper-tp7572649p7577589.html
> Sent from the zookeeper-user mailing list archive at Nabble.com.
>

Re: fail connect to zookeeper

Posted by fuyou001 <fu...@gmail.com>.
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) 


  check the zk01t  host is normal ,you can ping zk01t for test

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

Re: fail connect to zookeeper

Posted by yosefarr <yo...@gmail.com>.
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.

Re: fail connect to zookeeper

Posted by Marshall McMullen <ma...@gmail.com>.
You've specified the same server twice in that list -- zk01:2181 and
zk01:2181 again.

But to answer your question, yes, ZK C code will try all the servers in the
provided list while connecting.

On Tue, May 22, 2012 at 10:07 PM, Yosef Arraf <yo...@gmail.com> wrote:

> Hi,
> I'm faceing  a problem when i'm working with cluster zookeper and one of
> the cluser servers is down:
> when *zk01:2181 *is down the following code will fail:
>
> String servers = "*zk01:2181*,*zk01:2181*";
> _zkclient = new ZkClient(servers, 4000, connectionTimeout, new
> BytesPushThroughSerializer());
>
> it is not as mention
> "If establishment of the connection fails, another server in the connect
> string will be tried"
>
>
> please help me to find out how to start ZkClient when one of the zk servers
> is down
>
> Thanks,
> Yosef
>