Sauchin
Sauchin

Reputation: 333

Zookeeper to check external resource availability

I have a Spring application deployed on cluster of Tomcat servers with Oracle Database and JMS server (Tibco EMS) as external resources.

I have a non functional requirement to check if DB and JMS servers are available and inform tomcat cluster when they go down. (Heartbeat management)

Is Zookeeper a good fit for this requirement? I can have ephemeral znodes created for those resources and when they are unavailable / diconnected, those nodes will get deleted from zookeeper. Any watcher on those znodes can then get informed about the unavailability of those external resources.

Is this use case generally handled using zookeeper? If yes, who would create those znodes in zookeeper for DB and JMS servers?

Is there any recipe in zookeeper or in Apache curator for handling external resources status requirement?

If Zookeeper is not a good fit for managing external resources status, how is the heartbeat requirement for such external resources usually managed?

Upvotes: 2

Views: 713

Answers (1)

igorbel
igorbel

Reputation: 1396

Yes, this could be a good case to solve with the help of ZooKeeper. Your applications would indeed watch the part of the ZK data tree that has the ephemeral nodes, and would be able to react if any of them are not there/go down.

The problem you will have is that your external resources, such as DB and JMS servers you mentioned, have to first publish their ephemeral node to ZK. This is hard if they are third party applications that you cannot easily extend to add the necessary ZK code. ZK will not do this out of the box.

Common recipe in this case is to create an agent/supervisor application running on the same hosts as your external services, which monitor the target process and do the ZK communication part (publish the ephemeral node and keep the ZK connection alive, including the heartbeats that are part of the ZK protocol).

I would suggest using Curator, and possibly some of the curator service discovery recipes. However, it is highly likely you would not have the required functionality out of the box, and will need to write at least some code that would monitor/supervise your DB servers and do the required ZK behaviour.

Upvotes: 2

Related Questions