游牧民族:健康检查

时间:2019-06-21 06:37:07

标签: ubuntu nginx nomad

需要帮助,我有这个

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

如果返回200响应,如何为特定URI添加运行状况 像localhost:8080 / test / index.html

1 个答案:

答案 0 :(得分:2)

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

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