Vagrantfile and some shell scripts for createing Mesos + Marathon + Chronos + Docker cluster
If you just try Mesos cluster, it will be painful. This set of files makes you easy to generate a cluster environment of Mesos. You can refer This article written in Japanese if you like.
Prerequisite
Mac OS X Yosemite version 10.10.2
Virtual Box 4.3.26
vagrant 1.7.2
git 2.2.1
I try it using Windows 8.1 and vagrant 1.7.2. it works!
Just clone it then vagrant up and reload. It will take about 40 minutes.
$ git clone https://github.com/TsuyoshiUshio/MesosClusterSpyke.git
$ cd MesosClusterSpyke
If you want to change Timezone and Localize it, prease edit common_ubuntu.sh.
$ vagrant up
$ vagrant reload
Apache Mesos : http://192.168.33.10:5050
Marathon : http://192.168.33.10:8080
Chronos : http://192.168.33.10:8081
NOTE:Use leader node for Marathon and Chronos
Chronos and Marathon work only on learder node of Mesos. You may need to stop Chronos and Marathon which is working on non leader nodes.
To get to know the leader node, Open Apache Mesos pages (e.g. http://192.168.33.10:5050) then it will automatically redirect to the leader node.
Stop Chronos
$ vagrant ssh master_01
vagrant@vagrant-ubuntu-trusty-64:~$ sudo initctl stop chronos
Stop Marathon
$ vagrant ssh master_01
vagrant@vagrant-ubuntu-trusty-64:~$ sudo initctl stop marathon
Create Docker.json file like this.
{
"container": {
"type": "DOCKER",
"docker": {
"image": "tsuyoshiushio/aservice",
"network": "BRIDGE",
"portMappings": [
{ "containerPort": 80, "hostPort": 0, "servicePort": 0, "protocol": "tcp"}
]
}
},
"id": "aservice",
"instances": 1,
"cpus": 0.5,
"mem": 512,
"uris": []
}
Then execute this command. You need to change the ipaddress(192.168.33.10) into others(192.168.33.11, 192.168.33.12) if it is not a master node.
$ curl -X POST -H "Content-Type: application/json" http://192.168.33.10:8080/v2/apps [email protected]
Marathon automatically allocate a port for this application. HostPort/ServierPort = 0 meanins allocate it automatically. You can find the port on Marathon at app>aservice Page. Click the link then you can see a demo webpage of a docker container!
Happy clustering!