Getting Started With Apache Mesos
Learn how to install Apache Mesos and monitor it by downloading the Mesos TAR file, running Mesos, and starting the slave.
Join the DZone community and get the full member experience.Join For Free
In our earlier article, Introduction to Apache Mesos, we talked about the basic idea of Mesos, how it works, and its basic terminology. We have discussed the theoretical concepts to get ourselves familiar with Mesos, and now, we will install Mesos and see how we can monitor it using UI.
Step 1: Download the Mesos TAR File
Download the Mesos 1.4.0 release from here and untar it using the following command on your terminal, and then go to the directory containing our extracted Mesos.
tar -zxf mesos-1.4.0.tar.gz
Use the following instructions to install the required packages and other Mesos dependencies.
Update the packages:
$ sudo apt-get update
Install a few utility tools:
$ sudo apt-get install -y tar wget git
Install the latest OpenJDK:
$ sudo apt-get install -y openjdk-8-jdk
Install other Mesos dependencies:
$ sudo apt-get -y install build-essential python-dev python-six python-virtualenv libcurl4-nss-dev libsasl2-dev libsasl2-modules maven libapr1-dev libsvn-dev zlib1g-dev
After downloading Mesos and installing the required packages and dependencies, the next step is to build Mesos.
Change the working directory:
$ cd mesos
Configure and build:
$ mkdir build $ cd build $ ../configure $ make
Run the test suite:
$ make check
$ make install
It will take a little time to build Mesos. After building, Mesos is ready to use now.
Step 2: Run Mesos
To run Mesos, first, start the Mesos Master.
Change into the build directory:
$ cd build
Start Mesos Master (ensure work directory exists and has proper permissions):
$ ./bin/mesos-master.sh –ip=127.0.0.1 –work_dir=/var/lib/mesos
Step 3: Start the Slave
After starting the master, start the slave.
./bin/mesos-slave.sh –master=127.0.0.1:5050 –work_dir=/tmp/mesos
If facing permissions issues:
./bin/mesos-slave.sh –master=127.0.0.1:5050 –work_dir=/tmp/mesos –no-systemd_enable_support
Mesos is running now. To monitor it, visit the Mesos Webpage:
Just for testing purposes, we have run C++ and the Java framework.
$ cd build
Run C++ framework (exits after successfully running some tasks):
$ ./src/test-framework –master=127.0.0.1:5050
Run Java framework (exits after successfully running some tasks):
$ ./src/examples/java/test-framework 127.0.0.1:5050
We can see them in the completed framework.
We are done with the basic installation of Mesos. I hope you liked this article and want to know more about the usage of Mesos, which we will explore more in future blogs.
Please feel free to leave suggestions or comments!
Published at DZone with permission of Mahesh Chand, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.