我现在正在和领事一起玩。 为此,我有一个带有4个VM的流浪测试设置:
1:consul服务器,2到4:节点。
每个节点都运行一个consul代理,registrator和一些微服务(都使用Docker)。
启动集群后,所有服务和节点都在consul中标记为“传递”。
到现在为止还挺好。
现在,当我关闭其中一个节点时,consul将“Serf Health Status”标记为失败,但HTTP运行状况检查仍标记为“正在通过”,尽管整个VM已关闭。
根据consul文档,运行状况检查超时应该是10秒,因此我假设在关闭VM 10秒后将运行状况检查标记为失败。 知道为什么不呢?
I'm currently playing with consul. For that I have a vagrant test setup with 4 VMs:
1: consul server, 2 through 4: nodes.
Each node is running a consul agent, registrator and some micro-services (all with Docker).
After starting the cluster, all services and nodes are marked as "passing" in consul.
So far so good.
Now when I shut down one of the nodes, consul marks the "Serf Health Status" as failed, but the HTTP Health check is still marked as "passing" although the whole VM is shut down.
According to the consul documentation the health check timeout should be 10 seconds so I assumed the health checks to be marked as failed 10 seconds after shutdown of the VM. Any idea why it doesn't?
最满意答案
领事将在三天(72小时)后删除尚未收到确认的节点。
您可以通过http API对consul服务器执行curl命令以取消注册支票或服务。
首先获取服务名称和该服务的检查http://consulserver:8500/v1/health/checks/<service-name>
它将返回如下内容: [{"Node":"b7ea2063deb5","CheckID":"service:myapp","Name":"Service 'myapp' check","Status":"passing","Notes":"runs SELECT 1","Output":" online \n--------\n 1\n(1 row)\n\n","ServiceID":"myapp","ServiceName":"myapp","CreateIndex":11488,"ModifyIndex":11491}]
然后使用“CheckID”将运行状况检查标记为失败:
/ V1 /代理/检查/失败/
此端点与TTL类型的检查一起使用。 通过GET访问此端点时,检查状态将设置为严重,并且TTL时钟将复位。
http://consulserver:8500/v1/health/fail/service:myapp
如果响应是CheckID does not have associated TTL
那么你的支票不是TTL型。
有关不同支票类型的更多信息,请访问:
https://www.consul.io/docs/agent/checks.html
在查询http API时,如果没有从您收到的响应中获得任何实际输出,则很难为您提供正确的命令。
如果整个服务仍在运行,您也可以尝试取消注册
/ V1 /代理/服务/注销/
取消注册端点用于从本地代理中删除服务。 必须在斜杠后传递ServiceID。 代理将负责使用目录取消注册服务。 如果存在关联检查,则也会取消注册。
成功后返回代码为200。
https://www.consul.io/docs/agent/http/agent.html#agent_service_deregister
Okay, got this. It seems to be consul logic. As soon as the SERF fails, the last state of the service is maintained. Once I use the correct health-url (http://localhost:8500/v1/health/service/my-cool-service-name?passing), consul returns only the two remaining services as expected, unless of the "passing" state when looking directly at the service.
领事不承认消失的健康资源(Consul doesn't recognize disappeared health resource)我现在正在和领事一起玩。 为此,我有一个带有4个VM的流浪测试设置:
1:consul服务器,2到4:节点。
每个节点都运行一个consul代理,registrator和一些微服务(都使用Docker)。
启动集群后,所有服务和节点都在consul中标记为“传递”。
到现在为止还挺好。
现在,当我关闭其中一个节点时,consul将“Serf Health Status”标记为失败,但HTTP运行状况检查仍标记为“正在通过”,尽管整个VM已关闭。
根据consul文档,运行状况检查超时应该是10秒,因此我假设在关闭VM 10秒后将运行状况检查标记为失败。 知道为什么不呢?
I'm currently playing with consul. For that I have a vagrant test setup with 4 VMs:
1: consul server, 2 through 4: nodes.
Each node is running a consul agent, registrator and some micro-services (all with Docker).
After starting the cluster, all services and nodes are marked as "passing" in consul.
So far so good.
Now when I shut down one of the nodes, consul marks the "Serf Health Status" as failed, but the HTTP Health check is still marked as "passing" although the whole VM is shut down.
According to the consul documentation the health check timeout should be 10 seconds so I assumed the health checks to be marked as failed 10 seconds after shutdown of the VM. Any idea why it doesn't?
最满意答案
领事将在三天(72小时)后删除尚未收到确认的节点。
您可以通过http API对consul服务器执行curl命令以取消注册支票或服务。
首先获取服务名称和该服务的检查http://consulserver:8500/v1/health/checks/<service-name>
它将返回如下内容: [{"Node":"b7ea2063deb5","CheckID":"service:myapp","Name":"Service 'myapp' check","Status":"passing","Notes":"runs SELECT 1","Output":" online \n--------\n 1\n(1 row)\n\n","ServiceID":"myapp","ServiceName":"myapp","CreateIndex":11488,"ModifyIndex":11491}]
然后使用“CheckID”将运行状况检查标记为失败:
/ V1 /代理/检查/失败/
此端点与TTL类型的检查一起使用。 通过GET访问此端点时,检查状态将设置为严重,并且TTL时钟将复位。
http://consulserver:8500/v1/health/fail/service:myapp
如果响应是CheckID does not have associated TTL
那么你的支票不是TTL型。
有关不同支票类型的更多信息,请访问:
https://www.consul.io/docs/agent/checks.html
在查询http API时,如果没有从您收到的响应中获得任何实际输出,则很难为您提供正确的命令。
如果整个服务仍在运行,您也可以尝试取消注册
/ V1 /代理/服务/注销/
取消注册端点用于从本地代理中删除服务。 必须在斜杠后传递ServiceID。 代理将负责使用目录取消注册服务。 如果存在关联检查,则也会取消注册。
成功后返回代码为200。
https://www.consul.io/docs/agent/http/agent.html#agent_service_deregister
Okay, got this. It seems to be consul logic. As soon as the SERF fails, the last state of the service is maintained. Once I use the correct health-url (http://localhost:8500/v1/health/service/my-cool-service-name?passing), consul returns only the two remaining services as expected, unless of the "passing" state when looking directly at the service.
发布评论