Quantcast

zookeeper discussion on watches.

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

zookeeper discussion on watches.

sunil singh
Hi guys... m working on zookeeper and its really difficult to find something precise on watches.
So lets start on discussion on watches from beginning so that all the developer around the world get help and share their experience.
Q.1) how to set watch on a znode so that clients are notified when the data of the znode changes.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: zookeeper discussion on watches.

Harsh J
Hi Sunil,

Have you gone over the developer's guide docs on the website:
http://zookeeper.apache.org/doc/trunk/zookeeperProgrammers.html#ch_zkWatches?
It is pretty simple to use watches and the text on that page should
almost be all you need to use it.

Also, the zkCli.sh CLI program does show how to set a watch when you
type "help" on it:

> get path [watch]

So for example, if you want to set a watch from the CLI on the znode
/hbase/master, you may do:

> get /hbase/master true

(The new CLI format on trunk is to do as "get -w /hbase/master"
instead. But the above should work and warn even if you are on trunk
today.)

Then if "printwatches" is on (it is on by default), you should be able
to see any changes made to that znode by other processes.

For instance, if I deleted the node via a "delete /hbase/master", I'd
see this on the shell:

WATCHER::

WatchedEvent state:SyncConnected type:NodeDeleted path:/hbase/hbaseid

Hope this helps!

On Tue, Aug 21, 2012 at 1:19 PM, sunil singh <[hidden email]> wrote:

> Hi guys... m working on zookeeper and its really difficult to find something
> precise on watches.
> So lets start on discussion on watches from beginning so that all the
> developer around the world get help and share their experience.
> Q.1) how to set watch on a znode so that clients are notified when the data
> of the znode changes.
>
>
>
> --
> View this message in context: http://zookeeper-user.578899.n2.nabble.com/zookeeper-discussion-on-watches-tp7577815.html
> Sent from the zookeeper-user mailing list archive at Nabble.com.



--
Harsh J
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: zookeeper discussion on watches.

Ankur C. Goel
In addition to what Sunil said, you might also want to take a look at
Curator (https://github.com/Netflix/curator/wiki) which is wrapper library
over zookeeper. It exposes modern APIs, has very nice features and all the
zookeeper recipes OOB.

Thanks
-@nkur

On 8/21/12 2:31 AM, "Harsh J" <[hidden email]> wrote:

>Hi Sunil,
>
>Have you gone over the developer's guide docs on the website:
>http://zookeeper.apache.org/doc/trunk/zookeeperProgrammers.html#ch_zkWatch
>es?
>It is pretty simple to use watches and the text on that page should
>almost be all you need to use it.
>
>Also, the zkCli.sh CLI program does show how to set a watch when you
>type "help" on it:
>
>> get path [watch]
>
>So for example, if you want to set a watch from the CLI on the znode
>/hbase/master, you may do:
>
>> get /hbase/master true
>
>(The new CLI format on trunk is to do as "get -w /hbase/master"
>instead. But the above should work and warn even if you are on trunk
>today.)
>
>Then if "printwatches" is on (it is on by default), you should be able
>to see any changes made to that znode by other processes.
>
>For instance, if I deleted the node via a "delete /hbase/master", I'd
>see this on the shell:
>
>WATCHER::
>
>WatchedEvent state:SyncConnected type:NodeDeleted path:/hbase/hbaseid
>
>Hope this helps!
>
>On Tue, Aug 21, 2012 at 1:19 PM, sunil singh <[hidden email]>
>wrote:
>> Hi guys... m working on zookeeper and its really difficult to find
>>something
>> precise on watches.
>> So lets start on discussion on watches from beginning so that all the
>> developer around the world get help and share their experience.
>> Q.1) how to set watch on a znode so that clients are notified when the
>>data
>> of the znode changes.
>>
>>
>>
>> --
>> View this message in context:
>>http://zookeeper-user.578899.n2.nabble.com/zookeeper-discussion-on-watche
>>s-tp7577815.html
>> Sent from the zookeeper-user mailing list archive at Nabble.com.
>
>
>
>--
>Harsh J

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: zookeeper discussion on watches.

sunil singh
This post has NOT been accepted by the mailing list yet.

Thanks alot Ankur, it worked. I have been given 3 systems in which i have created 1server and 2clients. Server is leader.
I have created various znode and with your help now i am able to set watches. I am using java to do programming stuffs on zookeeper.
I have to change the value of znode from leader, do i have to program it or i can do it from cli.
If so put some light on it.

Regards,
Sunil singh


From: Ankur C. Goel [via zookeeper-user] <[hidden email]>
To: sunil singh <[hidden email]>
Sent: Wednesday, August 22, 2012 1:53 AM
Subject: Re: zookeeper discussion on watches.

In addition to what Sunil said, you might also want to take a look at
Curator (https://github.com/Netflix/curator/wiki) which is wrapper library
over zookeeper. It exposes modern APIs, has very nice features and all the
zookeeper recipes OOB.

Thanks
-@nkur

On 8/21/12 2:31 AM, "Harsh J" <[hidden email]> wrote:

>Hi Sunil,
>
>Have you gone over the developer's guide docs on the website:
>http://zookeeper.apache.org/doc/trunk/zookeeperProgrammers.html#ch_zkWatch
>es?
>It is pretty simple to use watches and the text on that page should
>almost be all you need to use it.
>
>Also, the zkCli.sh CLI program does show how to set a watch when you
>type "help" on it:
>
>> get path [watch]
>
>So for example, if you want to set a watch from the CLI on the znode
>/hbase/master, you may do:
>
>> get /hbase/master true
>
>(The new CLI format on trunk is to do as "get -w /hbase/master"
>instead. But the above should work and warn even if you are on trunk
>today.)
>
>Then if "printwatches" is on (it is on by default), you should be able
>to see any changes made to that znode by other processes.
>
>For instance, if I deleted the node via a "delete /hbase/master", I'd
>see this on the shell:
>
>WATCHER::
>
>WatchedEvent state:SyncConnected type:NodeDeleted path:/hbase/hbaseid
>
>Hope this helps!
>
>On Tue, Aug 21, 2012 at 1:19 PM, sunil singh <[hidden email]>
>wrote:
>> Hi guys... m working on zookeeper and its really difficult to find
>>something
>> precise on watches.
>> So lets start on discussion on watches from beginning so that all the
>> developer around the world get help and share their experience.
>> Q.1) how to set watch on a znode so that clients are notified when the
>>data
>> of the znode changes.
>>
>>
>>
>> --
>> View this message in context:
>>http://zookeeper-user.578899.n2.nabble.com/zookeeper-discussion-on-watche
>>s-tp7577815.html
>> Sent from the zookeeper-user mailing list archive at Nabble.com.
>
>
>
>--
>Harsh J



If you reply to this email, your message will be added to the discussion below:
http://zookeeper-user.578899.n2.nabble.com/zookeeper-discussion-on-watches-tp7577815p7577820.html
To unsubscribe from zookeeper discussion on watches., click here.
NAML


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: zookeeper discussion on watches.

sunil singh
In reply to this post by Harsh J
Thanks alot Harsh.
It is working fine.
Now i have to go on programming side with java to do experiments with zookeeper.
I have been given 3 Remote Systems and i have installed zookeeper on 1system as a server and on other 2 as a clients. From clients i have created various znodes with children.
Now i have to write a simple java program to fetch data from znode.
Please help me this.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: zookeeper discussion on watches.

Harsh J
Hi Sunil,

I'm repeating myself here, but you do have all you need in here:
http://zookeeper.apache.org/doc/current/zookeeperProgrammers.html. A
java example can also be found here:
http://zookeeper.apache.org/doc/current/javaExample.html. I am not
sure what it is you cannot find on there.

On Wed, Aug 22, 2012 at 10:37 AM, sunil singh <[hidden email]> wrote:

> Thanks alot Harsh.
> It is working fine.
> Now i have to go on programming side with java to do experiments with
> zookeeper.
> I have been given 3 Remote Systems and i have installed zookeeper on 1system
> as a server and on other 2 as a clients. From clients i have created various
> znodes with children.
> Now i have to write a simple java program to fetch data from znode.
> Please help me this.
>
>
>
>
>
> --
> View this message in context: http://zookeeper-user.578899.n2.nabble.com/zookeeper-discussion-on-watches-tp7577815p7577831.html
> Sent from the zookeeper-user mailing list archive at Nabble.com.



--
Harsh J
Loading...