1

In Ambari cluster GUI ( Version 2.5.0.3 ) , each service has the Config button

And when we click on Config button we can see the list of all relevant parameters and their values

For example YARN service have the parameter - Minimum Container Size (Memory) in MB

Of course we can change from the ambari GUI the values of the parameters …

But we want to automate the changing of the values by API commands under bash script

I searched in google to find some info about the API that change the values under parameters , but without success

I’ll appreciate to get answers about this,

Community
  • 1
  • 1
King David
  • 500
  • 1
  • 7
  • 20

1 Answers1

2

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

SachinJose
  • 8,462
  • 4
  • 42
  • 63
  • yarn.nodemanager.resource.memory-mb is a real parmater in YARN service ? ( I just ask because under config I cant find this paramter – King David Aug 09 '17 at 06:30
  • is it possible to print all the parameters under config by API for the relevant service ? – King David Aug 09 '17 at 06:34
  • 1
    You can print all configuration parameter using the command - curl -H "X-Requested-By: ambari" -u admin:admin http://:8080/api/v1/clusters/ , I had mentioned this in the first part of the answer – SachinJose Aug 09 '17 at 07:26