Setup Standalone Mesos on Ubuntu

For those that are unfamiliar with Mesos I would encourage you to begin by reading the information on the Apache Mesos project site. At a high level Mesos is a cluster management platform that combines servers into a shared pool from which applications or frameworks like Hadoop, Jenkins, Cassandra, ElasticSearch, and others can draw. Mesos efficiently manages workload distribution and provides resource isolation for batch jobs and long-running services. A full list of applications or frameworks built on Mesos can be found on the Mesos documentation site.

In addition to Mesos the Mesosphere Marathon framework and Apache ZooKeeper service will be installed. Marathon is a Mesos framework for long-running services such as web applications. Learn more on the Mesosphere Marathon site. Zookeeper is a centralized service for maintaining configuration information and synchronization across distributed systems. Check out the Apache Zookeeper project site for more details.

In this first post all of the roles and services will be hosted on a Ubuntu 14.04.1 server.

Build an Ubuntu Server

The Ubuntu 14.04.1 LTS Server will be built using the VM Template created in this post.

  1. Launch a Web browser and login to the vSphere Web Client.
  2. From the vCenter Home page click on "VMs and Templates."
  3. Right-click on the "Ubuntu 14.04.1 LTS Server 64-bit" VM template and select "Deploy VM from this Template."
  4. Enter a name (I used "mesos-01"), select a location for the new virtual machine, and click "Next."
  5. Select an ESXi host or cluster to run the VM and click "Next."
  6. Select a datastore for the VM and its configuration files and click "Next."
  7. Enable "Customize the operating system" and click "Next."
  8. Create a new Specification to set a custom hostname and domain name. 1. Select the Specification and click "Next."
  9. Enter a NetBIOS name (I used "mesos-01") and click "Next."
  10. Review the summary screen describing the selections you made and once satisfied click "Finish."
  11. Depending on the ESXi host's available resources the build process make take 1 or more minutes to complete.
  12. Right-click your newly created VM and select "Power On."
  13. Right-click the mesos-01 VM and select "Open Console."
  14. Login with the credentials used during the server installation process.
  15. I haven't been able to figure out why, but the first time the system boots it doesn't apply the custom hostname and domain name configured during VM build. To resolve this reboot the system:
    $ sudo reboot

Mesosphere Repository

Mesos, Marathon, and Zookeeper can all be built from source but to speed up the process we will use packages built and hosted by Mesosphere. Start by updating the ubuntu server with the Mesosphere Repository information.

  1. Right-click the mesos-01 VM and select "Open Console."
  2. Login with the credentials used during the server installation process.
  3. Import the Mesosphere Archive Automatic Signing Key:
    $ sudo apt-key adv --keyserver --recv E56151BF
  4. Add the Mesosphere Ubuntu 14.04 Repo:
    $ DISTRO=$(lsb_release -is | tr '[:upper:]' '[:lower:]') $ CODENAME=$(lsb_release -cs) $ echo "deb${DISTRO} ${CODENAME} main" | \ sudo tee /etc/apt/sources.list.d/mesosphere.list
  5. Download package lists and information of latest versions:
    $ sudo apt-get -y update

Mesos and Marathon

A Mesos cluster needs at least one Mesos Master and one Mesos Slave. The Mesos Master coordinates and dispatch tasks onto the Mesos Slaves which run the jobs. In production clusters you typically run Mesos in High Availability (HA) Mode with three or more Mesos Masters, three or more Zookeepers, and many Mesos Slaves.

You should be able to access the Mesos web interface on port 5050 of your server and Marathon at port 8080. For example, if the IP address of the server is then access the Mesos web UI at The Marathon web UI is The master web console will show the number of active slaves as 1 and the registered Marathon framework. Take a few seconds to navigate around the interface to see what information is available.

Execute a Task with mesos-execute

To verify the Mesos Master and Slave are functioning we can run a task. Mesos provides mesos-exec which you can use to launch a job. The task will be scheduled by the master and executed by the slave once.

$ mesos-execute --master="localhost:5050" --name="test-exec" --command="sleep 10"

You should be able to view the completed task in the Mesos Master web console. Select Framework and click on the ID of a task listed under “Terminated Frameworks.”

Note: If you receive an error message similar to this:

Ignoring framework registered message because it was sent from 'master@' instead of the leading master 'master@'

change the command to launch the test job to:

$ mesos-execute --master="" --name="test-exec" --command="sleep 10"

Start an Application with Marathon

You can also deploy an application from the Marathon web console. By using Marathon the application, in this case a sleep command, will be registered to be perpetual rather than simply executing once like the previous mesos-execute example.

  1. Access the Marathon web console using your web browser on port 8080. In my home lab this node’s Marathon web console is access via
  2. In the top right-hand corner click the green “New App” button.
  3. At a minimum you need to complete the ID and Command fields. The ID must be a unique value in this cluster.
  4. Enter “sleep-exec” as the ID and “sleep 10” for the command.
  5. Click the “Create” button at the bottom of the dialog window.

The Marathon web console will show the application we just created. While the task is running it Instance count will show 1/1. When the task exits it will display 0/1. Marathon will detect that the task isn’t running and will ask the master to schedule the task again. The master finds a slave to run the task (in our case there is only one slave) and ask the slave to run it.

If you click the application you can see the associated tasks and configuration. If you click the “Suspend” button you will be prompted to drop the Instance count to 0. If you click the “Scale” button you can increase the Instance count to 1 or more.

If you switch back to the Mesos web console you’ll see Marathon listed as active framework by clicking the “Frameworks” menu option. If you click the ID of the Marathon framework the list of active and completed tasks is displayed. If 30 or more seconds has elapsed since the application was started you will see a number of sleep tasks that have already completed.

There is also a REST API available for Marathon which you can read more about on the Marathon Documentation site.


The goal of this post was to walk through the process of building an single Ubuntu Server with Apache Mesos, Apache Zookeeper, and Mesosphere Marathon. While this setup is fine for testing in a home lab to go into production you need a high availability deployment with multiple Zookeepers, Masters, and Slaves. In a future post I’ll build a multi-node cluster and eventually a load-balanced HA cluster.