1
votes

I have 3 mesos master nodes, and 87 mesos slave nodes. All the node's Operating System are Ubuntu 14.04. On each mesos slave node, I have installed docker. I have two different crawlers, each of them are build into a docker container. Now I launch them via marathon.

On mesos slave node, I didn't find the two crawler container running on the same node. each node only running one crawler.

But I want each node run the two crawler container at same time. How can I do it? (forgive my poor English grammer).

The following code is marathon launch 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"
}
1
I'm confused. Why are you using hostname UNIQUE? Why are you only showing one marathon job config? It's hard to debug this without more info. - seanmcl
@seanmcl I'm new to marathon. I guess constraints field caused the issue, but I don't know how to set it. The other marathon job config is as the same, except for it's id and image field. - Bruce Yang
The hostname=UNIQUE constraint will tell Marathon to only run one instance of that app per hostname. Assuming that each slave has a different hostname, and you have two different Marathon app definitions, this constraint should not be preventing an App1 container from being colocated with an App2 container. - Adam

1 Answers

4
votes

For now, you'll have to package the two containers together into one image so that Marathon launches them together on the same node. Otherwise, you're asking for a Kubernetes "pod"-like construct, which doesn't exist yet in Marathon. See https://github.com/mesosphere/marathon/issues/894

The additional trickiness comes in when you want to share volumes or other resources between the containers.