问题描述
我是mesos和马拉松的新人。
I am new to mesos and marathon.
我有一个设置,其中一个docker是自定义的,另一个是mysql服务器实例。这两个是链接和传递信息。如何在mesos上部署?我正在使用单节点主设备和从设备。
I have a set up where in one docker is self defined and another is mysql server instance. These two are linked and pass information. How do I deploy this on mesos? I am using a single node master and slave set up currently.
推荐答案
要链接您的Docker容器,请使用。我在以下内容中使用解释设置。
To link your Docker containers use Mesos-DNS. I'm using Playa Mesos in the following to explain the setup.
在Playa上设置Mesos-DNS非常简单:使用图像并使用以下应用规范在Marathon上部署:
Setting up Mesos-DNS on Playa is straightforward: use the mesosphere/mesos-dns image and deploy it on Marathon using the following app spec:
{
"id": "mesos-dns",
"instances": 1,
"cpus": 1,
"mem": 512,
"cmd": "/mesos-dns -config=/config.json",
"container": {
"type": "DOCKER",
"docker": {
"image": "mesosphere/mesos-dns:latest",
"network": "HOST"
},
"volumes": [
{
"containerPath": "/config.json",
"hostPath": "/etc/mesos-dns/config.js",
"mode": "RW"
}
]
}
}
使用以下配置。 js
:
{
"zk": "zk://127.0.0.1:2181/mesos",
"refreshSeconds": 60,
"ttl": 60,
"domain": "mesos",
"port": 53,
"resolvers": ["10.0.2.3"],
"timeout": 5,
"email": "root.mesos-dns.mesos"
}
另外,请确保 resolv.conf
在第一个位置有正确的条目:
Also, make sure that the resolv.conf
has the right entry in first position:
$ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.0.1
nameserver 10.0.2.3
search net
然后您可以动态您的服务(在Vagrant框上):
You can then dynamically discover your service (on the Vagrant box) as so:
dig _$APPID._tcp.marathon.mesos SRV
其中 $ APPID
是用于部署自定义Docker映像的标识符。上述命令将告诉您马拉松分配给您的应用程序的IP和端口。您也可以使用Mesos-DNS 进行服务发现。
Where $APPID
is the identifier you used to deploy your custom Docker image. The above command will tell you the IP and the port Marathon has assigned to your app. You can alternatively use the Mesos-DNS HTTP API for service discovery.
注1:附带Mesos-DNS预先安装,所以你可以直接使用它进行服务发现。
Note 1: the DCOS comes with Mesos-DNS pre-installed, so you can directly use it for service discovery.
注意2:如果遇到您的应用不明白的问题 SRV
记录您可以尝试此解决方法:
Note 2: if you run into the issue that your app doesn't understand SRV
records you can try this workaround: https://github.com/the-tetanus-clinic/srv-shim
这篇关于新到mesos /马拉松。如何部署新的自定义泊坞窗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!