Cloudera Manager Rest API更新服务配置

时间:2017-06-28 11:50:01

标签: rest yarn cloudera-manager

我想知道是否有人可以帮助我了解如何使用REST API更新在cloudera Manager中运行的服务。

我一直在浏览文档,并试图找到更新某些纱线配置的方法,但文档有点不清楚。 https://cloudera.github.io/cm_api/apidocs/v10/path__clusters_-clusterName-services-serviceName-_config.html

我觉得我很亲密,但到目前为止我的目标是:

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

但是,我得到了回复说:

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

服务名称CD-YARN-rrOCWOpV已在以下服务列表中标识:

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

我可以从中看到结果:

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

谢谢!

编辑:

看起来我写错了位置。所需要的是写入角色配置(在这种情况下,它是纱线RESOURCEMANAGER角色)。

在查询角色后,我能够将RESOURCEMANAGER角色的名称标识为CD-Y76ddf83d-RESOURCEMANAGER-45344d25a0e70b3b594d08b277a10937

然后更新json对象以匹配从查询中找到的对象: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

能够得到成功的回复:

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

再次感谢你!!

1 个答案:

答案 0 :(得分:2)

正确的属性是yarn_scheduler_maximum_allocation_mb