0

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!!

Ryan G
  • 9,184
  • 4
  • 27
  • 27

1 Answers1

2

The correct attribute is yarn_scheduler_maximum_allocation_mb

jedijs
  • 563
  • 5
  • 14
  • Thank you for your response @jedijs. Unfortunately, that didn't work, same error `unrecognized property`. I tried a few different variations, without success. – Ryan G Jun 28 '17 at 17:09
  • Can you try with cm putting your value in this field? And activating cm debug, after you can view the call into cm server logs. – jedijs Jun 28 '17 at 17:13
  • Thank you! After some playing around it turns out that you were right. The correct attribute is `yarn_scheduler_maximum_allocation_mb`. I needed to push the change into the RESOURCE_MANAGER role, and I had to replicate the structure of the config which you get from querying the role config. I'll edit my answer with the correct syntax. Thank you – Ryan G Jun 28 '17 at 18:21