Just not to forget,
you can use the native Zookeeper API but in that case you should be aware that 
detecting the leader is a bit tricky. You ask for getPath(“/mesos/“ , true) and 
then you iterate over the children again calling getPath(). The string object 
returned contains some timestamps and a string mesos@ip:5050*ip … this will 
return you the masters but not the leader. In order to discover the leader you 
should use the number after the first - on the string you will see(timestamp) 
and the smaller number is actually the leader.If I have understood correctly. 
You can check the equivalent code in apache mesos where this prefix is added in 
case the request for registration in the zookeeper takes place.Again it looks 
for string index of (mesos@).

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