Skip to content

Instantly share code, notes, and snippets.

@gavinwhyte
Last active August 29, 2015 14:23
Show Gist options
  • Save gavinwhyte/5d15c9ed16f09a8840f6 to your computer and use it in GitHub Desktop.
Save gavinwhyte/5d15c9ed16f09a8840f6 to your computer and use it in GitHub Desktop.
Mesos
$ mkdir vm-install
$ cd vm-install
$ vagrant init chef/centos-7.0
Edit the Vagrantfile to uncomment the line with
$ config.vm.network "private_network", ip: "192.168.33.10"
and add the line
$ config.vm.hostname = "node1"
$ config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = true
#
# # Customize the amount of memory on the VM:
$ vb.memory = "8192"
$ end
right after that:
Start the vm
$ vagrant up
$ vagrant ssh
Modify the
$ /etc/hosts file
to make the node1 name map to the IP address in the Vagrantfile:
Current Setup - notice node 1 is removed from 127.0.0.1 and given ip address 192.168.33.10
127.0.0.1 node1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
New setup
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.33.10 node1
$ sudo rpm -Uvh http://repos.mesosphere.io/el/7/noarch/RPMS/mesosphere-el-repo-7-1.noarch.rpm
$ sudo yum -y install mesos marathon
Install Zookeeper and the Zookeeper server package by pointing to the RPM repository for ZooKeeper:
$ sudo rpm -Uvh http://archive.cloudera.com/cdh4/one-click-install/redhat/6/x86_64/cloudera-cdh-4-0.x86_64.rpm
$ sudo yum -y install zookeeper zookeeper-server
Initialize and start Zookeeper:
$ sudo -u zookeeper zookeeper-server-initialize --myid=1
$ sudo service zookeeper-server start
Use the interactive shell to test your installation:
$ /usr/lib/zookeeper/bin/zkCli.sh
# sometimes at this point you get an error that java is missing. This means yum did NOT install java for...reasons. Start over.
help
create /test 1
get /test
set /test 2
get /test
delete /test
quit
Validate that you can stop and restart ZooKeeper <- Important step.
$ sudo service zookeeper-server stop
$ sudo service zookeeper-server start
$ sudo service mesos-master start
$ sudo service mesos-slave start
$ sudo netstat -nlp | grep mesos
Access the Mesos user interface with your browser at http://192.168.33.10:5050 and confirm that the IP address shown in the user interface is 192.168.33.10. If not, start over by using vagrant destroy.
Test out mesos by using the mesos-execute command:
$ export MASTER=$(mesos-resolve `cat /etc/mesos/zk` 2>/dev/null)
$ mesos help
$ mesos-execute --master=$MASTER --name="cluster-test" --command="sleep 40"
With the mesos-execute command running, enter ctrl-z to suspend the command. You can see how it appears in the web UI and command line:
# hit ctrl-z
$ bg # this sends the process into the background
$ mesos ps --master=$MASTER
Start Marathon
$ sudo service marathon start
Go to http://192.168.33.10:8080/ to view the Marathon GUI. From the GUI, install a new app that Marathon will run. In this example, we start by using the
$python -m SimpleHTTPServer or
$python -m SimpleHTTPServer $PORT
app.:
# view the python SimpleHTTPServer web server is running
$ netstat -nlp | grep 8000
# use curl to play with the server
$ curl http://192.168.33.10:8000/
Marathon and Mesos give you direct access to the stderr (standard error) and stdout (standard out) files for every process. You can use curl to view these files and see that they are the SimpleHTTPServer's logs, which you would normally see on your terminal when you start it:
$ curl http://192.168.33.10:8000/stderr
$ curl http://192.168.33.10:8000/stdout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment