You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@curator.apache.org by Tejash Tarun <te...@gmail.com> on 2017/04/19 12:59:53 UTC

Query regarding service discovery

Hi,

How to use curator framework to achieve the following:

I have one instance of ResourceManager RM running which provides work to 5
Workers W[1...5].  RM and Ws are java applications.

Zookeeper is being used for service discovery and coordination of Ws.

Now, how to have a callback in RM if any of W goes down ?
Basically, Zookeeper via heartbeat via session of W can detect the
aliveness of W, however when W goes down Zookeeper knows this due to
absence of the heartbeat.

But how to get a callback in RM for the event ?

Any suggestion and help is appreciated.

Thanks !!

Re: Query regarding service discovery

Posted by 张树行 <sh...@163.com>.
Each W can register themselves as a ephemeral node, such as /alive/w1,/alive/w2….
Then put a watcher on the /alive path,  the watcher will be called back when the w(i) disappear because of the w(i) down.
You also need handle the connection loss cases and other details.

> 在 2017年4月19日,下午8:59,Tejash Tarun <te...@gmail.com> 写道:
> 
> Hi,
> 
> How to use curator framework to achieve the following:
> 
> I have one instance of ResourceManager RM running which provides work to 5 Workers W[1...5].  RM and Ws are java applications. 
> 
> Zookeeper is being used for service discovery and coordination of Ws.
> 
> Now, how to have a callback in RM if any of W goes down ?
> Basically, Zookeeper via heartbeat via session of W can detect the aliveness of W, however when W goes down Zookeeper knows this due to absence of the heartbeat.
> 
> But how to get a callback in RM for the event ?
> 
> Any suggestion and help is appreciated.
> 
> Thanks !!