Setting up mesos cluster on Redhat 7 or Centos 7

mesos

#1

As part of this topic let us see how we can set up mesos on 6 node cluster

  • Understand cluster details
  • Setup mesos on the cluster
  • Validate whether setup is successful or not

Cluster details (size 6 nodes)

  • Operating System - centos 7/Redhat 7/Fedora 7 (this will not work on Ubuntu)
  • All nodes have user name called mesos (sudoer to root)
  • Masters - mesos000 (192.168.100.190), mesos001 (192.168.100.191), mesos002 (192.168.100.192)
  • Slaves - mesos003 (192.168.100.193), mesos004 (192.168.100.194), mesos005 (192.168.100.195)

Setup Process for Mesos

  • Download all the necessary softwares on all the nodes
  • Configure mesos-master and zookeeper and start on masters
  • Configure mesos-slave and start on slaves
  • Configure and start marathon on all servers

Setup DNS

  • Setup DNS aliases for all the nodes which are readable
  • If you do not have DNS server setup just update /etc/hosts
192.168.100.190 mesos000
192.168.100.191 mesos001
192.168.100.192 mesos002
192.168.100.193 mesos003
192.168.100.194 mesos004
192.168.100.195 mesos005

Downloading Softwares

  • Download mesos and marathon on all nodes
sudo rpm -Uvh http://repos.mesosphere.io/el/7/noarch/RPMS/mesosphere-el-repo-7-1.noarch.rpm
sudo yum -y install mesos marathon
  • Download zookeeper on masters
sudo yum -y install mesosphere-zookeeper

Configure zookeeper and mesos master on all masters

  • We need to assign id to each of the master
  • Quorum is set to 2 (Ceil of our number of masters divided by 2)
  • id should start with 1 and incremented by 1 for each node (not 0)
  • Assigning id 1 to mesos000
echo 1 | sudo tee /var/lib/zookeeper/myid
echo 2 | sudo tee /etc/mesos-master/quorum
echo 192.168.100.190 | sudo tee /etc/mesos-master/ip

echo "zk://192.168.100.190:2181,192.168.100.191:2181,192.168.100.192:2181/mesos" | sudo tee /etc/mesos/zk

sudo mkdir -p /etc/marathon/conf
sudo cp /etc/mesos/zk /etc/marathon/conf/master
sudo cp /etc/marathon/conf/master /etc/marathon/conf/zk

echo "zk://192.168.100.190:2181,192.168.100.191:2181,192.168.100.192:2181/marathon" | sudo tee /etc/marathon/conf/zk

sudo sh -c 'echo "server.1=192.168.100.190:2888:3888" >> /etc/zookeeper/conf/zoo.cfg'
sudo sh -c 'echo "server.2=192.168.100.191:2888:3888" >> /etc/zookeeper/conf/zoo.cfg'
sudo sh -c 'echo "server.3=192.168.100.192:2888:3888" >> /etc/zookeeper/conf/zoo.cfg'

# Disabling mesos-slave (on masters)
sudo service mesos-slave stop
sudo systemctl disable mesos-slave

# Starting zookeeper and mesos-master (on masters)
sudo service zookeeper restart
sudo service mesos-master restart
sudo service marathon restart
  • Assigning id 2 to mesos001
echo 2 | sudo tee /var/lib/zookeeper/myid
echo 2 | sudo tee /etc/mesos-master/quorum
echo 192.168.100.191 | sudo tee /etc/mesos-master/ip

echo "zk://192.168.100.190:2181,192.168.100.191:2181,192.168.100.192:2181/mesos" | sudo tee /etc/mesos/zk

sudo mkdir -p /etc/marathon/conf
sudo cp /etc/mesos/zk /etc/marathon/conf/master
sudo cp /etc/marathon/conf/master /etc/marathon/conf/zk

echo "zk://192.168.100.190:2181,192.168.100.191:2181,192.168.100.192:2181/marathon" | sudo tee /etc/marathon/conf/zk

sudo sh -c 'echo "server.1=192.168.100.190:2888:3888" >> /etc/zookeeper/conf/zoo.cfg'
sudo sh -c 'echo "server.2=192.168.100.191:2888:3888" >> /etc/zookeeper/conf/zoo.cfg'
sudo sh -c 'echo "server.3=192.168.100.192:2888:3888" >> /etc/zookeeper/conf/zoo.cfg'

# Disabling mesos-slave (on masters)
sudo service mesos-slave stop
sudo systemctl disable mesos-slave

# Starting zookeeper and mesos-master (on masters)
sudo service zookeeper restart
sudo service mesos-master restart
sudo service marathon restart
  • Assigning id 3 to mesos002
echo 3 | sudo tee /var/lib/zookeeper/myid
echo 2 | sudo tee /etc/mesos-master/quorum
echo 192.168.100.192 | sudo tee /etc/mesos-master/ip

echo "zk://192.168.100.190:2181,192.168.100.191:2181,192.168.100.192:2181/mesos" | sudo tee /etc/mesos/zk

sudo mkdir -p /etc/marathon/conf
sudo cp /etc/mesos/zk /etc/marathon/conf/master
sudo cp /etc/marathon/conf/master /etc/marathon/conf/zk

echo "zk://192.168.100.190:2181,192.168.100.191:2181,192.168.100.192:2181/marathon" | sudo tee /etc/marathon/conf/zk

sudo sh -c 'echo "server.1=192.168.100.190:2888:3888" >> /etc/zookeeper/conf/zoo.cfg'
sudo sh -c 'echo "server.2=192.168.100.191:2888:3888" >> /etc/zookeeper/conf/zoo.cfg'
sudo sh -c 'echo "server.3=192.168.100.192:2888:3888" >> /etc/zookeeper/conf/zoo.cfg'

# Disabling mesos-slave (on masters)
sudo service mesos-slave stop
sudo systemctl disable mesos-slave

# Starting zookeeper and mesos-master (on masters)
sudo service zookeeper restart
sudo service mesos-master restart
sudo service marathon restart
  • Run these commands on slaves
echo "zk://192.168.100.190:2181,192.168.100.191:2181,192.168.100.192:2181/mesos" | sudo tee /etc/mesos/zk
sudo mkdir -p /etc/marathon/conf
sudo cp /etc/mesos/zk /etc/marathon/conf/master
sudo cp /etc/marathon/conf/master /etc/marathon/conf/zk
echo "zk://192.168.100.190:2181,192.168.100.191:2181,192.168.100.192:2181/marathon" | sudo tee /etc/marathon/conf/zk

# Disabling mesos-master on slaves
sudo service mesos-master stop
sudo systemctl disable mesos-master

# Starting mesos-slave as well as marathon on slaves
sudo service mesos-slave restart
sudo service marathon restart

Setup Spark cluster using Mesos