Hi Chris, Thanks for your email. Yes, you understood the question very well. I'm using the standard api in python through the zookeeper.acquire call
I was a little confused but, thanks to your email and some reading that I did after posting this question, I understood it. The client can be any machine, not just the server nodes and because of that I had got confused. Regards, Prabhjot On Fri, May 29, 2015 at 12:28 AM, Chris Nauroth <[email protected]> wrote: > Hello prabcs, > > When you mention that "all 3 nodes try to acquire the lock", does this > mean that all 3 nodes run a ZooKeeper client process that tries to acquire > a shared lock, using something like Curator or the documented locking > recipes? > > http://zookeeper.apache.org/doc/r3.4.6/recipes.html#sc_recipes_Locks > > > If so, then it doesn't matter whether the client process is co-located on > a machine running a leader or a follower. Each of the 3 nodes triggers > the script independently via cron. Therefore, the order in which these > processes start and attempt to acquire the lock is non-deterministic. The > script co-located on the leader node might win and get the lock, or the > script co-located on one of the follower nodes might win instead. > > I hope this helps. If I misunderstood the question, please let me know. > > --Chris Nauroth > > > > > On 5/28/15, 11:40 AM, "Prabhjot Bharaj" <[email protected]> wrote: > > >Hi Folks, > > > > > >I have a 3 node zookeeper cluster. While working on it, I've come to > >notice > >that sometimes that lock gets acquired by the follower and the leader is > >unable to acquire the lock. I'm able to see this clearly as per the > >script's output log. This script runs as a cron on all the 3 nodes and all > >3 nodes try to acquire the lock > > > >After my script runs on all the nodes, I can see by running echo stat | nc > >localhost 2181 on all machines that the machine which has got the lock and > >ran the script successfully is a follower and not a leader. > > > >I'm thinking that the follower should not be able to get a lock. Am I > >thinking wrong somewhere ? Please point me to the correct direction. > > > >Thanks, > > > >prabcs > > -- --------------------------------------------------------- "There are only 10 types of people in the world: Those who understand binary, and those who don't"
