Consul deregister 'failing' services

∥☆過路亽.° 提交于 2019-12-08 02:23:40

问题


I have consul running on Consul v0.5.2 version & services running in Mesos. Services keep moving from 1 server to another.

Is there way to deregister services in consul that are in 'failing' state? I am able to get the list of services in failing state using this curl

curl http://localhost:8500/v1/health/state/critical

Issue that we are seeing is over a period of time in consul UI we have stale data & making the whole UI unusable


回答1:


Consul by default do not deregister unhealthy services instead marks them as critical. From Consul 0.7 there is special option (deregister_critical_service_after) that allows you to define time after unhealthy service will be deregstered

From Consul 0.7 Changelog

Automatic Service Deregistration: Added a new deregister_critical_service_after timeout field for health checks which will cause the service associated with that check to get deregistered if the check is critical for longer than the timeout. This is useful for cleanup of health checks registered natively by applications, or in other situations where services may not always be cleanly shutdown. GH-679

If you are usign Marathon then you can consider using allegro/marathon-consul it will deregister task when its dead




回答2:


Along with what janisz said, you can also run your services in Nomad and Nomad will automatically register and deregister your services for you. See the Nomad Service Discovery docs for additional details.



来源:https://stackoverflow.com/questions/40010594/consul-deregister-failing-services

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!