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
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:
Here's an example code using CLI:
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: