Hi Donald, the information stored in the Zookeeper znode is a serialized Protocol Buffer (see MasterInfo in mesos/mesos.proto <https://git-wip-us.apache.org/repos/asf?p=mesos.git;a=blob;f=include/mesos/mesos.proto;h=3dd4a5b7a4b3bc56bdc690d6adf05f88c0d28273;hb=HEAD>); here is a brief explanation of what is in there, plus an example as to how to retrieve that info (in Python - but Java would work pretty much the same): http://codetrips.com/2015/06/12/apache-mesos-leader-master-discovery-using-zookeeper/
Please be aware that, as of 0.24 (currently planned for mid-August), we plan to publish that information *only* in JSON (exactly to help all the folks like you) so the method presented there will no longer work (for all intents and purposes, the serialized MasterInfo to ZK is considered "deprecated" as of 0.23 which is going out any day now: we're currently testing a RC). Note that if you intend to "follow" the leader you will need to set a "Watcher" on the node itself or, perhaps better, on the znode path, so as to get a callback whenever anything changes: the elected leader will always be the lowest-numbered ephemeral znode (I am guessing you know all this, but feel free to ping me if you need more info). Hope this helps. *Marco Massenzio* *Distributed Systems Engineer* On Tue, Jul 7, 2015 at 6:02 AM, 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

