Ambari 集群 + 服务自动启动配置 API

Ambari cluster + Service Auto Start Configuration by API

Ambari 服务可以配置为在系统启动时自动启动。每个服务都可以配置为启动所有组件、master 和 worker,或者有选择地启动。

那么如何通过API使ambari集群中的所有服务在系统启动时自动启动?

备注 - 默认情况下禁用所有服务

您可以使用自动重启API,参考以下文档https://cwiki.apache.org/confluence/display/AMBARI/Recovery%3A+auto+start+components

语法。 以下是 API

的语法
curl -u admin:<password> -H "X-Requested-By: ambari" -X PUT 'http://<ambari host>:<ambari port>/api/v1/clusters/<cluster_name>/components?ServiceComponentInfo/component_name.in(<component name>)' -d '{"ServiceComponentInfo" : {"recovery_enabled":"true"}}'

示例。要为 YARN 服务的 app timeline server 组件设置自动重启,请使用 curl 命令,如下所示。

curl -u admin:<password> -H "X-Requested-By: ambari" -X PUT 'http://localhost:8080/api/v1/clusters/HDPCL/components?ServiceComponentInfo/component_name.in(APP_TIMELINE_SERVER)' -d '{"ServiceComponentInfo" : {"recovery_enabled":"true"}}'

注意:您可以从http://<ambarihost>:<ambari port>/api/v1/clusters/Fenton/components

中找到组件列表