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 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:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With