Ambari的API调用

  GET api/v1/clusters/HDP/configurations可以获得所有的配置信息(例如,http://hdp0:8080/api/v1/clusters/HDP/configurations);但是只是一级信息;
  比如我想要获得yarn的scheduler的节点信息,将会找到:
 1 {
 2       "href" : "http://hdp0:8080/api/v1/clusters/HDP/configurations?type=capacity-scheduler&tag=version1",
 3       "tag" : "version1",
 4       "type" : "capacity-scheduler",
 5       "version" : 1,
 6       "Config" : {
 7         "cluster_name" : "HDP",
 8         "stack_id" : "HDP-2.6"
 9       }
10     }
  这里注意,type就是配置页面的配置项的名称,在配置页面中该配置项为“Capacity Scheduler”,处理的时候,中间的空格处理为"-",全字小写即使节点名称。然后,通过访问href指定的链接:http://hdp0:8080/api/v1/clusters/HDP/configurations?type=capacity-scheduler&tag=version1就可以看到该配置的详细信息
 1 {
 2   "href" : "http://hdp0:8080/api/v1/clusters/HDP/configurations?type=capacity-scheduler&tag=version1",
 3   "items" : [
 4     {
 5       "href" : "http://hdp0:8080/api/v1/clusters/HDP/configurations?type=capacity-scheduler&tag=version1",
 6       "tag" : "version1",
 7       "type" : "capacity-scheduler",
 8       "version" : 1,
 9       "Config" : {
10         "cluster_name" : "HDP",
11         "stack_id" : "HDP-2.6"
12       },
13       "properties" : {
14         "capacity-scheduler" : "null",
15         "yarn.scheduler.capacity.default.minimum-user-limit-percent" : "100",
16         "yarn.scheduler.capacity.maximum-am-resource-percent" : "0.2",
17         "yarn.scheduler.capacity.maximum-applications" : "10000",
18         "yarn.scheduler.capacity.node-locality-delay" : "40",
19         "yarn.scheduler.capacity.resource-calculator" : "org.apache.hadoop.yarn.util.resource.DefaultResourceCalculator",
20         "yarn.scheduler.capacity.root.accessible-node-labels" : "*",
21         "yarn.scheduler.capacity.root.acl_administer_queue" : "*",
22         "yarn.scheduler.capacity.root.capacity" : "100",
23         "yarn.scheduler.capacity.root.default.acl_administer_jobs" : "*",
24         "yarn.scheduler.capacity.root.default.acl_submit_applications" : "*",
25         "yarn.scheduler.capacity.root.default.capacity" : "100",
26         "yarn.scheduler.capacity.root.default.maximum-capacity" : "100",
27         "yarn.scheduler.capacity.root.default.state" : "RUNNING",
28         "yarn.scheduler.capacity.root.default.user-limit-factor" : "1",
29         "yarn.scheduler.capacity.root.queues" : "default"
30       }
31     }
32   ]
33 }

 

posted on 2018-02-10 22:28  张叫兽的技术研究院  阅读(451)  评论(0编辑  收藏  举报

导航