Mesosphere is a distributed computer operating systems (dcos) that expands the cluster management capabilities of Apache Mesos with additional components to manage server infrastructures. In this article I will describe our experience installing and using Mesosphere on Ubuntu from scratch.

Major components of Mesosphere Includes.

  1. Apache Mesos: is the heart of Mesosphere System that simplifies running  applications on a scalable cluster of servers.
  2. Marathon: is an orchestration platform for Mesosphere. Marathon is controlled entirely through its HTTP API.
  3. ZooKeeper: is a high-performance coordination service that manages the DC/OS services. Exhibitor automatically configures your Zookeeper installation on the master nodes during installation..

When Mesosphere is deploy it has a master node, a backup master and a set of workers that run the service containers. During this tutorial, we will be using six Ubuntu servers.

Following will be server configuration used in LAB.

Host nameRoleIP Address
mesos-svr-01Master10.128.0.50
mesos-svr-02Master10.128.0.51
mesos-svr-03Master10.128.0.52
mesos-slv-01Slave10.128.0.60
mesos-slv-02Slave10.128.0.61
mesos-slv-03Slave10.128.0.62

Step 1 : First steps is to add the Mesosphere repository to the sources list on all the servers part of cluster.

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

Step 2 : Installing necessary components.

Before installing necessary components, update local package cache to gain access to the new component.

  • sudo apt-get -y update

Next we need to install necessary component depending on the role of the server.

On master hosts, you need the mesosphere package to be installed. This includes the zookeeper, mesos, marathon, and chronos applications:

  • sudo apt-get install mesosphere

On slave hosts, you need the mesos package to be installed. This includes zookeeper as a dependency:

  • sudo apt-get install mesos

Step 3 : Configuring Zookeeper Connection info for Mesos.

Once we have necessary components installed. Next step is to configure Zookeeper connection info. Only master severs will be the members of Zookeeper cluster, but you should have the same configuration on all the servers part of cluster. The connection info is to be defined in below file.

/etc/memos/zk

Open the file file with root privileges and add the IP Address of all the master nodes of the cluster.

  • sudo nano /etc/memos/zk

You will find below entry in the file.

zk://localhost:2181/mesos

Modify the existing entry and add the IP Address of all the master nodes

zk://10.128.0.50:2181, 10.128.0.51:2181, 10.128.0.52:2181/mesos

Save and close the file when you are finished.

Step 4 : Assigning unique ID to each master node

Next step is to configure unique ID to each master node. You can define the unique ID in the file /etc/zookeeper/conf/myid. Open the file with root privileges.

  • sudo nano /etc/zookeeper/conf/myid

Delete all the entries of the file and the first server should have only ” 1 ” in the file

1

Modify Assign a unique ID to each master server within the range ( 1 – 255 )

Step 5 : Modifying Zookeeper Configuration file

Once you have defined unique ID for each host, next is to map each ID to a host by modifying Zookeeper Configuration file.

  • sudo nano /etc/zookeeper/conf/zoo.cfg

Modify the lines adding IP Addresses of the master servers all the master nodes

  • server.1=10.128.0.50:2888:3888
  • server.2=10.128.0.51:2888:3888
  • server.3=10.128.0.52:2888:3888

Save the file and exit.

Step 6 : Configuring Quorum

Next is to configuring quorum for the cluster. The quorum determines the number of host required to be up and running for the cluster to be in function.

Open the quorum configuration file using root privilege

  • sudo /nano/mesos-master/quorum

 

Define the value more the 50% of the number of host. In my lab I have configured the value to 2.

 

  • 2

Step 7 : Configure Host name and IP Address

Next, we need to configure the hostname and IP address for each master servers. In my LAB I choose to use IP address to avoid any DNS issues. Following files are required to be modified on all the master servers:

  • /etc/mesos-master/ip
  • /etc/mesos-master/hostname
  • Master Node 1
    • echo 10.128.0.50 | sudo tee /etc/mesos-master/ip
    • sudo cp /etc/mesos-master/ip /etc/mesos-master/hostname
  • Master Node 2
    • echo 10.128.0.51 | sudo tee /etc/mesos-master/ip
    • sudo cp /etc/mesos-master/ip /etc/mesos-master/hostname
  • Master Node 3
    • echo 10.128.0.52 | sudo tee /etc/mesos-master/ip
    • sudo cp /etc/mesos-master/ip /etc/mesos-master/hostname

 Step 8 : Configure Marathon on Master Servers

You are required to perform below configuration on all the master nodes in the cluster. Even if this configuration is required to be done on all the master nodes, only the leading master server will be able to schedule the jobs. As Marathon configuration directory is not automatically create, first we will create the Marathon configuration directory.

  • sudo mkdir -p /etc/marathon/conf
  • sudo cp /etc/mesos-master/hostname /etc/marathon/conf

Next is to define the list of Zookeeper masters that Marathon will connect for information and scheduling.

  • sudo cp /etc/mesos/zk /etc/marathon/conf/master
  • sudo cp /etc/marathon/conf/master /etc/marathon/conf/zk

Open the file in text editor

  • sudo nano /etc/marathon/conf/zk

Step 9 : Restart services on Master Servers

First make sure mesos-slave service is not running on master servers

  • sudo stop mesos-slave
  • echo manual | sudo tee /etc/init/mesos-slave.override
  • sudo restart zookeeper
  • sudo start mesos-master
  • sudo start marathon

Verifying Mesos and Marathon Configuration

You can verify the configuration opening following URL’s after restarting all the services successfully.

  • https://10.128.0.50:5050 ( Mesos )
  • https://10.128.0.50:8080 ( Marathon )

1

13

Step 10 : Configuring Mesos Slave Nodes

Post successful configuration of Mesos, Marathon and Zookeeper on all the master nodes. Next step is to configure Mesos Slave nodes. We have already configured our slaves with our masters servers’ zookeeper connection information. But the slaves themselves do not run their own zookeeper instances.

Stop Zookeeper service on all the slave nodes

  • sudo stop zookeeper
  • echo manual | sudo tee /etc/init/zookeeper.override

Make sure mesos-master service is not running on any of the slave nodes

  • echo manual | sudo tee /etc/init/mesos-master.override
  • sudo stop mesos-master

Next, we need to set the IP address and hostname under the /etc/mesos-slave directory. As I don’t have any DNS in my LAB, I configured IP Address instead of hostname.

  • Node 1
    • echo 10.128.0.60 | sudo tee /etc/mesos-slave/ip
    • sudo cp /etc/mesos-slave/ip /etc/mesos-slave/hostname
  • Node 2
    • echo 10.128.0.61 | sudo tee /etc/mesos-slave/ip
    • sudo cp /etc/mesos-slave/ip /etc/mesos-slave/hostname
  • Node 3
    • echo 10.128.0.62 | sudo tee /etc/mesos-slave/ip
    • sudo cp /etc/mesos-slave/ip /etc/mesos-slave/hostname

Start mesos-slave service on all the slave nodes

sudo start mesos-slave

After restarting mesos-slave service on all the slave nodes. You should see the number of active slaves at “3” now in the interface:

https://10.128.0.50:5050

3

2

In this post we covered the installation and configuration of Mesosphere Cluster with 3 Masters and 3 Mesos Slave nodes. In upcoming post I will be covering the process of deploying docker application in the Mesosphere cluster and the process of scaling in and out of application on multiple servers.

I hope this is informative for you. Thanks for Reading!!. Be social and share it in social media, if you feel worth sharing it