7 min read

1 Getting Started with Apache Mesos In this article by David Blomquist author of the book Apache Mesos Cookbook, we will In this chapter, we will provide an overview of the Mesos architecture and recipes for installing Mesos on Linux and Mac. The following are the recipes coverbeed covering in this chapter following topics:

  1. Installing Mesos on Ubuntu 16.04 from packages
  2. Installing Mesos on Ubuntu 14.04 from packages
  3. Installing Mesos on CentOS 7 and RHEL 7 from packages

Introduction

Apache Mesos is a cluster management software that can distribute the combined resources of many individual servers to applications through frameworks. Mesos is an open source software that is free to download and use in accordance with the Apache License 2.0. This book article will provide the reader with recipes for deploying and developing Apache Mesos and the Mesos frameworks.

Mesos can run on Linux, Mac, and Windows. However, we recommend running Mesos on Linux for production deployments and on Mac and Windows for development purposes only. Mesos can be installed from TAR files, Git, source code, or from packages downloaded from repositories. We have chosen to cover only a few installation methods on select operating system versions in this bookarticle. The reasons for covering these specific operating systems and installation methods are as follows:

  1. The operating systems natively include a kernel that supports full resource isolation
  2. The operating systems are current as of this writing with long term support
  3. The operating systems and installation methods do not require workarounds or an excessive number of external repositories
  4. The installation methods use the latest stable version of Mesos, whether it is from packages or source code

Mesosphere, founded by one of the original developers of Mesos, is a company that provides free open source packages as well as commercial support for Mesos. Mesosphere packages are well maintained and provide an easy way to install and run Mesos. You can run a production Mesos cluster using these packages if you do not require any customization of the build or install process. However, installing from source will allow you to customize the build and install process and enable and disable features. If you want a completely open source and customizable production cluster, we recommend you to install Mesos from source on Ubuntu 16.04 or Ubuntu 14.04. If you want a development environment on a Mac, building from source on OS X is the only way to go. The installation methods that we cover will all provide you with a good base for building out a Mesos development or production environment.

We will guide you through the installations in the following sections, but first, you will need to plan for your Mesos deployment. For a Mesos development environment, you only need one host or node. The node can be a physical computer, a virtual machine, or a cloud instance. For a production cluster, we recommend at least three master nodes and as many slave nodes as you will need to support your application frameworks. You can think of the slave nodes as a pool of CPU, RAM, and storage that can be increased by simply adding more slave nodes. Mesos makes it very easy to add slave nodes to an existing cluster as your application requirements increase. At this point, you should know whether you will be building a Mesos development environment or a production cluster and you should have an idea of how many master and slave nodes you will need. The next sections will provide recipes for installing Mesos in the environment of your choice

Installing Mesos on Ubuntu 16.04 from Packages

In this recipe, we will be installing Mesos .deb packages from the Mesosphere repositories using apt.

Getting ready

You must be running a 64-bit version of the Ubuntu 16.04 operating system and it should be patched to the most current patch level using apt-get prior to installing the Mesos packages.

How to do it…

  1. First, download and install the OpenPGP key for the Mesosphere packages: $ sudo apt-key adv –keyserver keyserver.ubuntu.com –recv E56151BF
  2. Now install the Mesosphere repository: 
    $ 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
  3. Update the apt-get package indexes: 
    $ sudo apt-get update
  4. And finally, install Mesos and the included ZooKeeper binaries: 
    $ sudo apt-get -y install mesos
  5. At this point, you can start Mesos to do some basic testing. To start the Mesos master and agent (slave) daemons, execute the following: 
    $ sudo service mesos-master start $ sudo service mesos-slave start
  6. To validate the Mesos installation, open a browser and point it to http://:5050. Replace with the actual address of the host with the new Mesos installation

How it works…

The Mesosphere packages provide the software required to run Mesos.. Next, you will configure ZooKeeper, which is covered in Chapter 2. See also If you prefer to build and install Mesos on Ubuntu from source code, we will cover that in an upcoming section in this chapter.

Installing Mesos on Ubuntu 14.04 from Packages

In this recipe, we will be installing Mesos .deb packages from the Mesosphere repositories using apt.

Getting ready

You must be running a 64-bit version of the Ubuntu 14.04 operating system and it should be patched to the most current patch level using apt-get prior to installing the Mesos packages.

How to do it……

  1. First, download and install the OpenPGP key for the Mesosphere packages: 
    $ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv E56151BF
  2. Now install the Mesosphere repository:
     $ 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
  3. Update the apt-get package indexes: 
    $ sudo apt-get update
  4. And finally, install Mesos and the included ZooKeeper binaries: $ sudo apt-get -y install mesos
  5. At this point, you can either start Mesos to do some basic testing. To start the Mesos master and agent (slave) daemons, execute the following command: 
    $ sudo service mesos-master start $ sudo service mesos-slave start
  6. To validate the Mesos installation, open a browser and point it to http://:5050. Replace with the actual address of the host with the new Mesos installation

How it works…

The Mesosphere packages provide the software required to run Mesos. Next, you will configure ZooKeeper, which is covered in Chapter 2., See also If you prefer to build and install Mesos on Ubuntu from source code, we will cover that in an upcoming section in this chapter.

Installing Mesos on CentOS 7 and RHEL 7 from Packages

In this recipe, we will be installing Mesos .rpm packages from the Mesosphere repositories using yum.

Getting ready

Your CentOS 7 or RHEL 7 operating system should be patched to the most current patch level using yum prior to installing the Mesosphere packages.

How to do it…

  1. First, add the Mesosphere repository:
     $ sudo rpm -Uvh http://repos.mesosphere.io/el/7/noarch/RPMS/mesosphere-el-repo-7-1.noarch.rpm
  2. And now, install Mesos and ZooKeeper:
     $ sudo yum -y install mesos mesosphere-zookeeper
  3. At this point, you can start Mesos to do some basic testing. To start the Mesos master and agent (slave) daemons, execute the following: 
    $ sudo service mesos-master start $ sudo service mesos-slave start
  4. To validate the Mesos installation, open a browser and point it to http://:5050. Replace with the actual address of the host with the new Mesos installation

How it works…

The Mesosphere packages provide the software required to run Mesos. Next, you will configure ZooKeeper, which is covered in Chapter 2.

See also

If you prefer to build and install Mesos from source code on RHEL 7 or CentOS 7, you can find installation instructions for CentOS 7 on the mesos.apache.org website. We do not cover installing Mesos source code on RHEL7 or CentOS 7 in this book article due to dependencies that require the installation of packages from multiple third-party repositories. 

Summary

In this article we have learned how to install Mesos on Ubuntu 16.04 from packages, how to install Mesos on Ubuntu 14.04 from packages and how to installing Mesos on CentOS 7 and RHEL 7 from packages.

Resources for Article:

 


Further resources on this subject:

  1. Apache Mesos Cookbook
  2. Mastering Mesos

LEAVE A REPLY

Please enter your comment!
Please enter your name here