Ambari 服务可以配置为在系统启动时自动启动。每个服务都可以配置为启动所有组件、master 和 worker,或者有选择地启动。
那么如何让ambari集群中的所有服务通过API在系统启动时自动启动呢?
备注 - 默认情况下禁用所有服务
最佳答案
您可以使用自动重启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"}}'
示例。为 app timeline server
设置自动重启YARN
的组成部分|服务使用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
中找到组件列表。
关于json - Ambari集群+服务自动启动配置API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46039540/