如何使用 Ambari API 通过文件更新配置

How to use Ambari API to Update Configs with a file

所以你不能直接更新单个项目,而必须获取与之关联的整个配置组。

我所做的是:

# read the tag of target config i want
curl -u $USERNAME:$PASSWORD -H "X-Requested-By: ambari" -X GET $BASE_URI?fields=Clusters/desired_configs > .temp_json

# download my configs
curl -u $USERNAME:$PASSWORD -H "X-Requested-By: ambari" -X GET "$BASE_URI/configurations?type=$CONFIG_TYPE&tag=$TARGET_TAG" > .configs_to_update

# update configs here > UPDATED_FILE_HERE

# ??? (upload the configs)

下一步是将配置上传到服务器,然后重新启动服务。我似乎无法弄清楚上传配置的 API 调用。有谁知道我如何使用 Ambari REST API 上传配置?

我不确定这是否对您的情况有帮助,但请查看我用来调整单个配置的命令:

python /var/lib/ambari-server/resources/scripts/configs.py -u admin -p admin -n HDP3 -l c7404.ambari.apache.org -t 8080 -a set -c cluster-env -k  ignore_groupsusers_create -v true