设置 docker/fig Mesos 环境 [英] Setting up a docker / fig Mesos environment
问题描述
我正在尝试建立一个 docker/fig Mesos 集群.我是 fig 和 Docker 的新手.Docker 有很多文档,但我发现自己很难理解如何使用 fig.
I'm trying to set up a docker / fig Mesos cluster. I'm new to fig and Docker. Docker has plenty of documentation, but I find myself struggling to understand how to work with fig.
这是我目前的 fig.yaml:
Here's my fig.yaml at the moment:
zookeeper:
image: jplock/zookeeper
ports:
- "49181:2181"
mesosMaster:
image: mesosphere/mesos:0.19.1
ports:
- "15050:5050"
links:
- zookeeper:zk
command: mesos-master --zk=zk --work_dir=/var/log --quorum=1
mesosSlave:
image: mesosphere/mesos:0.19.1
links:
- zookeeper:zk
command: mesos-slave --master=zk
谢谢!
感谢 Mark O`Connor 的帮助,我创建了一个基于 docker 的 mesos 设置(+storm、chronos 等).
Thanks to Mark O`Connor's help, I've created a working docker-based mesos setup (+ storm, chronos, and more to come).
享受吧,如果你觉得这很有用 - 请贡献:https://github.com/yaronr/docker-mesos
Enjoy, and if you find this useful - please contribute: https://github.com/yaronr/docker-mesos
附注.请 +1 马克的回答 :)
PS. Please +1 Mark's answer :)
推荐答案
您没有指出您遇到的错误.
You have not indicated the errors you were experiencing.
这是您正在使用的图像的文档:
This is the documentation for the image you're using:
使用 Mesosphere 包的 Mesos 基础 Dockerhttps://mesosphere.io/downloads/.不启动 Mesos,请使用mesos-master 和 mesos-slave Docker.
Mesos base Docker using the Mesosphere packages from https://mesosphere.io/downloads/. Doesn't start Mesos, please use the mesos-master and mesos-slave Dockers.
真正让我担心的是这些图像是不受信任的,并且没有立即可用的来源.
What really worried me about those images is that they were untrusted and no source was immediately available.
所以我使用 mesosphere github 作为灵感重新创建了您的示例:
So I re-created your example using the mesosphere github as inspiration:
示例已更新以包含 chronos 框架
Example updated to include the chronos framework
├── build.sh
├── fig.yml
├── mesos
│ └── Dockerfile
├── mesos-chronos
│ └── Dockerfile
├── mesos-master
│ └── Dockerfile
└── mesos-slave
└── Dockerfile
构建基础镜像(只需要做一次)
Build the base image (only has to be done once)
./build.sh
运行 fig 来启动每个服务的实例:
Run fig to start an instance of each service:
$ fig up -d
Creating mesos_zk_1...
Creating mesos_master_1...
Creating mesos_slave_1...
Creating mesos_chronos_1...
无花果的一个有用的事情是你可以扩大奴隶
One useful thing about fig is that you can scale up the slaves
$ fig scale slave=5
Starting mesos_slave_2...
Starting mesos_slave_3...
Starting mesos_slave_4...
Starting mesos_slave_5...
mesos 主控制台应该显示 5 个正在运行的从节点
The mesos master console should show 5 slaves running
http://localhost:15050/#/slaves
并且 chronos 框架应该正在运行并准备好启动任务
And the chronos framework should be running and ready to launch tasks
http://localhost:14400
fig.yml
zk:
image: mesos
command: /usr/share/zookeeper/bin/zkServer.sh start-foreground
master:
build: mesos-master
ports:
- "15050:5050"
links:
- "zk:zookeeper"
slave:
build: mesos-slave
links:
- "zk:zookeeper"
chronos:
build: mesos-chronos
ports:
- "14400:4400"
links:
- "zk:zookeeper"
注意事项:
- 这个例子只需要一个zookeeper实例
docker build --rm=true --tag=mesos mesos
mesos/Dockerfile
FROM ubuntu:14.04
MAINTAINER Mark O'Connor <mark@myspotontheweb.com>
RUN echo "deb http://repos.mesosphere.io/ubuntu/ trusty main" > /etc/apt/sources.list.d/mesosphere.list
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv E56151BF
RUN apt-get -y update
RUN apt-get -y install mesos marathon chronos
mesos-master/Dockerfile
FROM mesos
MAINTAINER Mark O'Connor <mark@myspotontheweb.com>
EXPOSE 5050
CMD ["--zk=zk://zookeeper:2181/mesos", "--work_dir=/var/lib/mesos", "--quorum=1"]
ENTRYPOINT ["mesos-master"]
mesos-slave/Dockerfile
FROM mesos
MAINTAINER Mark O'Connor <mark@myspotontheweb.com>
CMD ["--master=zk://zookeeper:2181/mesos"]
ENTRYPOINT ["mesos-slave"]
mesos-chronos/Dockerfile
FROM mesos
MAINTAINER Mark O'Connor <mark@myspotontheweb.com>
RUN echo "zk://zookeeper:2181/mesos" > /etc/mesos/zk
EXPOSE 4400
CMD ["chronos"]
注意事项:
- chronos"命令行是使用文件配置的.
这篇关于设置 docker/fig Mesos 环境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!