The easiest way is via accessing directly Zookeeper - as you don't need to know a priori the list of Masters; if you do, however, hitting any one of them will redirect (302) to the current Leader.
If you would like to see an example of how to retrieve that info from ZK, I have written about it here[0]. Finally, we're planning to make all this available via the Mesos Commons[1] library (currently, there is a PR[2] waiting to be be merged). [0] http://codetrips.com/2015/08/16/apache-mesos-leader-master-discovery-using-zookeeper-part-2/ [1] https://github.com/mesos/commons [2] https://github.com/mesos/commons/pull/2/files *Marco Massenzio* *Distributed Systems Engineerhttp://codetrips.com <http://codetrips.com>* On Mon, Aug 31, 2015 at 10:25 AM, Philip Weaver <[email protected]> wrote: > My framework knows the list of zookeeper hosts and the list of mesos > master hosts. > > I can think of a few ways for the framework to figure out which host is > the current master. What would be the best? Should I check in zookeeper > directly? Does the mesos library expose an interface to discover the master > from zookeeper or otherwise? Should I just try each possible master until > one responds? > > Apologies if this is already well documented, but I wasn't able to find > it. Thanks! > > - Philip > >

