Hi Don,
actually you can use Apache Curator, to create a connection to Zookeeper and 
then instantiate a LeaderSelector object. If you pass as path the path under 
which you mesos master nodes register for formaming an ensemble then the that 
object you can call getLeader() or getParticipants and that is a json object 
that has an attribute calls isLeader. The participant that has this set to true 
is the leader. To receive that for Marathon you must search for 
/marathon/leader again with the same notion. Also take into consideration with 
LeaderSelector you can be notified for changes of the cluster topology(failure 
of the leader and re election).

http://curator.apache.org

http://curator.apache.org/apidocs/index.html

hope it’s clear.

kind regards
Nikolaos Ballas  |  Software Development Manager

Technology Nexus S.a.r.l.
2-4 Rue Eugene Rupert
2453 Luxembourg
Delivery address: 2-3 Rue Eugene Rupert,Vertigo Polaris Building
Tel: + 3522619113580
[email protected]<mailto:[email protected]> | 
nexusgroup.com<http://www.nexusgroup.com/>
LinkedIn.com<http://www.linkedin.com/company/nexus-technology> | 
Twitter<http://www.twitter.com/technologynexus> | 
Facebook.com<https://www.facebook.com/pages/Technology-Nexus/133756470003189>


[cid:19B646FC-B8E7-4F77-BBD3-75DD7B4B5BF7]

On 07 Jul 2015, at 15:02, Donald Laidlaw 
<[email protected]<mailto:[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

Reply via email to