7 commands to deploy Mesos clusters in Docker
All of the Docker container build files that are used are also available. You can build each container locally or use only the containers that are pre-built at the Docker hub. The following command will automatically download the required pre-built container for your service.
ZooKeeper?—? https://registry.hub.docker.com/u/garland/zookeeper/
Meso Master?—? https://registry.hub.docker.com/u/garland/mesosphere-docker-mesos-master/
Marathon?—? https://registry.hub.docker.com/u/garland/mesosphere-docker-marathon/
1th Step: Obtain the IP of the Docker server and export it to the environment. We will use this IP over and over again in the subsequent Docker commands.
[email protected]:/# host_ip=10.11.31.7
2nd step: Start the Zookeeper container.
Docker run-d \
-P 2,181:2,181 \
-P 2,888:2,888 \
-P 3,888:3,888 \
Garland/zookeeper
3rd step: Start Mesos master server
Docker run--net= "host" \
-P 5,050:5,050 \
-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
4th step: Start Marathon Marathon
Docker run \
-D \
-P 8,080:8,080 \
Garland/mesosphere-docker-marathon--master Zk://${host_ip}:2181/mesos--zk Zk://${host_ip}:2181/marathon
5th step: Start Mesos in a container
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
6th step: Go to the Mesos page
Depending on how you put your Docker server, it's IP address, you may need to change the IP that your browser points to, but the port is the same.
The Mesos page will be at this address:
http://${host_ip}:5050
Then you should get a page like this, but probably not all items in the "Tasks" table for the first time.
Step 7: Go to the Marathon Web page to start the job
The Marathon Web page lets you schedule long-running tasks into mid-view from the container. This is a good test to see if your cluster is up and running. You can view marathon's webpage at:
http://$ {} host_ip:8080
Click on the "New app" button in the top right corner to provide you with the following menu, you can create a new work/task. We're just going to echo the greeting to a file. We can go into the container if the created file checks if the job runs continuously.
8th step: Check the work/task run
Let the inspection work/task continue to run from Mesos.
Run the following command in the Docker server. It will put your inner slave in the container and from there tail out the Output.txt file.
Docker exec-it Mesos_slave_1/bin/bash
[email protected]:/# tail-f/tmp/output.txt
You will see "Hello" being placed in this file about once every second.
Update: I have just updated this project document, including how to set up a multi-node environment: Https://github.com/sekka1/mesosphere-docker#multi-node-setup
Original: http://blog.csdn.net/yangzhenping/article/details/42921211
Easily build Mesos clusters for Docker applications