Apache Mesos is a system software that resides between the application layer and the operating system to make it easier for the deploying and managing of applications in large-scale clustered environments. Mesos can run numerous applications on a dynamically shared pool of nodes that provide a large collection of resources. The main features of Mesos are:
- Linear scalability
- High availability
- Native support for docker images
- Two-level scheduling
- Web Interface
- Pluggable isolation
- Cross platform (Linux, OSX, Windows, and cloud provider agnostic)
This is a very powerful system, built upon the same principles as the Linux kernel, that can provide applications with API’s for both resource management and scheduling across your datacenter. In fact, Apache Mesos is essentially that — a data center kernel with the ability to isolate the running workloads from one another.
I want to walk you through the process of installing Apache Mesos on the Ubuntu 16.04 Server platform. The installation is quite time-consuming, but once installed, Mesos is ready to serve. We’ll be installing this for demonstration purposes only. To work with Mesos on a production environment, where cluster machines must be able to communicate with one another, you must make sure your hostname is resolvable either via DNS or through /etc/hosts. In other words, for every machine you will be using with Mesos, it must be able to resolve the host by name (which, on Linux, can be done by editing /etc/hosts).
With that said, let’s install Apache Mesos.
Download Apache Mesos
The first thing we are going to do is download the necessary source file from the Apache Mesos download page. At the moment, the latest version is 1.2.0, which is what we’ll be working with. Before you actually issue the command to download the file onto your Linux server, check the download page to ensure 1.2.0 is still the latest.
Open up a terminal window, change into the /tmp directory with the command cd /tmp and download the file with the command:
If your server replies with wget command not found, issue the following (and then re-run the download command):
sudo apt-get install wget
Unpack the downloaded file with the command:
tar -xvzf mesos-1.2.0.tar.gz
Install all tools and dependencies
Before we install Mesos, we must first install the necessary dependencies. The first thing to be done is to update apt with the command:
sudo apt-get update
Next we install OpenJDK with the command:
sudo apt-get install -y openjdk-8-jdk
Now we install all of the Mesos dependencies with the command:
sudo apt-get -y install build-essential python-dev python-virtualenv libcurl4-nss-dev libsasl2-dev libsasl2-modules maven libapr1-dev libsvn-dev zlib1g-dev
With the above collection of commands complete, it’s time to dive into the installation of Mesos. Be prepared to spend some time watching output fly by.
Back in the /tmp directory, change into the newly created mesos-1.2.0 directory with the command:
Create a new directory with the command:
Change into the newly created build directory with the command:
Configure Mesos with the command:
Build the source with the command:
Next, test the configuration with the command:
Finally, run the installation with the command:
sudo make install
The above collection of commands will take significant time to complete (about an hour total). Once they finish, you are ready to test your installation.
The first thing we want to do is start the Mesos master. This is done by changing into the mesos bin directory (with the command cd /tmp/mesos-1.2.0/bin) and then issuing the command:
sudo ./bin/mesos-master.sh --ip=127.0.0.1 --work_dir=/var/lib/mesos
Now we’ll start the Mesos agent with the command:
sudo ./bin/mesos-agent.sh --master=127.0.0.1:5050 --work_dir=/var/lib/mesos
NOTE: Running the above commands with the IP address 127.0.0.1 will make Mesos available only to that local server. If you want to be able to access Mesos from another machine, you’ll need to substitute the loopback address (127.0.0.1) with the actual server IP address.
Finally, point a browser to http://IP_OF_SERVER:5050 (Where IP_OF_SERVER is the IP address of your Mesos server) and you should see the Mesos web UI, ready to go (Figure A).
Ready to launch
At this point, you are ready to continue on with Apache Mesos. You’ll find the journey to be one of complexity, so you should make sure to give the official documentation ample time to study.