manager配置服务原理

  原理
内容纲要

manager配置服务原理

概要描述


配置服务会从以下两处依次更新配置文件,

  1. 组件实际的依赖关系,也会按照其要求生成配置文件、拷贝到对应的目录。也就是要把所依赖的服务的文件拷贝过来(在生成依赖的服务那一步)。
  2. 以6.0.0为例,在/var/lib/transwarp-manager/master/content/meta/services/INCEPTOR/transwarp-6.0.0-final/templates/目录下的ftl文件会全部被默认渲染,然后一般都会拷贝到/etc/SERVICENAME/conf这个目录下。

详细说明


  1. 检查服务的相关目录是否存在
  2. 生成依赖的服务的配置文件,根据实际依赖关系,copy 依赖组件的配置文件
  3. 在 Manager 节点上从模板文件或者外部配置文件渲染成实际配置文件,
  4. 将渲染后的配置文件 copy 到 对应节点 的/var/lib/transwarp-manager/agent/operations/resource-tmp目录(如果同名覆盖(mv步骤就会报错))
  5. 将resource-tmp目录下的配置文件 move 至服务的配置文件对应目录
    TDH5.x由于没有添加外部配置文件的功能,所以只有一、二、四步。

第一步,检查目录是否存在

Tue Jan 14 11:52:52 CST 2020 [Manager] execute command:CreateDirsOp(List(/etc/inceptor1/),400,None,None)

Tue Jan 14 11:52:52 CST 2020 [Manager] execute command:CreateDirsOp(List(/etc/inceptor1/conf),755,None,None)

Tue Jan 14 11:52:52 CST 2020 [Manager] execute command:CreateDirsOp(List(/var/log/inceptor1),755,None,None)

第二步,根据模板目录下所有模板生成对应的配置文件,以hive-site.xml为例

  1. 从模板文件中渲染hive-site.xml
Tue Jan 14 11:52:52 CST 2020 [Manager] execute command: RenderFileOp(FreeMarker,hive-site.xml.ftl,/etc/inceptor1/conf/hive-site.xml,755,None,None)
  1. 已经生成hive-site.xml,从manager数据库的service_config表中读取,将模板文件中的变量变成实际的常量
Tue Jan 14 11:52:52 CST 2020 [Manager] rendering content of /etc/inceptor1/conf/hive-site.xml ...
Tue Jan 14 11:52:52 CST 2020 [Manager] content of host jiujiu-tdh-60 file /etc/inceptor1/conf/hive-site.xml generated
  1. 拷贝到目标节点的目录下
Tue Jan 14 11:52:52 CST 2020 [Manager] copying to host jiujiu-tdh-60 file /var/lib/transwarp-manager/agent/operations/resource-tmp/@etc@inceptor1@conf@hive-site.xml ...
Tue Jan 14 11:52:52 CST 2020 [Manager] host jiujiu-tdh-60 file /etc/inceptor1/conf/hive-site.xml copied at /var/lib/transwarp-manager/agent/operations/resource-tmp/@etc@inceptor1@conf@hive-site.xml

第三步,将外部配置文件test.xml生成,并且拷贝到目标节点的目录下

Tue Jan 14 11:52:52 CST 2020 [Manager] execute command: RenderAdditionalFileOp(test.xml,/etc/inceptor1/conf/test.xml,755,None,None)

Tue Jan 14 11:52:52 CST 2020 [Manager] copying to host jiujiu-tdh-60 additional file /var/lib/transwarp-manager/agent/operations/resource-tmp/@etc@inceptor1@conf@test.xml ...

Tue Jan 14 11:52:52 CST 2020 [Manager] host jiujiu-tdh-60 additional file /etc/inceptor1/conf/test.xml copied at /var/lib/transwarp-manager/agent/operations/resource-tmp/@etc@inceptor1@conf@test.xml

外部配置文件会在重启manager之前会缓存之前添加过的外部配置文件,每执行一次配置服务都会重新将历史的外部配置文件remove一次,重启之后则没有removing这一步了

Tue Jan 14 11:52:52 CST 2020 [Manager] execute command: RemoveAdditionalFileOp(hive-site1.xml,/etc/inceptor1/conf/hive-site1.xml)
Tue Jan 14 11:52:52 CST 2020 [Manager] host jiujiu-tdh-60 removing additional file /etc/inceptor1/conf/hive-site1.xml ...
Tue Jan 14 11:52:52 CST 2020 [Manager] Removed host jiujiu-tdh-60 additional file /etc/inceptor1/conf/hive-site1.xml ...

第四步,hive-site.xml文件被mv到对应的目标下

Tue Jan 14 11:52:52 CST 2020 [Agent] execute command: mkdir -p $(dirname "/etc/inceptor1/conf/hive-site.xml") && mv -f "/var/lib/transwarp-manager/agent/operations/resource-tmp/@etc@inceptor1@conf@hive-site.xml" "/etc/inceptor1/conf/hive-site.xml"  && chmod 755 "/etc/inceptor1/conf/hive-site.xml"

第五步,外部配置文件test.xml被mv到对应目录下

Tue Jan 14 11:52:52 CST 2020 [Agent] execute command: mkdir -p $(dirname "/etc/inceptor1/conf/test.xml") && mv -f "/var/lib/transwarp-manager/agent/operations/resource-tmp/@etc@inceptor1@conf@test.xml" "/etc/inceptor1/conf/test.xml"  && chmod 755 "/etc/inceptor1/conf/test.xml"
Tue Jan 14 11:52:52 CST 2020 [Agent] exit status: 0

这篇文章对您有帮助吗?

平均评分 0 / 5. 次数: 0

尚无评价,您可以第一个评哦!

非常抱歉,这篇文章对您没有帮助.

烦请您告诉我们您的建议与意见,以便我们改进,谢谢您。