领事注销“失败"服务 [英] Consul deregister 'failing' services
问题描述
我在领事v0.5.2版本和&上运行领事.在Mesos中运行的服务.服务不断从一台服务器移到另一台服务器.
I have consul running on Consul v0.5.2 version & services running in Mesos. Services keep moving from 1 server to another.
是否可以注销处于失败"状态的领事中的服务?我可以使用该curl来获取处于失败状态的服务列表
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
问题是我们在领事UI中看到的时间过长了,我们有过时的数据&使得整个用户界面无法使用
Issue that we are seeing is over a period of time in consul UI we have stale data & making the whole UI unusable
推荐答案
领事默认情况下不会注销不健康的服务,而是将其标记为关键.
从Consul 0.7开始,有一个特殊选项(deregister_critical_service_after
),允许您定义取消不健康服务后的时间
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
从Consul 0.7更改日志
自动注销服务:添加了新的
deregister_critical_service_after
超时字段,用于运行状况检查 这将导致与该支票相关的服务得到 如果支票的关键期限超过超时时间,则取消注册. 这对于清理由本机注册的健康检查很有用 应用程序,或者在其他情况下服务可能不总是 彻底关机. GH-679
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
如果您是正常的马拉松比赛,则可以考虑使用 allegro/marathon-consul 它将注销任务死了
If you are usign Marathon then you can consider using allegro/marathon-consul it will deregister task when its dead
这篇关于领事注销“失败"服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!