@Nikolaos Ballas neXus I can see no way to instantiate the Curator LeaderSelector without actually becoming a participant in leader election. If I do instantiate that class, it does not accept a null value for the LeaderSelectorListener and so anything instantiating LeaderSelector must also become a participant.
Even then, that class provides no way to listen for leadership change. The only listening it does is to discover when it itself becomes the leader. I suppose it would be possible to participate in the leadership election, but immediately relinquish leadership causing a real mesos master to become the leader, but that seems a little too invasive to do. The only solution I can see is to monitor the children of the mesos leader node, and parse through the contents of the ones whose name begins with “info” as per @Marco Massenzio. Best regards, -Don > On Jul 7, 2015, at 12:16 PM, Donald Laidlaw <[email protected]> wrote: > > Thank you all. > > I will use the Curator recipe, since I already use Curator for a bunch of > other things. > > If curator can find the leader and the participants that is good enough. > Otherwise I will parse the protocol buffer contents, and provide a way to > parse the future son contents when that happens. > > I’ll reply again with the results of using the Curator recipe to get the > leader and participants. > > Best regards, > -Don > >> On Jul 7, 2015, at 11:04 AM, Dick Davies <[email protected]> wrote: >> >> The active master has a flag set in /metrics/snapshot : >> "master/elected" which is 1 for the active >> master and 0 otherwise, so it's easy enough to only load the metrics >> from the active master. >> >> (I use the collectd plugin and push data rather than poll, but the >> same principle should apply). >> >> On 7 July 2015 at 14:02, Donald Laidlaw <[email protected]> wrote: >>> Has anyone ever developed Java code to detect the mesos masters and leader, >>> given a zookeeper connection? >>> >>> The reason I ask is because I would like to monitor mesos to report various >>> metrics reported by the master. This requires detecting and tracking the >>> leading master to query its /metrics/snapshot REST endpoint. >>> >>> Thanks, >>> -Don >

