简述
对于CDH版本我们可以参考Fayson的文章,本次是CDP7.1.7 CM7.4.4 ,下面只演示一个设置队列容量百分比的示例,其他请参考cloudera官网。
获取cookies文件
生成cookies.txt文件
curl -i -k -v -c cookies.txt -u admin:admin http://192.168.242.100:7180/api/v44/clusters
注: cookies.txt会有一定时间限制,因此每次获取都建议获取一份最新的文件
编写请求body的json文件
vim request.json
{
"properties": [
{ "name": "capacity", "value": "0" },
{ "name": "maximum-capacity", "value": "100" }
],
"siblingCapacities": [
{
"queuePath": "root.default",
"queueName": "default",
"capacity": "70",
"maximum-capacity": "100"
},
{
"queuePath": "root.aiops",
"queueName": "aiops",
"capacity": "30",
"maximum-capacity": "100"
}
],
"message": "Changed child capacities for root"
}
其中 capacity 则为设置的比例,其他参数都是字面意思不再解释.
执行CM REST API请求操作
curl -v -k -b cookies.txt -u admin:admin -H 'Content-Type: application/json' -X PUT -H 'referer: http://192.168.242.100:7180/cmf/clusters/Cluster%201/queue-manager/' http://192.168.242.100:7180/cmf/clusters/Cluster%201/queue-manager-api/api/v1/environments/dev/clusters/Cluster%201/resources/scheduler/partitions/default/queues/root.aiops -d @request.json
注: Cluster%201 表示的是我的集群名称 Cluster 1
其他设置操作请参考官网:
https://docs.cloudera.com/cdp-private-cloud-base/7.1.7/yarn-reference/topics/yarn-qm-API.html