Nomad:健康检查

Nomad : Health Check

需要帮助我有这个

service {
  name = "nginx"
  tags = [ "nginx", "web", "urlprefix-/nginx" ]
  port = "http"
  check {
    type = "tcp"
    interval = "10s"
    timeout = "2s"
  }
}

如果 returns 200 响应,我如何为特定 URI 添加健康状况 像 localhost:8080/test/index.html

就像添加另一个配置为使用 http 检查一样简单,其中 /health 由您的 nginx 在其发布的端口上提供服务:

service {
  name = "nginx"
  tags = [ "nginx", "web", "urlprefix-/nginx" ]
  port = "http"
  check {
    type = "tcp"
    interval = "10s"
    timeout = "2s"
  }
  check {
    type = "http"
    path = "/health"
    interval = "10s"
    timeout  = "2s"
  }
}

您可以在此处查看完整示例: https://www.nomadproject.io/docs/job-specification/index.html