如何在一个 mesos 从节点上 运行 多个 docker 容器?

How to run multiple docker container on one mesos slave node?

我有 3 个 mesos 主节点和 87 个 mesos 从节点。所有节点的操作系统都是 Ubuntu 14.04。在每个 mesos 从节点上,我都安装了 docker。我有两个不同的爬虫,每个都构建到一个 docker 容器中。现在我通过马拉松启动它们。

在mesos slave节点上,我没有发现两个爬虫容器运行ning在同一个节点上。每个节点只运行宁一个爬虫。

但是我希望每个节点运行同时是两个爬虫容器。我该怎么做? (原谅我糟糕的英语语法)。

下面的代码是马拉松式的启动json。

    {
  "container": {
    "type": "DOCKER",
    "docker": {
      "image": "slyang/final_crawlerv19"
    }
  },
  "id": "crawler-part",
  "instances": "30",
  "cpus": "0.5",
  "mem": "150",
  "uris": [],
  "constraints": [["hostname", "UNIQUE"]],
  "cmd": "ip=`wget http://ip.lustfield.net/ -O - -q`;echo $ip; sleep 20; echo $ip > /app/hostip;python user_info_fetcher.py part"
}

现在,您必须将两个容器打包成一个映像,以便 Marathon 在同一节点上一起启动它们。否则,您需要的是类似 Kubernetes "pod" 的构造,这在 Marathon 中尚不存在。参见 https://github.com/mesosphere/marathon/issues/894

当您想要在容器之间共享卷或其他资源时,就会出现额外的技巧。