<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: (ambari) Append to -env templates (e.g. hadoop-env) cleanly? in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/ambari-Append-to-env-templates-e-g-hadoop-env-cleanly/m-p/96252#M9704</link>
    <description>&lt;OL&gt;
&lt;/OL&gt;&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/113/jstraub.html" nodeid="113"&gt;@Jonas Straub&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/113/jstraub.html" nodeid="113"&gt;&lt;/A&gt;2. Yep, that's what I've been doing. It works, but configuration changes shouldn't require such complexity. &lt;STRONG&gt;The API needs to be more human understandable.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt;An alternative is to be really hacky with 'configs.sh' and 'sed':&lt;/P&gt;&lt;PRE&gt;cd /tmp
configssh="/var/lib/ambari-server/resources/scripts/configs.sh"

${configssh} get localhost mycluster hive-env \
    | sed -e '1,3d' \
    -e '/^"content" : / s#",$#\\n\\n WHATEVER-YOU-WANT-TO-ADD \\n",#' \
    &amp;gt; /tmp/hive-env.json
${configssh} set localhost mycluster hive-env /tmp/hive-env.json&lt;/PRE&gt;</description>
    <pubDate>Fri, 30 Oct 2015 05:32:33 GMT</pubDate>
    <dc:creator>sroberts</dc:creator>
    <dc:date>2015-10-30T05:32:33Z</dc:date>
    <item>
      <title>(ambari) Append to -env templates (e.g. hadoop-env) cleanly?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/ambari-Append-to-env-templates-e-g-hadoop-env-cleanly/m-p/96249#M9701</link>
      <description>&lt;P&gt;How can we append to '-env' in a clean programatic way?&lt;/P&gt;&lt;P&gt;2 scenarios:&lt;/P&gt;&lt;OL&gt;
&lt;LI&gt;&lt;STRONG&gt;Blueprints&lt;/STRONG&gt;: How to append to 'hadoop-env' at cluster build?&lt;OL&gt;
&lt;LI&gt;It appears you would have to set the entire block. Which means fetching from an existing cluster and setting the entire thing. This is not reliable, nor is it sustainable since the defaults may change between versions of Ambari/HDP.&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;LI&gt;How to change programmatically after cluster build?
&lt;OL&gt;
&lt;LI&gt;Ideally you would be able to append to the existing configuration.&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Fri, 30 Oct 2015 02:29:40 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/ambari-Append-to-env-templates-e-g-hadoop-env-cleanly/m-p/96249#M9701</guid>
      <dc:creator>sroberts</dc:creator>
      <dc:date>2015-10-30T02:29:40Z</dc:date>
    </item>
    <item>
      <title>Re: (ambari) Append to -env templates (e.g. hadoop-env) cleanly?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/ambari-Append-to-env-templates-e-g-hadoop-env-cleanly/m-p/96250#M9702</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Regarding Option1: &lt;/STRONG&gt;I was under the impression that you can use xxxx-env blocks without defining the whole block within blueprints, e.g. I was using a blueprint recently to add the existing MySQL configuration to "hive-env". But I didn't check hive-env after the blueprint installation via the Ambari API, so I am not sure if the hive-env was messed up or not (I'll run another test in a week or so), Hive did start though.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Regarding Option 2:&lt;/STRONG&gt; You can use a simple Python script, here are the necessary steps&lt;/P&gt;&lt;P&gt;1. Find current config version ("tag"-field), e.g. cluster-env&lt;/P&gt;&lt;PRE&gt;curl -H "X-Requested-By:ambari" -u admin:your-pw -X GET "http://c6601.ambari.apache.org:8080/api/v1/clusters/bigdata?fields=Clusters/desired_configs/cluster-env"&lt;/PRE&gt;&lt;P&gt;Response:&lt;/P&gt;&lt;PRE&gt;{
  "href" : "http://c6601.ambari.apache.org:8080/api/v1/clusters/bigdata?fields=Clusters/desired_configs/cluster-env",
  "Clusters" : {
    "cluster_name" : "bigdata",
    "version" : "HDP-2.3",
    "desired_configs" : {
      "cluster-env" : {
        "tag" : "version1434441386979",
        "user" : "admin",
        "version" : 7
      }
    }
  }
}&lt;/PRE&gt;&lt;P&gt;&lt;EM&gt;The tag-field is import =&amp;gt; version1434441386979&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;2. Export current config (example result below) &lt;/P&gt;&lt;PRE&gt;curl -H "X-Requested-By:ambari" -u admin:your-pw -X GET "http://c6601.ambari.apache.org:8080/api/v1/clusters/bigdata/configurations?type=cluster-env&amp;amp;tag=version1434441386979" &lt;/PRE&gt;&lt;P&gt;Response (truncated):&lt;/P&gt;&lt;PRE&gt;{
   "href":"http://c6601.ambari.apache.org:8080/api/v1/clusters/bigdata/configurations?type=cluster-env&amp;amp;tag=version1434441386979",
   "items":[
      {
         "href":"http://c6601.ambari.apache.org:8080/api/v1/clusters/bigdata/configurations?type=cluster-env&amp;amp;tag=version1434441386979",
         "tag":"version1434441386979",
         "type":"cluster-env",
         "version":7,
         "Config":{
            "cluster_name":"bigdata"
         },
         "properties":{
            ...
            "smokeuser_keytab":"/etc/security/keytabs/smokeuser.headless.keytab",
            "smokeuser_principal_name":"ambari-qa@EXAMPLE.COM",
            "sqoop_tar_destination_folder":"hdfs:///hdp/apps/{{ hdp_stack_version }}/sqoop/",
            "sqoop_tar_source":"/usr/hdp/current/sqoop-client/sqoop.tar.gz",
            "tez_tar_destination_folder":"hdfs:///hdp/apps/{{ hdp_stack_version }}/tez/",
            "tez_tar_source":"/usr/hdp/current/tez-client/lib/tez.tar.gz",
            "user_group":"hadoop"
         }
      }
   ]
}&lt;/PRE&gt;&lt;P&gt; 3. Prepare the new configuration by copying all properties from above in the following template.&lt;/P&gt;&lt;P&gt;Template:&lt;/P&gt;&lt;PRE&gt;{ 
  "Clusters" : {
    "desired_configs" : { 
      "type" : "cluster-env", 
      "tag" : "version&amp;lt;INSERT_CURRENT_TIMESTAMP_IN_MILLISECONDS&amp;gt;", 
      "properties" : { 
        &amp;lt;INSERT_EXPORTED_CONFIGURATION_PROPERTIES_FROM_ABOVE&amp;gt;
      }
    }
  }
}&lt;/PRE&gt;&lt;P&gt;For example, lets say my &lt;EM&gt;user_group&lt;/EM&gt; is not &lt;STRONG&gt;hadoop&lt;/STRONG&gt; anymore, from now on its &lt;STRONG&gt;horton&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;{ 
  "Clusters" : {
    "desired_configs" : { 
      "type" : "cluster-env", 
      "tag" : "version&amp;lt;INSERT_CURRENT_TIMESTAMP_IN_MILLISECONDS&amp;gt;", 
      "properties" : { 
        ...
        "smokeuser_keytab" : "/etc/security/keytabs/smokeuser.headless.keytab",
        "smokeuser_principal_name" : "ambari-qa@EXAMPLE.COM",
        "sqoop_tar_destination_folder" : "hdfs:///hdp/apps/{{ hdp_stack_version }}/sqoop/",
        "sqoop_tar_source" : "/usr/hdp/current/sqoop-client/sqoop.tar.gz",
        "tez_tar_destination_folder" : "hdfs:///hdp/apps/{{ hdp_stack_version }}/tez/",
        "tez_tar_source" : "/usr/hdp/current/tez-client/lib/tez.tar.gz",
        "user_group" : "horton"
      }
    }
  }
}&lt;/PRE&gt;&lt;P&gt;5. Final step: Upload new configuration to cluster &lt;/P&gt;&lt;PRE&gt;curl -H "X-Requested-By:ambari" -u admin:your-pw -X PUT "http://c6601.ambari.apache.org:8080/api/v1/clusters/bigdata" -d @&amp;lt;JSON_PAYLOAD_FROM_ABOVE&amp;gt;&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;DONE &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Hope it helps&lt;/P&gt;&lt;P&gt;Jonas&lt;/P&gt;</description>
      <pubDate>Fri, 30 Oct 2015 04:26:52 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/ambari-Append-to-env-templates-e-g-hadoop-env-cleanly/m-p/96250#M9702</guid>
      <dc:creator>jstraub</dc:creator>
      <dc:date>2015-10-30T04:26:52Z</dc:date>
    </item>
    <item>
      <title>Re: (ambari) Append to -env templates (e.g. hadoop-env) cleanly?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/ambari-Append-to-env-templates-e-g-hadoop-env-cleanly/m-p/96251#M9703</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/113/jstraub.html" nodeid="113"&gt;@Jonas Straub&lt;/A&gt; &lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Let me know what you find. I bet you wiped it out. But would love if it worked properly.&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Fri, 30 Oct 2015 05:31:43 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/ambari-Append-to-env-templates-e-g-hadoop-env-cleanly/m-p/96251#M9703</guid>
      <dc:creator>sroberts</dc:creator>
      <dc:date>2015-10-30T05:31:43Z</dc:date>
    </item>
    <item>
      <title>Re: (ambari) Append to -env templates (e.g. hadoop-env) cleanly?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/ambari-Append-to-env-templates-e-g-hadoop-env-cleanly/m-p/96252#M9704</link>
      <description>&lt;OL&gt;
&lt;/OL&gt;&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/113/jstraub.html" nodeid="113"&gt;@Jonas Straub&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/113/jstraub.html" nodeid="113"&gt;&lt;/A&gt;2. Yep, that's what I've been doing. It works, but configuration changes shouldn't require such complexity. &lt;STRONG&gt;The API needs to be more human understandable.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt;An alternative is to be really hacky with 'configs.sh' and 'sed':&lt;/P&gt;&lt;PRE&gt;cd /tmp
configssh="/var/lib/ambari-server/resources/scripts/configs.sh"

${configssh} get localhost mycluster hive-env \
    | sed -e '1,3d' \
    -e '/^"content" : / s#",$#\\n\\n WHATEVER-YOU-WANT-TO-ADD \\n",#' \
    &amp;gt; /tmp/hive-env.json
${configssh} set localhost mycluster hive-env /tmp/hive-env.json&lt;/PRE&gt;</description>
      <pubDate>Fri, 30 Oct 2015 05:32:33 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/ambari-Append-to-env-templates-e-g-hadoop-env-cleanly/m-p/96252#M9704</guid>
      <dc:creator>sroberts</dc:creator>
      <dc:date>2015-10-30T05:32:33Z</dc:date>
    </item>
    <item>
      <title>Re: (ambari) Append to -env templates (e.g. hadoop-env) cleanly?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/ambari-Append-to-env-templates-e-g-hadoop-env-cleanly/m-p/96253#M9705</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/150/sroberts.html" nodeid="150"&gt;@Sean Roberts&lt;/A&gt; Just finalized my blueprint installation with a modified hive-env. I basically just configured an existing MySQL database in hive-env in the blueprint. Ambari added the rest of the hive-env variables to the configuration, so there are no config values missing.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Nov 2015 21:10:41 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/ambari-Append-to-env-templates-e-g-hadoop-env-cleanly/m-p/96253#M9705</guid>
      <dc:creator>jstraub</dc:creator>
      <dc:date>2015-11-09T21:10:41Z</dc:date>
    </item>
    <item>
      <title>Re: (ambari) Append to -env templates (e.g. hadoop-env) cleanly?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/ambari-Append-to-env-templates-e-g-hadoop-env-cleanly/m-p/96254#M9706</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/113/jstraub.html" nodeid="113"&gt;@Jonas Straub&lt;/A&gt; : &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;gt;&amp;gt; Regarding Option1: &lt;/STRONG&gt;I was under the impression that you can use xxxx-env blocks without defining the whole block within blueprints, e.g. I was using a blueprint recently to add the existing MySQL configuration to "hive-env". But I didn't check hive-env after the blueprint installation via the Ambari API, so I am not sure if the hive-env was messed up or not (I'll run another test in a week or so), Hive did start though.&lt;/P&gt;&lt;P&gt;Did you ever get to  test this? Seems like it is not working.&lt;/P&gt;&lt;P&gt;I tried using defining "content" property for hadoop-env.sh for just HADOOP_NAMENODE_OPTS and HADOOP_DATANODE_OPTS as follows. hadoop-env.sh resulted in just only those two lines and nothing else.&lt;/P&gt;&lt;P&gt;"hadoop-env": {&lt;/P&gt;&lt;P style="margin-left: 20px;"&gt;              "properties": {&lt;/P&gt;&lt;P style="margin-left: 40px;"&gt;"content" : "export HADOOP_NAMENODE_OPTS=\"-server -XX:ParallelGCThreads=8 -XX:+UseConcMarkSweepGC-XX:ErrorFile={{hdfs_log_dir_prefix}}/$USER/hs_err_pid%p.log -XX:NewSize={{namenode_opt_newsize}} -XX:MaxNewSize={{namenode_opt_maxnewsize}} -XX:PermSize={{namenode_opt_permsize}} -XX:MaxPermSize={{namenode_opt_maxpermsize}} -Xloggc:{{hdfs_log_dir_prefix}}/$USER/gc.log-`date +'%Y%m%d%H%M'` -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -Xms{{namenode_heapsize}} -Xmx{{namenode_heapsize}} -Dhadoop.security.logger=INFO,DRFAS -Dhdfs.audit.logger=INFO,DRFAAUDIT ${HADOOP_NAMENODE_OPTS}\"\n export HADOOP_DATANODE_OPTS=\"-server -XX:ParallelGCThreads=4 -XX:+UseConcMarkSweepGC -XX:ErrorFile={{hdfs_log_dir_prefix}}/$USER/hs_err_pid%p.log -XX:NewSize=200m-XX:MaxNewSize=200m -XX:PermSize=128m -XX:MaxPermSize=256m -Xloggc:{{hdfs_log_dir_prefix}}/$USER/gc.log-`date +'%Y%m%d%H%M'` -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -Xms{{dtnode_heapsize}}-Xmx{{dtnode_heapsize}} -Dhadoop.security.logger=INFO,DRFAS -Dhdfs.audit.logger=INFO,DRFAAUDIT ${HADOOP_DATANODE_OPTS}\"\n",&lt;/P&gt;&lt;P style="margin-left: 40px;"&gt;                "namenode_opt_maxnewsize": "361m",&lt;/P&gt;&lt;P style="margin-left: 40px;"&gt;                "namenode_opt_newsize": "361m",&lt;/P&gt;&lt;P style="margin-left: 40px;"&gt;        "namenode_heapsize": "2887m",&lt;/P&gt;&lt;P style="margin-left: 40px;"&gt;        "dtnode_heapsize": "2887m",&lt;/P&gt;&lt;P style="margin-left: 40px;"&gt;"dfs_ha_enabled": "true",&lt;/P&gt;&lt;P style="margin-left: 40px;"&gt;"hdfs_log_dir_prefix": "/data/var/log/hadoop",&lt;/P&gt;&lt;P style="margin-left: 40px;"&gt;"mapred_log_dir_prefix": "/data/var/log/hadoop-mapreduce",&lt;/P&gt;&lt;P style="margin-left: 40px;"&gt;"yarn_log_dir_prefix": "/data/var/log/hadoop-yarn",&lt;/P&gt;&lt;P style="margin-left: 40px;"&gt;"hive_log_dir": "/data/var/log/hive",&lt;/P&gt;&lt;P style="margin-left: 40px;"&gt;"zk_log_dir": "/data/var/log/zookeeper",&lt;/P&gt;&lt;P style="margin-left: 40px;"&gt;"metrics_monitor_log_dir": "/data/var/log/ambari-metrics-collector",&lt;/P&gt;&lt;P style="margin-left: 40px;"&gt;"metrics_collector_log_dir": "/data/var/log/ambari-metrics-monitor",&lt;/P&gt;&lt;P style="margin-left: 40px;"&gt;"kafka_log_dir": "/data/var/log/kafka",&lt;/P&gt;&lt;P style="margin-left: 40px;"&gt;"spark_log_dir": "/data/var/log/spark"&lt;/P&gt;&lt;P style="margin-left: 40px;"&gt;              }&lt;/P&gt;&lt;P style="margin-left: 20px;"&gt;        }&lt;/P&gt;</description>
      <pubDate>Wed, 27 Apr 2016 08:06:46 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/ambari-Append-to-env-templates-e-g-hadoop-env-cleanly/m-p/96254#M9706</guid>
      <dc:creator>dheeren</dc:creator>
      <dc:date>2016-04-27T08:06:46Z</dc:date>
    </item>
  </channel>
</rss>

