For quickly deploy a mesos, marathon environment, the docker is a better way. This article builds a mesos with multi-slaves.
root@ubuntu:~# HOST_IP=192.168.47.128
Start zookeeper
root@ubuntu:~# docker run -d \
> -p 2181:2181 \
> -p 2888:2888 \
> -p 3888:3888 \
> garland/zookeeper
Unable to find image ‘garland/zookeeper:latest’ locally
latest: Pulling from garland/zookeeper
a3ed95caeb02: Pull complete
76e26cb603d3: Pull complete
26e3ffd0de24: Pull complete
5b76ae9a2c66: Pull complete
fdd784be067e: Pull complete
9e33799177d8: Pull complete
Digest: sha256:52e3be393804c650c33f6c0e7e45bc383cacedb45e3c869387eacbeb632238e5
Status: Downloaded newer image for garland/zookeeper:latest
a506e9dc7f24dd791159eb64449c7417d59973038e9dfc65b272ab1442325605
Start the Mesos master
root@ubuntu:~# docker run –net=”host” \
> -p 5050:5050 \
> -e “MESOS_HOSTNAME=${HOST_IP}” \
> -e “MESOS_IP=${HOST_IP}” \
> -e “MESOS_ZK=zk://${HOST_IP}:2181/mesos” \
> -e “MESOS_PORT=5050” \
> -e “MESOS_LOG_DIR=/var/log/mesos” \
> -e “MESOS_QUORUM=1” \
> -e “MESOS_REGISTRY=in_memory” \
> -e “MESOS_WORK_DIR=/var/lib/mesos” \
> -d \
> garland/mesosphere-docker-mesos-master
Unable to find image ‘garland/mesosphere-docker-mesos-master:latest’ locally
latest: Pulling from garland/mesosphere-docker-mesos-master
a3ed95caeb02: Pull complete
1e12eb217551: Pull complete
d2ff49536f4d: Pull complete
f94adccdbb9c: Pull complete
ca4998197cbe: Pull complete
91b9a729dc9a: Pull complete
15b805177f74: Pull complete
ed2466789fb0: Pull complete
bb4998055501: Pull complete
d868e403d59a: Pull complete
f67af4adf421: Pull complete
34961fac32c1: Pull complete
Digest: sha256:8f2129e6d717be68ac303925931860cb9de36c653ee1433c31022801c328d41d
Status: Downloaded newer image for garland/mesosphere-docker-mesos-master:latest
0f2c4f20a63c4f3fe760a92b083bce57e9fae51963a7190e78ae52c2e7fd563e
root@ubuntu:~# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0f2c4f20a63c garland/mesosphere-docker-mesos-master “mesos-master” 4 seconds ago Up 3 seconds naughty_hamilton
a506e9dc7f24 garland/zookeeper “/opt/run.sh” 6 minutes ago Up 6 minutes 0.0.0.0:2181->2181/tcp, 0.0.0.0:2888->2888/tcp, 0.0.0.0:3888->3888/tcp sharp_cray
Start Marathon
root@ubuntu:~# docker run \
> -d \
> -p 8080:8080 \
> garland/mesosphere-docker-marathon –master zk://${HOST_IP}:2181/mesos –zk zk://${HOST_IP}:2181/marathon
Unable to find image ‘garland/mesosphere-docker-marathon:latest’ locally
latest: Pulling from garland/mesosphere-docker-marathon
a3ed95caeb02: Pull complete
8e62a7e6041d: Pull complete
d2ff49536f4d: Pull complete
f94adccdbb9c: Pull complete
2294d221426a: Pull complete
d0e98c2d5b79: Pull complete
7e74f2f44da0: Pull complete
76d7fdbd2aba: Pull complete
aaa0ad15d81d: Pull complete
4d0bd4df0f98: Pull complete
Digest: sha256:9894b4bb1238fa14774a07ffb5aa30850fb77c32b0e093aab6c4c6e459f2c12f
Status: Downloaded newer image for garland/mesosphere-docker-marathon:latest
f68ea93d34ffd4403d2b6242e6f8f0405c19afc9c5ea0d3c560107fea975c844
Start Mesos Slave in a container
root@ubuntu:~# docker run -d \
> –name mesos_slave_1 \
> –entrypoint=”mesos-slave” \
> -e “MESOS_MASTER=zk://${HOST_IP}:2181/mesos” \
> -e “MESOS_LOG_DIR=/var/log/mesos” \
> -e “MESOS_LOGGING_LEVEL=INFO” \
> garland/mesosphere-docker-mesos-master:latest
64aa51d89ff14137f055c6d4fb57970eeb2302f03445d822121528d6f457b250
Visit the mesos page:
Image may be NSFW.
Clik here to view.
Start more mesos slaves
root@ubuntu:~# docker run -d –name mesos_slave_2 –entrypoint=”mesos-slave” -e “MESOS_MASTER=zk://${HOST_IP}:2181/mesos” -e “MESOS_LOG_DIR=/var/log/mesos” -e “MESOS_LOGGING_LEVEL=INFO” garland/mesosphere-docker-mesos-master:latest
root@ubuntu:~# docker exec -it mesos_slave_2 /bin/bash
root@32858a376707:/# tail -f /tmp/output.txt
hello
…
Image may be NSFW.
Clik here to view.
root@ubuntu:~# docker exec -it mesos_slave_1 /bin/bash
root@64aa51d89ff1:/# tail -f /tmp/output.txt
hello
…
Reference:
https://github.com/sekka1/mesosphere-docker#multi-node-setup
The post Deploy a Mesos, Marathon Cluster using docker appeared first on Robert Chen.