How does Zookeeper Server handles ephemeral nodes? Or how does Zookeeper Server know if the client is disconnected?

As we all know that server creates the ephermal node inside the /servers node. So client can track the list of up and running servers.

Now, if any server is going down for any reason or power down (Which may not be graceful power down) then the deletion of ephermal node how is it handled ?

Means there is a handler kind of code on zookeeper servers where any fault occurs then inside the fault handler it will delete the ephermal node and stop the server ???

Thank you Keval. It is a very good question.

To keep an ephemeral node alive the client who is creator of the node needs to keep sending a ping (or a signal) to the server that the client is up and connected.

If the client (or creator) fails to keep informing the zookeeper server, the ephemeral node is deleted.

I hope this clears it.

1 Like