Files
crawlab/documentation/Architecture/NodeMonitoring.md
2019-12-05 12:06:38 +08:00

10 lines
657 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
## 节点监控
Crawlab的节点监控是通过Redis来完成的。原理如下图。
![](https://crawlab.oss-cn-hangzhou.aliyuncs.com/v0.3.0/node-monitoring.png)
工作节点会不断更新心跳信息在Redis上利用`HSET nodes <node_id> <msg>`,心跳信息`<msg>`包含节点MAC地址IP地址当前时间戳
主节点会周期性获取Redis上的工作节点心跳信息。如果有工作节点的时间戳在60秒之前则考虑该节点为离线状态会在Redis中删除该节点的信息并在MongoDB中设置为"离线"如果时间戳在过去60秒之内则保留该节点信息在MongoDB中设置为"在线"。