Update your Capacity Scheduler through REST API
Category : YARN
Sometime you want change your Capacity Scheduler through REST API or you have a requirement where you have to change your Capacity Scheduler configurations frequently via some script then this article will help you to do your work.
You can achieve it via following command.
[root@sandbox conf.server]# curl -v -u admin:admin -H “Content-Type: application/json” -H “X-Requested-By:ambari” -X PUT http://172.16.162.133:8080/api/v1/views/CAPACITY-SCHEDULER/versions/0.3.0/instanes/CS_1/resources/scheduler/configuration –data ‘{
“Clusters”: {
“desired_config”: [
{
“type”: “capacity-scheduler”,
“tag”: “version14534007568115”,
“service_config_version_note”: “To test”,
“properties”: {
“yarn.scheduler.capacity.maximum-am-resource-percent”: 0.2,
“yarn.scheduler.capacity.maximum-applications”: 10000,
“yarn.scheduler.capacity.node-locality-delay”: 40,
“yarn.scheduler.capacity.resource-calculator”: “org.apache.hadoop.yarn.util.resource.DefaultResourceCalculator”,
“yarn.scheduler.capacity.queue-mappings-override.enable”: false,
“yarn.scheduler.capacity.root.acl_administer_queue”: “*”,
“yarn.scheduler.capacity.root.capacity”: 100,
“yarn.scheduler.capacity.root.queues”: “default”,
“yarn.scheduler.capacity.root.accessible-node-labels”: “*”,
“yarn.scheduler.capacity.root.default.acl_submit_applications”: “*”,
“yarn.scheduler.capacity.root.default.maximum-capacity”: 100,
“yarn.scheduler.capacity.root.default.user-limit-factor”: 0.5,
“yarn.scheduler.capacity.root.default.state”: “RUNNING”,
“yarn.scheduler.capacity.root.default.capacity”: 100
}
}
]
}
}’
Note : In the above command you have to change following parameters.
- <ambari-server hostname or ip address >
- version of your CS view(you can get it in web url by visting your view )
- name of your view instance (you can get it in web url by visting your view )
After that you can refresh your queue by following command.
yarn rmadmin -refreshQueues
I hope it will help you to control your CS very easily.