Resolving the Mesos Leading Master

别来无恙 提交于 2019-12-01 19:42:34

问题


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:


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


来源:https://stackoverflow.com/questions/24657253/resolving-the-mesos-leading-master

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!