- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
how to use Ambari API to add host to config groups without blueprint?
- Labels:
-
Apache Ambari
-
Apache YARN
Created ‎02-02-2017 10:06 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Is there a way I can use Ambari API call to add a host to different yarn config groups or move the host from the Default to customized? I can do it manually like this. But not sure if this feature is supported by API? This would be really helpful!
Thanks!
Created ‎02-03-2017 08:21 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Meng Meng
Ambari UI si completely driven from Ambari REST API
API call to create a new YARN config group and add a host from default group to it:
curl 'http://c6401.ambari.apache.org:8080/api/v1/clusters/c1/config_groups' -u admin:admin -H "X-Requested-By: ambari" -i -X POST --data '[{"ConfigGroup":{"group_name":"custom_group","tag":"YARN","description":"This is a custom group","desired_configs":[],"hosts":[{"host_name":"c6401.ambari.apache.org"}]}}]'
But if a host does not belong to Default config group and belongs to any other custom group and is desired to be moved to another custom config group then first it needs to be removed from prior custom config group and then be added to the desired new custom config group. The same API (use PUT instead of POST method) as mentioned above can be used to first remove it from the previous config group
curl 'http://c6401.ambari.apache.org:8080/api/v1/clusters/c1/config_groups/2' -u admin:admin -H "X-Requested-By: ambari" -i -X PUT --data '{"ConfigGroup":{"group_name":"custom_group","description":"This is a custom group","tag":"YARN","hosts":[],"desired_configs":[]}}' --compressed
Note: In above mentioned APIs, you need to change ambari-server hostname, cluster name, group_name, description and tag (service name) as applicable in your environment
Created ‎02-03-2017 08:21 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Meng Meng
Ambari UI si completely driven from Ambari REST API
API call to create a new YARN config group and add a host from default group to it:
curl 'http://c6401.ambari.apache.org:8080/api/v1/clusters/c1/config_groups' -u admin:admin -H "X-Requested-By: ambari" -i -X POST --data '[{"ConfigGroup":{"group_name":"custom_group","tag":"YARN","description":"This is a custom group","desired_configs":[],"hosts":[{"host_name":"c6401.ambari.apache.org"}]}}]'
But if a host does not belong to Default config group and belongs to any other custom group and is desired to be moved to another custom config group then first it needs to be removed from prior custom config group and then be added to the desired new custom config group. The same API (use PUT instead of POST method) as mentioned above can be used to first remove it from the previous config group
curl 'http://c6401.ambari.apache.org:8080/api/v1/clusters/c1/config_groups/2' -u admin:admin -H "X-Requested-By: ambari" -i -X PUT --data '{"ConfigGroup":{"group_name":"custom_group","description":"This is a custom group","tag":"YARN","hosts":[],"desired_configs":[]}}' --compressed
Note: In above mentioned APIs, you need to change ambari-server hostname, cluster name, group_name, description and tag (service name) as applicable in your environment
Created ‎02-07-2017 11:15 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@jaimin Thank you for the information. This resolved my issue!
Created ‎02-07-2017 11:27 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Glad to know that. Please accept the above answer when you get chance, so it can be noted as correct answer to this issue.
