Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

how to find config type by API command

avatar

How to know the configuration type for parameter in ambari cluster by API

examples of configuration type - core-site, hdfs-site, mapred-queue-acls

lets say I want to find the configuration type for the parameter - "mapreduce.map.memory.mb” , in this case configuration type is mapred-site

Michael-Bronson
1 ACCEPTED SOLUTION

avatar
Master Mentor

@uri ben-ari

Using Amabri API you can try the following:

curl -iv -u admin:admin -H "X-Requested-By: ambari" -X GET  http://amb25101.example.com:8080/api/v1/clusters/plain_ambari/configurations?type=hdfs-site


Then get the latest version tag from the above call and then use that version in the API call.

curl -iv -u admin:admin -H "X-Requested-By: ambari" -X GET  http://amb25101.example.com:8080/api/v1/clusters/plain_ambari/configurations?type=hdfs-site&tag=vers...

.

View solution in original post

13 REPLIES 13

avatar
Master Mentor

@uri ben-ari

Something like this we can try using "config.sh" script. (one approach)

# /var/lib/ambari-server/resources/scripts//configs.sh -u admin -p admin -port 8080 get localhost test_cluster hdfs-site

.

avatar

thank you Jay SenSharma your example print all parameters that belong to he configuration type , but we need to know the configuration type for the parameter , I mean lets say we have some parameter how to know under which configuration type parameter is belong ?

Michael-Bronson

avatar

Jay - any suggestion?

Michael-Bronson

avatar
Master Mentor

@uri ben-ari

There is no reverse mapping ... i mean if you know a parameter then there is no direct way to find which XML file that parameter will go. Usually the admin or the component owner knows which configuration parameter will impact which service and component. And which configuration file (config_type) should have the mapping for that parameter.

.

The best way is to find more information about the parameter and then we will know where that parameter should get applied.

avatar
Master Mentor

Example: If i want to add a parameter "hadoop.security.auth_to_local" to some config ... then i will need to know about it.

I found in the following link that it can be applied to "core-site" , So i will need to add it to that config in ambari.

https://hadoop.apache.org/docs/r2.8.0/hadoop-project-dist/hadoop-common/core-default.xml

avatar
Master Mentor

@uri ben-ari

Using Amabri API you can try the following:

curl -iv -u admin:admin -H "X-Requested-By: ambari" -X GET  http://amb25101.example.com:8080/api/v1/clusters/plain_ambari/configurations?type=hdfs-site


Then get the latest version tag from the above call and then use that version in the API call.

curl -iv -u admin:admin -H "X-Requested-By: ambari" -X GET  http://amb25101.example.com:8080/api/v1/clusters/plain_ambari/configurations?type=hdfs-site&tag=vers...

.

avatar

just to clear my question , we have parameter but we not know to which configyuration type this parameter is belong

Michael-Bronson

avatar
Master Mentor

@uri ben-ari

When we make a call to /clusterName API then we should be able to find the right config that has this property.

curl -u admin:admin -H "X-Requested-By: ambari" -X GET  http://amb25101.example.com:8080/api/v1/clusters/plain_ambari


and then we can grep 'mapreduce.map.memory.mb' to find which config has thie entry.


avatar
Master Mentor
@uri ben-ari

"plain_cluster" is the Name of my ambari cluster. You will need to replace it with your cluster name. You can find the clustername using the following call.

curl -u admin:admin -H "X-Requested-By: ambari" -X GET  http://$AMBARI_HOST:8080/api/v1/clusters/