Setup Standalone Mesos on Ubuntu


In this blog, I will walk you through setting up a standalone Apache Mesos and Marathon in ubuntu. Standalone installation means, running Mesos master, Mesos slave and Marathon on one machine. In this blog, we are going to install this mesos cluster on OpenStack VM. Even you can try on your local machine if you system running Ubuntu Operating System.

Introduction

Mesos is a scalable and distributed resource manager designed to manage resources for data centers.

Mesos can be thought of as “distributed kernel” that achieves resource sharing via APIs in various languages (C++, Python, Go, etc.) Mesos relies on cgroups to do process isolation on top of distributed file systems (e.g., HDFS). Using Mesos you can create and run clusters running heterogeneous tasks. Let us see what it is all about and some fundamentals on getting Mesos up and running.

Note: Even you can try DC/OS is an entirely open source software project based on Apache Mesos, Marathon and a whole lot more.

1. Add the Mesosphere Repositories to your Hosts

First, add the Mesosphere repository to your sources list. This process involves downloading the Mesosphere project’s key from the Ubuntu keyserver and then crafting the correct URL for our Ubuntu release. The project provides a convenient way of doing this:

$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv E56151BF
$ DISTRO=$(lsb_release -is | tr '[:upper:]' '[:lower:]')
$ CODENAME=$(lsb_release -cs)
$ echo "deb http://repos.mesosphere.io/${DISTRO} ${CODENAME} main" | sudo tee /etc/apt/sources.list.d/mesosphere.list

2. Download package lists and information of latest versions:

$ sudo apt-get -y update

3. Install 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.

We will install Marathon and mesos meta package which also pulls in zookeeper as a dependency.

$ sudo apt-get -y install mesos marathon

4. Reboot the system:

$ sudo reboot

After the packages are downloaded and installed all of the Mesos and Marathon dependencies and startup scripts are ready for use on a single node cluster, including Apache ZooKeeper.

5. Mesos Web interface:

You should be able to access the Mesos web interface on port 5050 of your VM. For example, if the IP address of the VM is 192.168.0.131 then access the Mesos web UI at http://192.168.0.131:5050/. In case, if you have installed on your local system. Then you can access Mesos web UI on 127.0.0.1:5050. 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.

scalable-jenkins

6. Marathon Web interface:

The Marathon web UI will be accessible at http://192.168.0.131:8080.

rsz_marathon

From here, you can click on the “Create” button in the upper-left corner. This will pop up an overlay where you can add information about your new application:

marathon_new_app

Fill in the fields with the requirements for your app. The only fields that are mandatory are:

  • ID: A unique ID selected by the user to identify a process. This can be whatever you’d like, but must be unique.
  • Command: This is the actual command that will be run by Marathon. This is the process that will be monitored and restarted if it fails.

Using this information, you can set up a simple service that just prints “hello” and sleeps for 10 seconds. We will call this “hello”:

simple_app

When you return to the interface, the service will go from “Deploying” to “Running”:

running