Skip to content

Instantly share code, notes, and snippets.

@guenter
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guenter/139af8d10fef9b0d7df3 to your computer and use it in GitHub Desktop.
Save guenter/139af8d10fef9b0d7df3 to your computer and use it in GitHub Desktop.
Prepare a cluster started with https://google.mesosphere.com for the Mesos DNS demo

Build Go

sudo apt-get install -y git-core
wget https://storage.googleapis.com/golang/go1.4.linux-amd64.tar.gz
tar xzf go*
sudo mv go /usr/local/
# puts this into ~/.profile
export PATH=$PATH:/usr/local/go/bin
export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/bin
export GOPATH=$HOME/go

Build and run Mesos DNS (on master)

go get github.com/miekg/dns
go get github.com/mesosphere/mesos-dns
cd $GOPATH/src/github.com/mesosphere/mesos-dns
go build -o mesos-dns
nohup ./mesos-dns &

Misc tools

sudo apt-get install -y dnsutils vim
pip install mesos.cli
complete -C mesos-completion mesos

Prep Marathon: rename, set timeout for dockers

sudo /etc/init.d/marathon stop
echo 300000 | sudo dd of=/etc/marathon/conf/task_launch_timeout
echo marathon | sudo dd of=/etc/marathon/conf/framework_name
/usr/lib/zookeeper/bin/zkCli.sh
[zk: localhost:2181(CONNECTED) 2] rmr /marathon/state/frameworkId
sudo /etc/init.d/marathon start

Prep Slave

echo 'ports:[1024-32000]' | sudo dd of=/etc/mesos-slave/resources
sudo /etc/init.d/mesos-slave stop
sudo rm -f /tmp/mesos/meta/slaves/latest
sudo /etc/init.d/mesos-slave start
# edit /etc/resolv.conf and add nameserver <master ip>
# Remove HAProxy so it doesn't get in the way
sudo apt-get -y remove haproxy

Update firewall rules in the dev console to allow all UDP/TCP internally

Start the whole setup

http POST http://10.209.125.196:8080/v2/groups < Node-and-Redis.json

Add Second Marathon

nohup java -Djava.library.path=/usr/local/lib:/usr/lib:/usr/lib64 -Djava.util.logging.SimpleFormatter.format=%2$s%5$s%6$s%n -Xmx512m -cp /usr/local/bin/marathon mesosphere.marathon.Main --framework_name sf --local_port_min 32767 --hostname 10.209.125.196 --task_launch_timeout 300 --local_port_max 49151 --zk zk://10.209.125.196:2181/marathon-sf --master zk://10.209.125.196:2181/mesos --http_port 8080 &


nohup java -Djava.library.path=/usr/local/lib:/usr/lib:/usr/lib64 -Djava.util.logging.SimpleFormatter.format=%2$s%5$s%6$s%n -Xmx512m -cp /usr/local/bin/marathon mesosphere.marathon.Main --framework_name seattle --local_port_min 32767 --hostname 10.209.125.196 --task_launch_timeout 300 --local_port_max 49151 --zk zk://10.209.125.196:2181/marathon-seattle --master zk://10.209.125.196:2181/mesos --http_port 8081 &
{
"id" : "/mysite",
"apps": [
{
"id": "frontend",
"container": {
"type": "DOCKER",
"docker": {
"image": "superguenter/node-redis-demo",
"network": "HOST"
}
},
"env": {
"REDIS_HOST": "redis.mysite.sf.mesos"
},
"instances": 1,
"cpus": 0.1,
"ports": [8080],
"requirePorts": true,
"healthChecks": [
{
"protocol": "HTTP",
"gracePeriodSeconds": 300
}
],
"dependencies": ["/mysite/redis"]
},
{
"container": {
"type": "DOCKER",
"docker": {
"image": "redis",
"network": "HOST"
}
},
"id": "redis",
"instances": 1,
"cpus": 0.1,
"ports": [6379],
"requirePorts": true,
"healthChecks": [
{
"protocol": "TCP",
"gracePeriodSeconds": 300
}
]
}
]
}
@kozyraki
Copy link

We need to keep this tutorial up to date. I think there are some issues.
I will go over it once the HTTP version of Mesos-DNS is done.

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