ambari + API syntax in order to change the parameters of the ambari services
Here are the steps to update service configurations using REST API.
- Find your cluster name using the below the url, if you don't know the cluster name, it requires in the below step -
http://<AMBARI-SERVER>:8080/api/v1/clusters/
- Find the property name, type from the cluster configurations json which can be accessed using the url, replace by cluster name from above step -
http://<AMBARI-SERVER>:8080/api/v1/clusters/<CLUSTER_NAME>
- Let's say I wanted to update YARN node manager property
yarn.nodemanager.resource.memory-mb
, Create a json file as below -
newconfigs.json
{ "Clusters": { "desired_config": { "type": "yarn-site", "tag": "version1502226523283", "properties": { "yarn.nodemanager.resource.memory-mb": "200000" } } }}
tag number should be unique - just give some random number, You can update this configuration in Ambari usng the below command. Below API uses REST - PUT method.
curl -H "X-Requested-By: ambari" -X PUT -u admin:admin -d @newconfigs.json http://<AMBARI-SERVER>:8080/api/v1/clusters/<CLUSTER_NAME>
Refer below ambari official REST api documentations for more details.
https://github.com/apache/ambari/blob/trunk/ambari-server/docs/api/v1/configuration.md