How to run stateful applications in Apache Mesos?


How can stateful containers be run inside Mesos?

According to the Mesos documentation sandbox can be used to store state:

With the introduction of persistent volumes, executors and tasks should never create files outside of the sandbox.

At the same time Sandbox files are scheduled for garbage collection when:

  • An executor is removed or terminated.
  • A framework is removed.
  • An executor is recovered unsuccessfully during agent recovery.

Is this the only way? Or can docker containers be used to maintain state (in a similar manner to a VM)?

So for example, can a container be created and run across 2 nodes? Can such a container contain state and not be disposed of after the task is completed?

By : embedded


The key statement in that quote from the Mesos documentation is

With the introduction of persistent volumes...

You're correct that sandboxes can be garbage collected. However, Mesos provides a primitive called persistent volumes which allows you to create volumes that will persist across task failures and agent restarts and will not be garbage collected.

Additionally, Mesos also now provides support for network storage via the Docker volume isolator. This allows you to mount network volumes using Docker volume drivers, which enables the use of a wide variety of storage back-ends.

Docker containers can store persistent state, but they must do so in either a Mesos persistent volume or a network-attached volume via the Docker volume isolator. These volumes live outside the Docker container and are mounted into the container, so they persist after the container has died.

Mesos tasks cannot be run across multiple nodes. Note that it would be possible for multiple tasks on different nodes to access the same network-attached volume via the Docker volume isolator, provided the back-end storage provider supports concurrent access.

Seems you forgot to add a line in your test like:

By : A.Bashkin

You can do it like following.

<script src=""></script>
<div class="medium-item-price">
  <span class="denominator">$</span>

By : Azim

This video can help you solving your question :)
By: admin