领事不断删除服务

时间:2017-01-27 08:54:25

标签: consul

我在客户端模式下向主机添加了一个consul代理并添加了一项服务。 现在,它不断地默默地删除服务并再次注册

2017/01/27 08:25:23 [INFO] consul: member 'static' joined, marking health alive
2017/01/27 08:26:23 [INFO] consul: member 'static' joined, marking health alive
2017/01/27 08:28:23 [INFO] consul: member 'static' joined, marking health alive
2017/01/27 08:29:23 [INFO] consul: member 'static' joined, marking health alive
2017/01/27 08:30:23 [INFO] consul: member 'static' joined, marking health alive
2017/01/27 08:31:23 [INFO] consul: member 'static' joined, marking health alive
2017/01/27 08:33:23 [INFO] consul: member 'static' joined, marking health alive
2017/01/27 08:35:23 [INFO] consul: member 'static' joined, marking health alive
2017/01/27 08:37:23 [INFO] consul: member 'static' joined, marking health alive

服务配置很简单

{
  "service": {
    "tags": [
      "master"
    ],
    "address": "172.16.50.40",
    "port": 5432,
    "name": "staging-postgres"
  }
}

是否可以永久注册服务并仅手动取消注册?

1 个答案:

答案 0 :(得分:1)

Consul服务通常注册到特定节点(成员)。当该成员离开集群时,假定其所有服务也不健康,因此它们被标记为不健康。

了解为什么“静态”继续加入和离开群集会很有帮助。如果这是一种无法阻止的行为,最好将您的服务注册为external service

$ curl -X PUT -d '{"Datacenter": "dc1", "Node": "google",
   "Address": "www.google.com",
   "Service": {"Service": "search", "Port": 80}}'
   http://127.0.0.1:8500/v1/catalog/register