Search code examples
resthadoop-yarncloudera-manager

Cloudera Manager Rest API update service config


I was wondering if anyone could help me understand how to update a service running in cloudera manager with the REST API.

I've been going through the docs, and am trying to find a way to update some yarn configurations, but the docs are a little unclear. https://cloudera.github.io/cm_api/apidocs/v10/path__clusters_-clusterName-services-serviceName-_config.html

I feel like I am close, but here is what I have so far:

curl -X PUT \
     -u <admin_username>:<admin_password> \
     -H "Content-Type: application/json" \
     -d '{"yarn.scheduler.maximum-allocation-mb":4696}' \
     http://<CM_HOST>:7180/api/v10/clusters/spark-2/services/CD-YARN-rrOCWOpV/config

However, I'm getting a response saying:

{
  "message" : "Unrecognized property: 'yarn.scheduler.maximum-allocation-mb'"
}

The service name CD-YARN-rrOCWOpV was identified in the list of services from:

http://<CM_HOST>:7180/api/v10/clusters/spark-2/services/

From which I could see the result:

{
    "name" : "CD-YARN-rrOCWOpV",
    "type" : "YARN",
    ....
}

Thank you!!

EDIT:

It looks like I was writing to the wrong location. What was needed was to write to role configuration (in this case it was the yarn RESOURCEMANAGER role).

After querying the roles, I was able to identify the name of the RESOURCEMANAGER role as CD-Y76ddf83d-RESOURCEMANAGER-45344d25a0e70b3b594d08b277a10937

And then updated the json object to match the object which is found from querying: http://<CM_HOST>/api/v10/clusters/spark-2/services/CD-YARN-rrOCWOpV/roles/CD-Y76ddf83d-RESOURCEMANAGER-45344d25a0e70b3b594d08b277a10937/config?view=full:

curl -X PUT \
     -u <admin_username>:<admin_password> \
     -H "Content-Type: application/json" \
     -d '{"items": [{"name" : "yarn_scheduler_maximum_allocation_mb", "value":"4696"}]}' \
     http://<CM_HOST>/api/v10/clusters/spark-2/services/CD-YARN-rrOCWOpV/roles/CD-Y76ddf83d-RESOURCEMANAGER-45344d25a0e70b3b594d08b277a10937/config

Was able to get a successful response:

{
  "items" : [ {
    "name" : "resource_manager_java_heapsize",
    "value" : "472907776"
  }, {
    "name" : "yarn_scheduler_maximum_allocation_mb",
    "value" : "4696"
  }, {
    "name" : "yarn_scheduler_maximum_allocation_vcores",
    "value" : "2"
  } ]

Thank you again!!


Solution

  • The correct attribute is yarn_scheduler_maximum_allocation_mb