【问题标题】:Problems using Marathon Constraints使用 Marathon 约束的问题
【发布时间】:2015-06-30 17:27:59
【问题描述】:

我正在运行一个 mesos + marathon 集群,到目前为止一切正常。但我不知道如何在马拉松比赛中使用约束。

我已经用属性标记了我的 mesos slave

$ cat /etc/mesos-slave/attributes/category
SERVICE

在我的容器的马拉松描述中添加了

"constraints": [["category", "CLUSTER", "SERVICE"]]

但是当我部署我的容器时,我只收到“INFO No matching offer for”,我不知道我做错了什么。

Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]: [2015-06-30 08:08:48,812] INFO No matching offer for <CONTAINER> (need cpus=0.1, mem=3072.0, disk=0.0,
ports=List(0)) : id {
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]:   value: "20150616-090516-2130907308-5050-1304-O1291851"
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]: }
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]: framework_id {
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]:   value: "20150330-112621-2130907308-5050-25763-0000"
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]: }
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]: slave_id {
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]:   value: "20150616-090516-2130907308-5050-1304-S49"
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]: }
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]: hostname: "<HOSTNAME>"
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]: resources {
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]:   name: "cpus"
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]:   type: SCALAR
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]:   scalar {
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]:     value: 0.3999999999999999
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]:   }
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]:   role: "*"
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]: }
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]: resources {
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]:   name: "mem"
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]:   type: SCALAR
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]:   scalar {
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]:     value: 4911.0
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]:   }
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]:   role: "*"
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]: }
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]: resources {
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]:   name: "disk"
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]:   type: SCALAR
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]:   scalar {
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]:     value: 14896.0
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]:   }
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]:   role: "*"
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]: }
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]: resources {
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]:   name: "ports"
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]:   type: RANGES
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]:   ranges {
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]:     range {
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]:       begin: 31003
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]:       end: 32000
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]:     }
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]:   }
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]:   role: "*"
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]: }
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]: attributes {
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]:   name: "category"
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]:   type: TEXT
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]:   text {
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]:     value: "SERVICE"
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]:   }
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]: }
Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]:  (mesosphere.mesos.TaskBuilder:47)    

我有什么遗漏吗?

【问题讨论】:

    标签: constraints mesos mesosphere marathon


    【解决方案1】:

    从日志看来,您的任务需要 mem=3072.0,但仅提供 1903.0。即使没有约束,您也应该看到相同的错误。要么减少任务的内存需求,要么增加节点上 Mesos/Marathon 的可用内存。

    【讨论】:

    • 感谢亚当的回答。我拿错了日志,我把它改成了更清晰的日志。但是您在我之前发布的日志中是对的,原因是 RAM。但除此之外,我是错过了什么还是做错了什么?
    • 如果您没有看到“优惠不满足应用程序的约束...冲突的约束是:...”日志警告,那么这不是约束匹配问题。我能想到的唯一另一件事是您要求ports=List(0) 不在31003-32000 范围内。但是,指定端口 0 应该声明任何可用端口并将其映射到 $PORT0。前面的日志行中是否还有更多相关信息?
    • Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]: [2015-06-30 08:08:48,812] WARN Offer 不满足 app [ ]。 6 月 30 日 08:08:48 ip-172-16-3-95 马拉松 [13100]:冲突的约束是:[字段:“类别”6 月 30 日 08:08:48 ip-172-16-3-95 马拉松 [13100 ]:运营商:CLUSTER Jun 30 08:08:48 ip-172-16-3-95 marathon[13100]:值:“SERVICE” Jun 30 08:08:48 ip-172-16-3-95 marathon[13100 ]: ] (mesosphere.mesos.TaskBuilder:190) 我收到了你建议的两条消息!还有其他信息可以提供给您吗?
    • 此“冲突约束”日志消息是否紧接在“无匹配报价”消息之前?因为看起来冲突的约束是“[field: "category", operator: CLUSTER, value: "SERVICE"]" 并且商品具有“属性 {name: "category", type: TEXT, text {value: "SERVICE我希望匹配的“}}”。我能想到的唯一一件事是你得到了符合约束条件的报价,但没有足够的资源;或者您收到的报价实际上与约束条件不匹配。您有多少奴隶设置了该属性?全部?只有几个?
    • 在这个集群中,我只有 5 个从节点,2 个设置了这个值。其余节点具有不同的节点。对于一个测试,我扩大到 8 个,只是为了确保我有足够的资源,但这并没有改变任何东西。我想不出我在配置中可能做错了什么。遗憾的是,关于如何在从属设备上设置属性的部分没有很好的记录(在我看来),我也找不到任何好的方法。
    猜你喜欢
    • 1970-01-01
    • 2011-07-06
    • 2021-11-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多