can you explain a bit more what you mean by "The  zookeeper-client
process on standby which uses the same clientid to initialize a
session with zookeeper." ? if i understand correctly, you are going to
have two clients using the same session which cannot happen. do you
only reuse the clientid when the takeover occurs (the other node stops
using the session)?

when the session expires, the ephemeral nodes will get deleted. if
your standby system reconnects to zookeeper with the clientid, the
session will not expire and the ephemeral nodes will stay active.

ben

On Wed, Jan 27, 2021 at 3:20 AM Dipti Mulay <[email protected]> wrote:
>
> Hi Flavio,
>
> Thanks for your inputs let me say what I am trying to do:
>
> I have an active- standby system, each of these system is running on its own 
> VM.
>
> The zookpeeper client process which communicates with ZK is running even on 
> the stanby system. The active system creates a session with ZK  and also 
> creates a ephemeral node, I use the zoo_client_id() call to get the 
> clientId_t information.
> The active system then passes on this ClientID_t to standby system( this is 
> done by a memory shadow mechanism we have). The  zookeeper-client process on 
> standby which uses the same clientid to initialize a session with zookeeper.
>
> Now after some time I turn of the active VM. On the stanby I see logs which 
> tell me a socket error happened and I get a session expired event upon which 
> I close the zookeeper session.  Does the session expire even also mean that 
> my ephemeral is now gone? The standard error handling in my code is that when 
> a session expired event is received I call zookeeper_close() which will 
> surely remove the ephemeral node.
> Is there a way to preserve the ephemeral node and re-connect the session ?
>
> Thanks
> -Parag
> P.S: I hope I have clearly explained the problem
>
> On 1/26/21, 8:17 PM, "Flavio Junqueira" <[email protected]> wrote:
>
>     Hi Parag,
>
>     Typically, the application knows the path of the znode that it wants to 
> check. Knowing the path, you can, for example, check the znode metadata, 
> which includes the session id indicating the owner in the case of an 
> ephemeral znode.
>
>     -Flavio
>
>     > On 26 Jan 2021, at 03:07, Dipti Mulay <[email protected]> wrote:
>     >
>     > Hi All,
>     >
>     > I had a question regarding ephemeral nodes. Given a particular 
> client_id can zookeeper return me the ephemeral node corresponding to the 
> provided client_id?
>     > I am using the C Client Library and I could not find a way ?
>     >
>     > Any suggestions ?
>     >
>     > Thanks
>     > -Parag
>

Reply via email to