Resolving the Mesos Leading Master
apache-zookeeper, mesos
Solution
You can use the approach used by `Mesos` itself to determine the `Leading Master` using `Zookeeper` communications.
The idea is to use the membership labels in `Zookeeper` communications to determine the `Leading Master`, cache it and use it for the subsequent requests. Check the following links for the implementation:
- Leading Master Detector Header
- Leading Master Detector Implementation
Here's an example code using `CLI`:
- Mesos-Resolve
Edit: Alternatively you can use the command `resolve` in `Mesos-CLI` which returns the `host/port` for the current `Leading Master` which uses `Mesos-Resolve` code located in the `Mesos` core:
- Resolve Command
Problem
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?