2017-09-12 4 views
0

実行時に構成ファイル(hdfs-site.xml、core-site.xml、hbase-site)をダウンロードする必要のあるJavaクライアントを持つHDPクラスタ&がありますか?どのように私はこれを達成するのですか? Cloudera ManagerはURLファイルをダウンロードして設定ファイルを提供しますが、Ambariに類似したものはありますか?Hortonworks HBase設定ファイルをプログラム的にダウンロードするには?

答えて

0

Ambari APIまたはコマンドラインユーティリティを使用して、プロパティとその値を任意の設定ファイルにダウンロードできます。 (それはXML形式であるようしかし、あなたJSON形式設定ではないファイルでダウンロードできます)

API:

ステップ1:最新のconfigバージョン

curl -u admin:admin -H "X-Requested-By: ambari" -X GET 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" 
     } 
     ... 
    } 
    } 
} 

を探すステップ2:ダウンロードの設定

curl -u admin:admin -H "X-Requested-By: ambari" -X GET "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 ARE THE PROPERTY KEY-VALUE PAIRS ... 
     } 
    }] 
} 

コマンドラインユーティリティを使用する

/var/lib/ambari-server/resources/scripts/configs.sh get <ambari host> <cluster name> <config file type> 

Example: /var/lib/ambari-server/resources/scripts/configs.sh get localhost Sandbox mapred-site 

詳細はリンク

https://cwiki.apache.org/confluence/display/AMBARI/Modify+configurations

を以下で入手できます。
関連する問題