Support Questions

Find answers, ask questions, and share your expertise

How to automate configuration changes to non default Ambari config group?

avatar

/var/lib/ambari-server/resources/scripts/configs.sh is a great way to automate config changes, but seems it only supports the 'Default' config group. Is there a clean way to make changes to other config groups via API?

1 ACCEPTED SOLUTION

avatar

Yes you can use APIs. Sample:

A PUT call at http://ambari.host:8080/api/v1/clusters/c1/config_groups/2

with payload:

[{"ConfigGroup":{"id":2,"cluster_name":"c1","group_name":"A config group","tag":"HDFS","description":"A config group","hosts":[{"host_name":"host1"}],"service_config_version_note":"change","desired_configs":[{"type":"hdfs-site","tag":"version1443587493807","properties":{"dfs.replication":"2","dfs.datanode.du.reserved":"1073741822"}}]}}] 

will modify the config group. A POST to http://ambari.host:8080/api/v1/clusters/c1/config_groups would have created a new config group.

View solution in original post

5 REPLIES 5

avatar

Yes you can use APIs. Sample:

A PUT call at http://ambari.host:8080/api/v1/clusters/c1/config_groups/2

with payload:

[{"ConfigGroup":{"id":2,"cluster_name":"c1","group_name":"A config group","tag":"HDFS","description":"A config group","hosts":[{"host_name":"host1"}],"service_config_version_note":"change","desired_configs":[{"type":"hdfs-site","tag":"version1443587493807","properties":{"dfs.replication":"2","dfs.datanode.du.reserved":"1073741822"}}]}}] 

will modify the config group. A POST to http://ambari.host:8080/api/v1/clusters/c1/config_groups would have created a new config group.

avatar

Thanks @smohanty@hortonworks.com. Is it correct to say that we need to pass in previously configured properties as well as new properties together to the POST? (to avoid removal of existing properties)

avatar

hi smohanty

 

can you show me example for - how to config the dfs.replication by using full example ( as with curl ) ?

 

you mentioned the - version1443587493807 , according to what I need to set this "version number"?

Michael-Bronson

avatar

how do add new host on existing config_groups through ambari api

avatar
Community Manager

@mike_bronson7, as this is an older post, you would have a better chance of receiving a resolution by starting a new thread. This will also be an opportunity to provide details specific to your environment that could aid others in assisting you with a more accurate answer to your question. You can link this thread as a reference in your new post.



Regards,

Vidya Sargur,
Community Manager


Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.
Learn more about the Cloudera Community: