DCOS 连接在 marathon-lb 上被拒绝
DCOS connection refused on marathon-lb
我已经启动了 dcos 运行。我创建了一个服务,我可以通过 ip:port 访问它,但是当我尝试用 marathon-lb 做同样的事情时,我就是无法访问它。我试过 curl http://marathon-lb.marathon.mesos:10000/ 10000 作为端口号,我仍然得到连接拒绝。
这是我的 json 服务:
{
"id": "/nginx-external",
"cmd": null,
"cpus": 0.1,
"mem": 65,
"disk": 0,
"instances": 1,
"acceptedResourceRoles": [],
"container": {
"type": "DOCKER",
"volumes": [],
"docker": {
"image": "nginx:1.7.7",
"network": "BRIDGE",
"portMappings": [
{
"containerPort": 80,
"hostPort": 2000,
"servicePort": 10000,
"protocol": "tcp",
"labels": {}
}
],
"privileged": false,
"parameters": [],
"forcePullImage": true
}
},
"healthChecks": [
{
"gracePeriodSeconds": 10,
"intervalSeconds": 2,
"timeoutSeconds": 10,
"maxConsecutiveFailures": 10,
"portIndex": 0,
"path": "/",
"protocol": "HTTP",
"ignoreHttp1xx": false
}
],
"labels": {
"HAPROXY_GROUP": "external"
},
"portDefinitions": [
{
"port": 10000,
"protocol": "tcp",
"name": "default",
"labels": {}
}
]
}
谁能帮忙。
使用 public-ip:10000
从集群外部访问它(参见 here 查找 public ip)和使用 curl http://marathon-lb.marathon.mesos:10000/
从集群内部访问它都工作正常。请注意,您需要安装 marathon-lb (dcos package install marathon-lb
) 并且 marathon-lb.marathon.mesos
只能从集群内部解析。
为了调试 marathon-lb 问题,我通常首先检查 haproxy 统计信息:https://dcos.io/docs/1.9/networking/marathon-lb/marathon-lb-advanced-tutorial/#deploy-an-external-load-balancer-with-marathon-lb
来自集群外部
来自集群内部
core@ip-10-0-4-343 ~ $ curl http://marathon-lb.marathon.mesos:10000/
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
我已经启动了 dcos 运行。我创建了一个服务,我可以通过 ip:port 访问它,但是当我尝试用 marathon-lb 做同样的事情时,我就是无法访问它。我试过 curl http://marathon-lb.marathon.mesos:10000/ 10000 作为端口号,我仍然得到连接拒绝。
这是我的 json 服务:
{
"id": "/nginx-external",
"cmd": null,
"cpus": 0.1,
"mem": 65,
"disk": 0,
"instances": 1,
"acceptedResourceRoles": [],
"container": {
"type": "DOCKER",
"volumes": [],
"docker": {
"image": "nginx:1.7.7",
"network": "BRIDGE",
"portMappings": [
{
"containerPort": 80,
"hostPort": 2000,
"servicePort": 10000,
"protocol": "tcp",
"labels": {}
}
],
"privileged": false,
"parameters": [],
"forcePullImage": true
}
},
"healthChecks": [
{
"gracePeriodSeconds": 10,
"intervalSeconds": 2,
"timeoutSeconds": 10,
"maxConsecutiveFailures": 10,
"portIndex": 0,
"path": "/",
"protocol": "HTTP",
"ignoreHttp1xx": false
}
],
"labels": {
"HAPROXY_GROUP": "external"
},
"portDefinitions": [
{
"port": 10000,
"protocol": "tcp",
"name": "default",
"labels": {}
}
]
}
谁能帮忙。
使用 public-ip:10000
从集群外部访问它(参见 here 查找 public ip)和使用 curl http://marathon-lb.marathon.mesos:10000/
从集群内部访问它都工作正常。请注意,您需要安装 marathon-lb (dcos package install marathon-lb
) 并且 marathon-lb.marathon.mesos
只能从集群内部解析。
为了调试 marathon-lb 问题,我通常首先检查 haproxy 统计信息:https://dcos.io/docs/1.9/networking/marathon-lb/marathon-lb-advanced-tutorial/#deploy-an-external-load-balancer-with-marathon-lb
来自集群外部
来自集群内部
core@ip-10-0-4-343 ~ $ curl http://marathon-lb.marathon.mesos:10000/
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>