如何使用HTTP HEAD请求作为Marathon的健康检查?

时间:2016-11-28 13:57:52

标签: http containers marathon health-monitoring

看起来协议HTTPMESOS_HTTP仅执行GET请求。

这有效:

"healthChecks": [
  {
    "protocol": "COMMAND",
    "command": "curl -I http://0.0.0.0:5000/",
    "gracePeriodSeconds": 300,
    "intervalSeconds": 60,
    "timeoutSeconds": 20,
    "maxConsecutiveFailures": 3
  }
],

但是我发现这些简单的任务很多......我会期待更简单的事情,例如"method":"HEAD"

"healthChecks": [
  {
    "protocol": "HTTP",
    "path": "/",
    "portIndex": 5000,
    "method": "HEAD",
    "gracePeriodSeconds": 300,
    "intervalSeconds": 60,
    "timeoutSeconds": 20,
    "maxConsecutiveFailures": 3
  }
],

1 个答案:

答案 0 :(得分:1)

如果您需要/需要基于HTTP m(r,c)的运行状况检查,那么基于COMMAND的是您唯一的选择。仅基于HTTP的支持HEAD。有关详细信息,另请参阅Marathon docs