Hortonworks How to download HBase configuration files programatically? -


i have hdp cluster & have java client needs download configuration files (hdfs-site.xml, core-site.xml, hbase-site) @ runtime? how achieve this? cloudera manager provides provide url way downloading config files, have similar ambari?

you may use ambari api or command line utility download properties , values set configuration file. (but can download in json format not config file in xml format.)

api:

step1: find latest config version

curl -u admin:admin -h "x-requested-by: ambari" -x  http://<ambari_server_host>:8080/api/v1/clusters/<cluster_name>?fields=clusters/desired_configs  sample output {   "href" : "http://ambari_server_host:8080/api/v1/clusters/cluster_name?fields=clusters/desired_configs",   "clusters" : {     "cluster_name" : "cluster_name",     "version" : "hdp-2.0.6",     "desired_configs" : {       ...       "mapred-site" : {         "user" : "admin",         "tag" : "version1384716039631"       }       ...     }   } } 

step2: download configuration

curl -u admin:admin -h "x-requested-by: ambari" -x "http://<ambari_server_host>:8080/api/v1/clusters/<cluster_name>/configurations?type=mapred-site&tag=version1384716039631"  sample output {   "href" : "http://ambari_server_host:8080/api/v1/clusters/cluster_name/configurations?type=mapred-site&tag=version1384716039631",   "items" : [     {       "href" : "http://ambari_server_host:8080/api/v1/clusters/cluster_name/configurations?type=mapred-site&tag=version1384716039631",       "tag" : "version1384716039631",       "type" : "mapred-site",       "config" : {         "cluster_name" : "cluster_name"       },       "properties" : {       ... these property key-value pairs ...       }     }] } 

using command line utility

/var/lib/ambari-server/resources/scripts/configs.sh <ambari host> <cluster name> <config file type>  example: /var/lib/ambari-server/resources/scripts/configs.sh localhost sandbox mapred-site 

more details available @ following link

https://cwiki.apache.org/confluence/display/ambari/modify+configurations


Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -