解决 Mesos 领导大师 [英] Resolving the Mesos Leading Master
问题描述
我们使用 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.
我搜索了 Mesos 的 Zookeeper 文件,但只找到了少量主机信息,例如 IP 地址.有没有什么办法,通过Mesos CLI、Zookeeper CLI等找到Mesos Leadership 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
本身使用的方法来确定 Leading Master
使用 Zookeeper
通讯.
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:
这是使用 CLI
的示例代码:
Here's an example code using CLI
:
或者,您可以使用 Mesos-CLI
中的命令 resolve
返回 host/port
对于当前的 Leading Master
,它使用位于 Mesos
核心中的 Mesos-Resolve
代码:
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 领导大师的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!