所有 spray.io 个容器的 marathon-lb 健康检查失败

marathon-lb health check failing on all spray.io containers

我是 运行 DC/OS 1.7 马拉松磅。

spray.io 1.3.3 向所有 marathon-lb/HAProxy 健康检查调用返回 400:request has a relative URI and is missing a Host header 因此 marathon-lb 永远不会将任何请求路由到该服务。

马拉松json中的健康检查是:

   "healthChecks": [
     {
       "path": "/health",
       "protocol": "HTTP",
       "portIndex": 0,
       "gracePeriodSeconds": 10,
       "intervalSeconds": 2,
       "timeoutSeconds": 10,
       "maxConsecutiveFailures": 10,
       "ignoreHttp1xx": false
     }   ],

spray.io 在 docker 容器中的日志记录是:

[WARN] [08/19/2016 23:53:42.534] [asp-service-akka.actor.default-dispatcher-5] [akka://asp-service/user/IO-HTTP/listener-0/4] Illegal request, responding with status '400 Bad Request': Illegal request: Cannot establish effective request URI of HttpRequest(GET,/health,List(),Empty,HTTP/1.0), request has a relative URI and is missing a Host header

/health 端点通过 curl 对管理的 mesos 正常工作 ip:port。

我找不到任何关于通过 marathon-lb 使 HAProxy 更宽容或抑制 spray.io 的 400 的文档。

请尝试添加HAPROXY_BACKEND_HTTP_HEALTHCHECK_OPTIONS标签,您可以尝试将本例中的www替换为{hostname}https://github.com/mesosphere/marathon-lb/wiki#custom-http-headers-in-health-check

附加链接:

  1. https://github.com/mesosphere/marathon-lb/blob/master/Longhelp.md#haproxy_backend_http_healthcheck_options
  2. https://cbonte.github.io/haproxy-dconv/1.6/configuration.html#4.2-option%20httpchk

来自 mesosphere 团队,通过马拉松 "labels": { 部分在 header 中发送主机名 json:

    "HAPROXY_0_BACKEND_HTTP_HEALTHCHECK_OPTIONS": "  http-send-name-header Host\n  timeout check {healthCheckTimeoutSeconds}s\n"