问题描述
我们正在使用Mesos在集群上运行作业.我们正在使用haproxy指向例如mesos.seanmcl.com
到Mesos Master.
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.
如果该Master恰好不是领导者,则在延迟之后,UI会将浏览器重定向到领导者,以便您可以查看正在运行的作业.由于各种原因(UI速度,避免端口被防火墙阻止),我真的很想以编程方式发现带有主机的主机.我不知道该怎么做.
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.
我在Zookeeper文件中四处寻找Mesos,但只发现了少量主机信息,例如 IP地址.是否可以通过Mesos CLI,Zookeeper CLI等找到Mesos Leading Master?
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?
推荐答案
您可以使用Mesos
本身使用的方法通过Zookeeper
通信确定Leading Master
.
You can use the approach used by Mesos
itself to determine the Leading Master
using Zookeeper
communications.
这个想法是在Zookeeper
通信中使用成员资格标签来确定Leading Master
,对其进行缓存并将其用于后续请求.检查以下链接以了解实施情况:
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
下面是使用CLI
的示例代码:
Here's an example code using CLI
:
或者,您可以在Mesos-CLI
中使用命令resolve
,该命令为使用Mesos
内核中的Mesos-Resolve
代码的当前Leading Master
返回host/port
. :
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:
这篇关于解决Mesos领导大师的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!