Faberge eggs
Faberge eggs

Reputation: 141

Consul constantly removes service

I had added a consul agent to the host in client mode and added a service. And now, it constantly and silently removes the service and registers again

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

The service config is simple

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

Is it posible to register a service forever and deregister only manually?

Upvotes: 0

Views: 635

Answers (1)

sethvargo
sethvargo

Reputation: 26997

Consul services are usually registered to a specific node (member). When that member leaves the cluster, it is assumed that all its services are also unhealthy, therefore they are marked as unhealthy.

It would be helpful to know why "static" continues to join and leave the cluster. If that's a behavior that cannot be prevented, it might be best to register your service as an 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

Upvotes: 1

Related Questions