Zookeeper (Curator framework) : explicitly giving up the leaderLatch

446 Views Asked by At

Background

I have a web-socket consumer running on 1 of my backend servers. To keep this system HA, i want to keep 2 more standby machines in the setup. Expectation is -> 1 of the standby VM should takeover the role of my primary webs-socket consumer, in either of the below scenarios.

  1. Primary web-socket consumer going down
  2. Primary web-socket consumer voluntarily giving up the leadership due to some in-built health-checks failing on it.

Question

Was wondering if there is an out of the box zookeeper recipe for powering this setup. Initially i tried using 'LeaderLatch' as the prefererred recipe. But a Leader Latche doesn't allows the construct to voluntarily give up the leadership. (Scenario number 2 mentioned above).

What would be the best suited Curator/Zk recipe for the above scenario. Any example/guidance appreciated.

Thanks

0

There are 0 best solutions below