【问题标题】:DCOS connection refused on marathon-lbmarathon-lb 上的 DCOS 连接被拒绝
【发布时间】:2017-09-17 18:09:42
【问题描述】:

我已经启动并运行了 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": {}
    }
  ]
}

谁能帮忙。

【问题讨论】:

    标签: containers mesos marathon dcos


    【解决方案1】:

    使用public-ip:10000 从集群外部访问它(请参阅here 以查找公共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>
    

    【讨论】:

    • 非常感谢 js84,这实际上帮助解决了这个问题。感谢您的解释。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-08
    • 1970-01-01
    • 2023-03-21
    • 1970-01-01
    • 1970-01-01
    • 2019-01-30
    相关资源
    最近更新 更多