【译】使用Docker Compose一条指令配置Mesos
原文作者:Sebastien Goasguen 原文地址:https://dzone.com/articles/1-command-to-mesos-with-docker-compose
原文
Setup Mesos with One Command Using Docker Compose
If you have not tried Docker, you should. The sheer power it puts in your hands and the simplicity of the user experience will just wow you. In this post, I will show you how to start a one node Mesos setup with Docker compose.
Docker announced compose on February 26th. Compose allows you to describe a multi-container setup and manage it with one binary docker-compose. The containers and volumes combinations managed by Compose are defined in a YAML file, super easy to read and super easy to write. The UX is very similar to the Docker CLI.
When compose was released, I tried it and was a bit underwhelmed, as it is basically a relooking of Fig. This is not unexpected as Docker Inc, acquired Orchard the makers of Fig. But I was expecting more added functionality and even a tighter integration with the Docker client (something a devbranch actually prototyped), even a common release instead of a separate binary. I am sure this will come.
As I am writing the docker cookbook, I have deployed Wordpress 20 different ways, and it’s getting a bit boring ! I was looking for more information on Mesos and its support for Docker, I re-read a terrific blog post that showed how to start a Mesos setup (zookeeper, master, slave, marathon framework) in 7 commands. Can’t beat that.
When I re-read this post, I automatically thought this was an exciting use case for docker-compose. One YAML file to start Mesos/Zookeeper/Marathon and experiment with it. Of course I am not talking about a production multi-node setup. I am just looking at it for an easy Mesos experiment.
I will spare you the details of installing compose (just a curl away). The dockers docs are great.
So here is the YAML file describing our Mesos setup:
zookeeper:
image: garland/zookeeper
ports:
- "2181:2181"
- "2888:2888"
- "3888:3888"
mesosmaster:
image: garland/mesosphere-docker-mesos-master
ports:
- "5050:5050"
links:
- zookeeper:zk
environment:
- MESOS_ZK=zk://zk:2181/mesos
- MESOS_LOG_DIR=/var/log/mesos
- MESOS_QUORUM=1
- MESOS_REGISTRY=in_memory
- MESOS_WORK_DIR=/var/lib/mesos
marathon:
image: garland/mesosphere-docker-marathon
links:
- zookeeper:zk
- mesosmaster:master
command: --master zk://zk:2181/mesos --zk zk://zk:2181/marathon
ports:
- "8080:8080"
mesosslave:
image: garland/mesosphere-docker-mesos-master:latest
ports:
- "5051:5051"
links:
- zookeeper:zk
- mesosmaster:master
entrypoint: mesos-slave
environment:
- MESOS_HOSTNAME=192.168.33.10
- MESOS_MASTER=zk://zk:2181/mesos
- MESOS_LOG_DIR=/var/log/mesos
- MESOS_LOGGING_LEVEL=INFO
Launch this with:
$ ./docker-compose up -d
Recreating vagrant_zookeeper_1...
Recreating vagrant_mesosmaster_1...
Recreating vagrant_marathon_1...
Recreating vagrant_mesosslave_1...
And open your browser at http://IP_HOST:5050 then follow the rest of the blog to start a task in marathon.
Bottom line, I went from ‘7 commands to Mesos’ to ‘1 command to Mesos’ thanks to Docker-compose and a fairly simple YAML file. Got to love it. When compose can do this across Docker hosts in a Docker Swarm started by Machine. Then the real fun will begin !
译文
使用Docker Compose
一条指令配置Mesos
如果你还没有使用过的Docker,你一定要试一试。纯粹的功能和质朴的用户体验将让你感到惊奇。在这篇文章中,我将告诉你如何通过Docker Compose
来设置一个单节点的Mesos。(译者注:Mesos集群官网)
Docker在2月26日发布了Compose
(译者注:Docker-Compose官方文档)。Compose
允许你使用一个Docker-Compose
实现多容器安装和管理。使用Compose
管理的容器会通过一个YAML
文件来进行定义,十分容易阅读和编写,其用户体验和Docker CLI
非常相似。
在Compose
刚发布时,我试着使用了一下,有点让人失望,因为它基本上是一个翻版的Fig
。对于Docker公司来说这并不意外,为了夺取Orchard旗下Fig
的市场。但我期待更多的附加功能,乃至更紧密集成的Docker
的客户端(一些dev 分支实际上提供了原型),即使只是一个普通的发行版而不是一个单独的程序。我相信这一切都会实现。
当我写 《docker cookbook》 时,我已经试着使用20种不同的方式部署WordPress
,不得不承认这确实有点无聊! 我开始寻找更多的关于Mesos
的信息,然后我发现Docker
已经实现了对其的支持,我重读了一篇很棒的博客,展示关于如何通过七条指令来实现一个Mesos
的安装(zookeeper, master, slave, marathon framework)【译者注:原文链接,翻译参考】。我认输!
当我重新阅读这篇文章是,我下意识地认为这是Docker-Compose
一个令人激动的用例。使用一个YAML
文件来启动Mesos/Zookeeper/Marathon
并进行实验。当然,我不是在介绍一个多节点的设置。仅仅只是简单的进行一个Mesos
的实验。
我会略过compose
安装的细节,Docker
的文档已经足够完美了。
下面就是YAML
文件的所描述的Mesos
设置:
zookeeper:
image: garland/zookeeper
ports:
- "2181:2181"
- "2888:2888"
- "3888:3888"
mesosmaster:
image: garland/mesosphere-docker-mesos-master
ports:
- "5050:5050"
links:
- zookeeper:zk
environment:
- MESOS_ZK=zk://zk:2181/mesos
- MESOS_LOG_DIR=/var/log/mesos
- MESOS_QUORUM=1
- MESOS_REGISTRY=in_memory
- MESOS_WORK_DIR=/var/lib/mesos
marathon:
image: garland/mesosphere-docker-marathon
links:
- zookeeper:zk
- mesosmaster:master
command: --master zk://zk:2181/mesos --zk zk://zk:2181/marathon
ports:
- "8080:8080"
mesosslave:
image: garland/mesosphere-docker-mesos-master:latest
ports:
- "5051:5051"
links:
- zookeeper:zk
- mesosmaster:master
entrypoint: mesos-slave
environment:
- MESOS_HOSTNAME=192.168.33.10
- MESOS_MASTER=zk://zk:2181/mesos
- MESOS_LOG_DIR=/var/log/mesos
- MESOS_LOGGING_LEVEL=INFO
使用如下指令启动:
$ ./docker-compose up -d
Recreating vagrant_zookeeper_1...
Recreating vagrant_mesosmaster_1...
Recreating vagrant_marathon_1...
Recreating vagrant_mesosslave_1...
打开你的浏览器,输入 http://IP_HOST:5050 然后按照博客内容剩下的内容在marathon
中添加一个任务。
最后,我将’7条指令设置Mesos
‘变成了’1条指令设置Mesos
‘,这都归功于Docker-compose
和简便的YAML
文档。试着喜欢上这种用法。当Compose
能通过Docker
实现Docker Swarm
的机器启动,那么真正有趣的部分就开始了。
- No.014 Longest Common Prefix
- Java实现解析IP地址的方法,给出一串数字,生成正确的IP地址
- 图解“管道过滤器模式”应用实例:SOD框架的命令执行管道
- No.013 Roman to Integer
- OData – the best way to REST–实例讲解ASP.NET WebAPI OData (V4) Service & Client
- Java实现的手工做乘法方法,给出二个字符串数字,返回相乘结果
- No.012 Integer to Roman
- 黑帽SEO剖析之手法篇
- IOS学习1——IOS应用程序的生命周期及基本架构
- 浅议“全局变量”、“多线程”和“编译器陷阱”
- Java实现的图片合并方法,支持水平和垂直合并
- OC学习15——文件I/O体系
- 用惯了ORM,居然不会写分页SQL了
- OC学习14——谓词
- JavaScript 教程
- JavaScript 编辑工具
- JavaScript 与HTML
- JavaScript 与Java
- JavaScript 数据结构
- JavaScript 基本数据类型
- JavaScript 特殊数据类型
- JavaScript 运算符
- JavaScript typeof 运算符
- JavaScript 表达式
- JavaScript 类型转换
- JavaScript 基本语法
- JavaScript 注释
- Javascript 基本处理流程
- Javascript 选择结构
- Javascript if 语句
- Javascript if 语句的嵌套
- Javascript switch 语句
- Javascript 循环结构
- Javascript 循环结构实例
- Javascript 跳转语句
- Javascript 控制语句总结
- Javascript 函数介绍
- Javascript 函数的定义
- Javascript 函数调用
- Javascript 几种特殊的函数
- JavaScript 内置函数简介
- Javascript eval() 函数
- Javascript isFinite() 函数
- Javascript isNaN() 函数
- parseInt() 与 parseFloat()
- escape() 与 unescape()
- Javascript 字符串介绍
- Javascript length属性
- javascript 字符串函数
- Javascript 日期对象简介
- Javascript 日期对象用途
- Date 对象属性和方法
- Javascript 数组是什么
- Javascript 创建数组
- Javascript 数组赋值与取值
- Javascript 数组属性和方法
- Flutter中如何加载并预览本地的html文件的方法
- Android在自定义类中实现自定义监听器方式
- 解决WebView通过URL加载H5界面出现空白的问题
- kotlin 定义接口并实现回调的例子
- STL 总结与常见面试题
- kotlin中EditText赋值Type mismatch方式
- Kotlin 创建接口或者抽象类的匿名对象实例
- kotlin Context使用详解
- Android-ViewModel和LiveData使用详解
- 详解Android开发录音和播放音频的步骤(动态获取权限)
- Android自定义带圆角的ImageView
- 关于Kotlin写界面时诸多控件的点击事件
- Android webview注入JS代码 修改网页内容操作
- Kotlin 使用高阶函数实现回调方式
- Android WebView通过动态的修改js去拦截post请求参数实例