This contains two vagrant sandbox environment.
- standalone environment
- multi nodes cluster environment
- If you prefer to EC2 environment, mesos also ships useful mesos-ec2 scripts. you can try this also.
The setup is provided by mesos chef cookbook. Please see everpeace/cookbook-mesos.
- VirtualBox: https://www.virtualbox.org/
- vagrant 1.2+: http://www.vagrantup.com/
- vagrant plugins
- vagrant-omnibus
$ vagrant plugin install vagrant-omnibus
- vagrant-berkshelf
$ vagrant plugin install vagrant-berkshelf
- vagrant-hosts
$ vagrant plugin install vagrant-hosts
- vagrant-cachier(optional)
$ vagrant plugin install vagrant-cachier
- vagrant-omnibus
It's so simple! It's time to get a cup of coffee because this may take some time.
$ cd standalone
$ vagrant up
just hit below command.
$ vagrant ssh -c 'mesos-start-cluster.sh'
If everything went well, you can see mesos web UI on: http://localhost:5050
if you want to try mesos with zookeeper, which is responsible for managing master processes, you can try belows.
-
change
chef.json[:mesos]
inVagrantfile
to:mesos => { :cluster_name => "MyCluster", :master_ips => ["localhost"], :slave_ips => ["localhost"], :master => { :zk => "zk://localhost:2181/mesos" }, :slave =>{ :master_url => "zk://localhost:2181/mesos", } }
-
provision VM again:
$ vagrant provision
-
start zookeeper:
$ vagrant ssh vagrant@mesos$ cd mesos/build/3rdparty/zookeeper-3.3.4/ vagrant@mesos$ cp conf/zoo_sample.cfg conf/zoo.cfg vagrant@mesos$ sudo bin/zkServer.sh start
-
start mesos cluster with zookeeper managed master:
$ vagrant ssh -c 'mesos-start-cluster.sh'
please try below by following the getting started document.
$ vagrant ssh
vagrant@mesos$ cd /home/vagrant/mesos/build
vagrant@mesos$ sudo make check
vagrant@mesos$ src/test-framework --master=mesos:5050 # or --master=zk://mesos:2181/mesos
vagrant@mesos$ src/examples/java/test-framework mesos:5050 # or zk://mesos:2181/mesos
vagrant@mesos$ src/examples/python/test-framework mesos:5050 # or zk://mesos:2181/mesos
Cluster configuration is defined at cluster.yml
.
You can edit the file to congigure cluster configurations.
# Cluster configurations
master_n: 1 # hostname will be master1,master2,…
slave_n : 2 # hostname will be slave1,slave2,…
force_zk: false # force to create zookeeper servers(zk1,zk2,…)
# even if master_n is 1.
master_mem: 512
slave_mem : 1024
zk_mem : 256
master_ipbase: "192.168.31."
slave_ipbase : "192.168.32."
zk_ipbase : "192.168.33."
In multinode environment, vagrant-mesos
, which is a vagrant wrapper script to help controling mesos cluster, is provided.
This takes several minutes(may be 10 to 20 min.). It's time for coffee.
$ cd multinodes
$ ./vagrant-mesos launch
$ cd multinodes
$ ./vagrant-mesos [start|stop]
mesos master listen on port 5050 on 192.168.31.??
(virtual private IP). So, by normal virtual box NAT setting, host os can't connect to mesos master. To connect mesos master, you can use ssh port forwarding like this.
$ vagrant ssh master1 -- -L15050:master1:5050
Then, you can connect mesos web ui on http://localhost:15050
$ cd multinodes
$ ./vagrant-mesos status
this operations delete all VMs consisting mesos cluster.
$ cd multinodes
$ ./vagrant-mesos destroy
$ cd multinodes
$ ./vagrant-mesos -h
vagrant-mesos: vagrant wrapper helper script for controlling a mesos cluster.
Usage: vagrant-mesos [-h] command
-h, --help Print this help.
Available commands:
destroy Destroy all VMs
launch Equivalent to up and then start.
start Start mesos cluster.
stop Stop mesos cluser.
provision Equivalent with 'vagrant provision'
resume Equivalent with 'vagrant resume'
status print status of VMs and cluster
suspend Equivalent with 'vagrant suspend'
up Equivalent with 'vagrant up'