1

I'm trying to implement a lizardfs cluster using mesos/marathon. I created some docker images for that purpose.

I need to get a docker container of a certain type (lizardfs-master) NOT run on the same node that is already running another type of container (lizardfs-shadow or lizardfs-metalogger). That is, I need to run an instance of each of these three types of containers but they must not run on the same node simultaneously. They are mutually exclusive.

I don't want to restrict the nodes that can run each container. I just want to make them exclusive.

Is there any way to accomplish this in marathon, ie, using constraints? How would it be?

Thanks.

1 Answers1

0

I could imagine that there are several approaches to this. :)

I would do the following..

Set up 3 applications, each for your specific docker image (master, shadow, metalogger). Then you could create a constraint on the app that ties the application to specific nodes:

"constraints": [["hostname", "CLUSTER", "a.specific.node.com"]]

https://github.com/mesosphere/marathon/blob/master/docs/docs/constraints.md#cluster-operator

I think you can also define multiple nodes.

I didn't test this, but it looks reasonable to me. ;)

Felix Gertz
  • 175
  • 2
  • 8
  • Ideally, my idea was not to tie docker containers to specific nodes but that marathon could "realize" that it can't run a certain container on a node that is already running some other container types. I would like a "flat" cluster where marathon, in the event that a node is broken, can decide where to run that "dead" container selecting another node that is NOT running the mutually exclusive containers :) – Marcelo Aguero Oct 15 '15 at 15:20
  • Yeah, you could additionally split your cluster into groups and then use the LIKE or UNLIKE constraint to assign your container to a node-group and mutually exclude them. – Felix Gertz Oct 15 '15 at 15:35
  • Makes sense. So I can split the cluster nodes into disjoint sets and force each mutually exclusive container to run in a different subset of nodes. Thanks! – Marcelo Aguero Oct 15 '15 at 21:44