Book Image

Apache Mesos Cookbook

By : David Blomquist, Tomasz Janiszewski
Book Image

Apache Mesos Cookbook

By: David Blomquist, Tomasz Janiszewski

Overview of this book

Apache Mesos is open source cluster sharing and management software. Deploying and managing scalable applications in large-scale clustered environments can be difficult, but Apache Mesos makes it easier with efficient resource isolation and sharing across application frameworks. The goal of this book is to guide you through the practical implementation of the Mesos core along with a number of Mesos supported frameworks. You will begin by installing Mesos and then learn how to configure clusters and maintain them. You will also see how to deploy a cluster in a production environment with high availability using Zookeeper. Next, you will get to grips with using Mesos, Marathon, and Docker to build and deploy a PaaS. You will see how to schedule jobs with Chronos. We’ll demonstrate how to integrate Mesos with big data frameworks such as Spark, Hadoop, and Storm. Practical solutions backed with clear examples will also show you how to deploy elastic big data jobs. You will find out how to deploy a scalable continuous integration and delivery system on Mesos with Jenkins. Finally, you will configure and deploy a highly scalable distributed search engine with ElasticSearch. Throughout the course of this book, you will get to know tips and tricks along with best practices to follow when working with Mesos.
Table of Contents (15 chapters)
Title Page
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

Downloading, building, and installing the Mesos source code


In this recipe, we will download the Mesos source files, build the code, and install the Mesos binaries and libraries.

Getting ready

Follow the previous sections in this chapter to prepare your operating system for a Mesos source installation.

How to do it...

  1. Browse to the following location: http://mesos.apache.org/downloads/.
  2. Download the TAR file for the most recent stable release of Mesos. For example, to download Mesos version 1.0.1:
$ wget http://www.apache.org/dist/mesos/1.0.1/mesos-1.0.1.tar.gz
  1. Extract the contents of the TAR file. For example, to extract the Mesos 1.0.1 TAR file:
$ tar xvzf mesos-1.0.1.tar.gz
  1. Change the directory to the extracted TAR file directory created in the previous step, for example:
$ cd mesos-1.0.1
  1. Create the build directory:
$ mkdir build
  1. Change directory to the build directory:
$ cd build
  1. Configure the Mesos build script. You can run ../configure --help to see all the available configuration options. Refer to the There's more... section at the end of this recipe for more configuration tips:
$ ../configure
  1. Build the Mesos binaries (executing 'make -j <number of cores> V=0 will decrease both the build time and log verbosity on multicore systems). Refer to the There's more... section at the end of this recipe for more build tips:
$ make
  1. Optional: Run some tests:
$ make check
  1. Optional: Execute the make install command if you would like to install the Mesos binaries and libraries in /usr/local/ and add them to the system path. Mesos can also be installed in other locations or run directly from the build directory. Refer to the There's more... section at the end of this recipe for instructions on installing Mesos to alternative locations, as well as for other installation tips:
$ sudo make install
  1. Optional: For Ubuntu only, create links to the Mesos libraries if you chose the default installation to /usr/local:
$ sudo ldconfig
  1. At this point, you can start Mesos to do some basic testing. To start the Mesos master and agent daemons, first create the mesos working directory:
$ sudo mkdir /var/lib/mesos
  1. Change into the Mesos source build directory:
$ cd build
  1. Now start the Mesos master:
$ sudo ./bin/mesos-master.sh --ip=127.0.0.1 --work_dir=/var/lib/mesos
  1. And start the Mesos agent (in a separate terminal session):
$ sudo ./bin/mesos-agent.sh --master=127.0.0.1:5050 --work_dir=/var/lib/mesos
  1. To validate the Mesos installation, open a browser on the Mesos host and point it to http://127.0.0.1:5050. If you wish to validate with a browser remotely, you will need to replace 127.0.0.1 with the real IP of the Mesos host in the previous commands and restart both the master and agent. You will also need to use the real IP of the Mesos host in the browser.

Note

Warning When using the real IP in the command line, the Mesos master and agent processes will fail to start unless the Mesos host is registered in DNS.

How it works...

Building the Mesos source code will create the binaries needed to run Mesos. Next, you will configure ZooKeeper, which is covered in Chapter 2, Implementing High Availability with Apache ZooKeeper.

There's more...

Refer to the following tips.

Configuration tips

There are a number of options that can be configured in the Mesos build script. For example, if you want to build Mesos with SSL support, you will need to enable the ssl and libevent features by executing ../configure --enable-ssl --enable-libevent prior to executing make. To see a full list of the configure options, execute ../configure --help from the Mesos build directory.

Build tips

If you are building out a Mesos cluster using hosts with the same operating system version, you can configure and build the source code on one server and then copy that source directory to the other servers. You can then skip the ../configure and make commands and just run Mesos from the build directory or execute make install to install it without having to go through the build (make) process on every server.

If you do plan on copying pre-built Mesos software to other servers, make sure all of the servers have the supporting packages required to run Mesos and that the OS is patched to the same version.

Installation tips

The default behavior of make install is to install the Mesos binaries and libraries in the /usr/local path. If you would like to change the installation path, execute ../configure --prefix=/path/to/install/directory during the configure stage prior to the build (make) and install (make install) stages.

If at some point you would like to uninstall the Mesos binaries from the installation path, you can execute make uninstall from the source code build directory. After building and installing the Mesos source code, we recommend archiving the source code directory for future reference.