We're using Mesos to run jobs on a cluster. We're using haproxy to point, e.g., mesos.seanmcl.com
to a Mesos Master.
If that Master happens to not be the leader, the UI will redirect the browser, after a delay, to the leader so you can see the running jobs. For various reasons (UI speed, avoiding ports blocked by a firewall), I'd really like to programmatically discover the host with the leader. I can not figure out how to do this.
I grepped around in the Zookeeper files for Mesos, but only found small bits of host information like the IP address. Is there any way, via Mesos CLI, Zookeeper CLI, etc. to find the Mesos Leading Master?
You can use the approach used by
Mesos
itself to determine theLeading Master
usingZookeeper
communications.The idea is to use the membership labels in
Zookeeper
communications to determine theLeading Master
, cache it and use it for the subsequent requests. Check the following links for the implementation:Here's an example code using
CLI
:Edit: Alternatively you can use the command
resolve
inMesos-CLI
which returns thehost/port
for the currentLeading Master
which usesMesos-Resolve
code located in theMesos
core: