Ambari Agent 架构

Ambari Agent 架构图,由图中看,主要有3部分:

HeartBeatHandler:发送 HTTP 请求和 Ambari Server 进行交互。
ActionExecutor:Command 执行器。
AlertSchedulerHandler:Alert 处理器。

4个数据容器:

CommandQueue:存储需要执行的 Command。
ResultMap:存储 Command 的执行结果。
Alert definitions file:是一个文件,保存所有的 Alert 定义。
AlertCollect:存储 Alert 的检查结果。

简述一下 Ambari Agent 的工作流程:

1、HeartBeatHandler:收集组件当前状态(通过ResultMap)、Command 执行结果(通过ResultMap)、Alert 检查结果(通过 AlertCollect)等,封装到 HTTP Request 当中,发送给 Ambari Server;Ambari Server 响应请求,通过 HTTP Response 带回来需要执行的 Command、需要终止的 Command、发生修改的 Config、发生修改的 Alert 定义等,并把 Comand 和 修改的 Config 封装为 Agent Command 对象,存储到 CommandQueue 中;把修改的 Alert 定义,更新到 Alert definitions 文件中(如果 Alert definitions 文件发生了变化,需要通知 AlertSchedulerHandler 重新加载一遍)。
2、ActionExecutor:定期从 CommandQueue 中加载需要执行的 Command,找到 Command 对应的 Python 脚本,执行脚本,并把结果存储到 ResultMap 中。
3、AlertSchedulerHandler:从 Alert definitions 文件中加载所有 Alert 定义,根据 Alert 定义,找到对应的 Python 脚本,周期性执行,并把结果存储到 AlertCollect 中。

posted @ 2017-04-28 17:45  basenet855x  阅读(929)  评论(0编辑  收藏  举报