Resolving the Mesos Leading Master

2019-02-22 23:40发布

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?

1条回答
爷的心禁止访问
2楼-- · 2019-02-23 00:24

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:

查看更多
登录 后发表回答