Skip to content

Instantly share code, notes, and snippets.

@EronWright
Last active June 3, 2020 13:49
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 8 You must be signed in to fork a gist
  • Save EronWright/e9b542cd6b138a7d44f9a4af7af755f0 to your computer and use it in GitHub Desktop.
Save EronWright/e9b542cd6b138a7d44f9a4af7af755f0 to your computer and use it in GitHub Desktop.
Setup Mesos on Ubuntu 16 (Dev Setup)

Configure Mesos

These instructions are derived from those in the Mesos Community Documentation.

Do the below as root.

Install

cat <<EOF >> /etc/apt/sources.list.d/mesosphere.list
deb http://repos.mesosphere.com/ubuntu xenial main
EOF

apt update
apt-get -y install mesos marathon  

Configure ZooKeeper

cat <<EOF >> etc/zookeeper/conf/myid
1
EOF

cat <<EOF >> /etc/zookeeper/conf/zoo.cfg
server.1=`hostname`:2888:3888
EOF

Configure Mesos Master

cat <<EOF >> /etc/mesos/zk
zk://`hostname`:2181/mesos
EOF

cat <<EOF >> /etc/mesos-master/quorum
1
EOF

Configure Mesos Containerizer

Configure Mesos to use the Mesos containerizer with docker image support.

cat <<EOF >> /etc/mesos-slave/containerizers
mesos
EOF

cat <<EOF >> /etc/mesos-slave/image_providers
docker
EOF

cat <<EOF >> /etc/mesos-slave/isolation
filesystem/linux,docker/runtime
EOF

Configure Java Home

Some frameworks expect the JAVA_HOME variable to be set (within their tasks). Adjust the Mesos agent's configuration:

cat <<EOF >> /etc/mesos-slave/executor_environment_variables
{
  "JAVA_HOME": "/usr/lib/jvm/java-8-openjdk-amd64"
}
EOF

Start

Start the services.

sudo service zookeeper restart
sudo service mesos-master restart
sudo service mesos-slave restart

Verify

Verify that Mesos is running normally.

MASTER=$(mesos-resolve `cat /etc/mesos/zk`)
mesos-execute --master=$MASTER --name="cluster-test" --command="sleep 5"

Browse

  • Mesos: http://localhost:5050
  • Marathon: http://localhost:8080
@JJWTimmer
Copy link

This is almost a good guide. From the top of my head, I had to install JDK 8 and set it as default, and you forget to start+enable marathon in your steps ;) Thanks!

@gaohao
Copy link

gaohao commented Jun 4, 2018

yeah. somehow by default, it installed java 9 which holds zookeeper to start...

@biskandar-pk
Copy link

it fails to execute "sudo service mesos-master restart" on ubuntu 16.04 , need to execute manually like below

mesos master --work_dir=. &> /var/log/mesos-master.log &

@skinheadbob
Copy link

Thank you for sharing these information. I have been searching for a proper way to 'apt-get install mesos' as a service.
I think JJWTimmer and gaohao were right about using Java 8 instead of Java 9, I could not get Mesos to work with Java 9 neither.

@ikekim
Copy link

ikekim commented Dec 10, 2018

I'm unable to start marathon & I get the blow. How do I resolve this?

root@vagrant:/home/vagrant# sudo service marathon start
root@vagrant:/home/vagrant# curl http://127.0.0.1:8080
curl: (7) Failed to connect to 127.0.0.1 port 8080: Connection refused

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment