Build a simple distributed, fault-tolerant framework on top of Apache Mesos

The example framework can launch a given number of instances of a command across a cluster and will restart the command if it fails.


Install Autotools and Libtool

Mesos uses autotools to build. Install via Homebrew on a Mac:

brew install autoconf automake libtool

Install Mesos

The Mesos repo on Github is currently out of sync. You can use the one below for now.

git clone https://git-wip-us.apache.org/repos/asf/mesos.git
cd mesos
mkdir build
cd build
make install

**Please note:, **when installing mesos on OS 10.8, in order to compile it, you need to first ensure you have JDK 1.7 installed. You can download the Oracle JDK here: http://www.oracle.com/technetwork/java/javase/downloads/index.html. Once you have installed JDK 1.7, you need to run “export JAVA_HOME=`/usr/libexec/java_home -v 1.7`”. Then you can build mesos. Due to some issues with the JDK & OS X, a pop-up might appear upon launching mesos that will ask you to now install JDK 1.6 which is required to run mesos.

Run Zookeeper and Mesos

Mesos ships with Zookeeper. Run these commands in different terminal windows to start a local Zookeeper, Mesos master, and Mesos slave.

cd /path/to/incubator-mesos/build/third_party/zookeeper-3.3.4
cp conf/zoo_sample.cfg conf/zoo.cfg
./bin/zkServer.sh start

/usr/local/sbin/mesos-master --zk=zk://localhost:2181/mesos

/usr/local/sbin/mesos-slave --master=zk://localhost:2181/mesos

Add the Mesos JAR to your local Maven Repo

mvn install:install-file -Dfile=/path/to/incubator-mesos/build/src/mesos-0.13.0.jar -DgroupId=org.apache.mesos -DartifactId=mesos -Dversion=0.13.0 -Dpackaging=jar


The Git repo for this tutorial is available at https://github.com/guenter/mesos-getting-started. There are tags called step0 – step5 to help you navigate.