As a beginner using zookeeper I was wondering if anyone could help me understand how the java ZooKeeper client handles a permanent disconnect from the cluster. I'm curious because as I read the FAQ we can get a Session expiration if we ever connect to the server but I'm not sure what to do if I can never connect again.

Is there a different exception thrown after a the client has detected permanent failure?

So, client will never be able to reach the server again? The client thatyou use (and we generally recommend you use an existing client library likeCurator or even zkClient instead of writing your own) should have some sortof timeout configured so that if it gets disconnected and can't reach theserver within some period of time it gives up.

Camille,I'm trying to figure out what timeout you're referring to? I'm using zkClient that ships with ZooKeeper and the only timeout I can see to configure is the "session timeout." Does this timeout work even if you never hear back from any server?

There is a connect timeout set automatically in the client based on thesession timeout divided by the number of servers in the cluster. You willsee a SessionTimeout exception if you exceed this connect timeout withoutsuccessfully connecting to one of the servers.I would recommend using a higher-level client than the one that ships withZooKeeper, or else you have to build all of this in.Even if you want to build your own, it would probably be useful reading thedocumentation for something like Curator, which explains the choices thatclient made to do this:http://curator.apache.org/curator-client/index.html

Yes, this is a great point. I'm definitely not trying to predict the future, only trying to react in the case of an inconsistent cluster and cover the pathological cases where ZooKeeper itself is down. The code will also rejoin the cluster if it reappears.

Curator's Framework and Client utils seem like the right tool. My only hesitency initially was poor Scala integration, but a thin shim ought to be good enough.

I'm definitely not trying to predict the future, only trying to react in the case of an inconsistent cluster and cover the pathological cases where ZooKeeper itself is down. The code will also rejoin the cluster if it reappears. This is what Curator attempts to do. It provides a framework for managing the underlying ZooKeeper connection. You can then write recipes (and Curator comes with many) that take advantage of connection management. There are a bunch of folks using it from Scala (and Clojure for that matter). So, there should be plenty of examples.

Yes, this is a great point. I'm definitely not trying to predict the future, only trying to react in the case of an inconsistent cluster and cover the pathological cases where ZooKeeper itself is down. The code will also rejoin the cluster if it reappears.

Curator's Framework and Client utils seem like the right tool. My only hesitency initially was poor Scala integration, but a thin shim ought to be good enough.

Thanks again Camille & Henry, Dan

On Mon 24 Mar 2014 11:06:55 AM MDT, Henry Robinson wrote:

Dan Hopkins | Programmer e: [EMAIL PROTECTED]

Be Victorious

+

Jordan Zimmerman 2014-03-24, 17:57

NEW: Monitor These Apps!

All projects made searchable here are trademarks of the Apache Software Foundation.
Service operated by Sematext