Updated Branches: refs/heads/trunk 7b3559da6 -> f319832a8
AMBARI-2775. Ability to add second Namenode to the cluster for 2.0.* stack. (swagle) Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/f319832a Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/f319832a Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/f319832a Branch: refs/heads/trunk Commit: f319832a8d25b64694a7318a5f6c2a208a1946ad Parents: 7b3559d Author: Siddharth Wagle <[email protected]> Authored: Tue Jul 30 17:32:09 2013 -0700 Committer: Siddharth Wagle <[email protected]> Committed: Tue Jul 30 18:15:25 2013 -0700 ---------------------------------------------------------------------- .../hdp-hadoop/manifests/namenode/format.pp | 48 +++++++++++--------- .../hdp-hadoop/templates/hadoop-env.sh.erb | 3 ++ .../modules/hdp-oozie/files/oozieSmoke2.sh | 2 +- .../main/puppet/modules/hdp/manifests/params.pp | 16 ++++++- 4 files changed, 44 insertions(+), 25 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/f319832a/ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/namenode/format.pp ---------------------------------------------------------------------- diff --git a/ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/namenode/format.pp b/ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/namenode/format.pp index 481e822..fb9d2ab 100644 --- a/ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/namenode/format.pp +++ b/ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/namenode/format.pp @@ -27,31 +27,35 @@ class hdp-hadoop::namenode::format( $hdfs_user = $hdp::params::hdfs_user $hadoop_conf_dir = $hdp-hadoop::params::conf_dir - if ($force == true) { - hdp-hadoop::exec-hadoop { 'namenode -format' : - command => 'namenode -format', - kinit_override => true, - notify => Hdp::Exec['set namenode mark'] - } - } else { + # Avoid formatting standby namenode in a HA cluster + if ($hdp::params::dfs_ha_enabled == false) { + if ($force == true) { + hdp-hadoop::exec-hadoop { 'namenode -format' : + command => 'namenode -format', + kinit_override => true, + notify => Hdp::Exec['set namenode mark'] + } + } else { + file { '/tmp/checkForFormat.sh': - ensure => present, - source => "puppet:///modules/hdp-hadoop/checkForFormat.sh", - mode => '0755' - } + ensure => present, + source => "puppet:///modules/hdp-hadoop/checkForFormat.sh", + mode => '0755' + } - exec { '/tmp/checkForFormat.sh': - command => "sh /tmp/checkForFormat.sh ${hdfs_user} ${hadoop_conf_dir} ${mark_dir} ${dfs_name_dir} ", - unless => "test -d ${mark_dir}", - require => File['/tmp/checkForFormat.sh'], - path => '/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin', - logoutput => "true", - notify => Hdp::Exec['set namenode mark'] + exec { '/tmp/checkForFormat.sh': + command => "sh /tmp/checkForFormat.sh ${hdfs_user} ${hadoop_conf_dir} ${mark_dir} ${dfs_name_dir} ", + unless => "test -d ${mark_dir}", + require => File['/tmp/checkForFormat.sh'], + path => '/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin', + logoutput => "true", + notify => Hdp::Exec['set namenode mark'] + } } - } - hdp::exec { 'set namenode mark' : - command => "mkdir -p ${mark_dir}", - refreshonly => true + hdp::exec { 'set namenode mark' : + command => "mkdir -p ${mark_dir}", + refreshonly => true + } } } http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/f319832a/ambari-agent/src/main/puppet/modules/hdp-hadoop/templates/hadoop-env.sh.erb ---------------------------------------------------------------------- diff --git a/ambari-agent/src/main/puppet/modules/hdp-hadoop/templates/hadoop-env.sh.erb b/ambari-agent/src/main/puppet/modules/hdp-hadoop/templates/hadoop-env.sh.erb index e9e5732..0da12a8 100644 --- a/ambari-agent/src/main/puppet/modules/hdp-hadoop/templates/hadoop-env.sh.erb +++ b/ambari-agent/src/main/puppet/modules/hdp-hadoop/templates/hadoop-env.sh.erb @@ -108,3 +108,6 @@ done #Add libraries required by nodemanager MAPREDUCE_LIBS=<%=scope.function_hdp_template_var("mapreduce_libs_path")%> export HADOOP_CLASSPATH=${HADOOP_CLASSPATH}${JAVA_JDBC_LIBS}:${MAPREDUCE_LIBS} + +# Setting path to hdfs command line +export HADOOP_LIBEXEC_DIR=<%=scope.function_hdp_template_var("hadoop_libexec_dir")%> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/f319832a/ambari-agent/src/main/puppet/modules/hdp-oozie/files/oozieSmoke2.sh ---------------------------------------------------------------------- diff --git a/ambari-agent/src/main/puppet/modules/hdp-oozie/files/oozieSmoke2.sh b/ambari-agent/src/main/puppet/modules/hdp-oozie/files/oozieSmoke2.sh index e1f31f5..406dbe0 100644 --- a/ambari-agent/src/main/puppet/modules/hdp-oozie/files/oozieSmoke2.sh +++ b/ambari-agent/src/main/puppet/modules/hdp-oozie/files/oozieSmoke2.sh @@ -64,7 +64,7 @@ export NNHOST=$8 export OOZIE_EXIT_CODE=0 export JOBTRACKER=`getValueFromField ${hadoop_conf_dir}/yarn-site.xml yarn.resourcemanager.address` -export NAMENODE=`getValueFromField ${hadoop_conf_dir}/core-site.xml fs.default.name` +export NAMENODE=`getValueFromField ${hadoop_conf_dir}/core-site.xml fs.defaultFS` export OOZIE_SERVER=`getValueFromField ${oozie_conf_dir}/oozie-site.xml oozie.base.url` export OOZIE_EXAMPLES_DIR=`rpm -ql oozie-client | grep 'oozie-examples.tar.gz$' | xargs dirname` cd $OOZIE_EXAMPLES_DIR http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/f319832a/ambari-agent/src/main/puppet/modules/hdp/manifests/params.pp ---------------------------------------------------------------------- diff --git a/ambari-agent/src/main/puppet/modules/hdp/manifests/params.pp b/ambari-agent/src/main/puppet/modules/hdp/manifests/params.pp index d7e9801..ea3e130 100644 --- a/ambari-agent/src/main/puppet/modules/hdp/manifests/params.pp +++ b/ambari-agent/src/main/puppet/modules/hdp/manifests/params.pp @@ -293,7 +293,7 @@ class hdp::params() $exec_path = ["/bin","/usr/bin", "/usr/sbin"] - #### params used on multiple modules + #### params used on multiple modules $dfs_data_dir = hdp_default("hdfs-site/dfs.data.dir","/tmp/hadoop-hdfs/dfs/data") ### artifact dir @@ -301,7 +301,19 @@ class hdp::params() ### artifacts download url ## $apache_artifacts_download_url = hdp_default("apache_artifacts_download_url","") - $gpl_artifacts_download_url = hdp_default("gpl_artifacts_download_url","") + $gpl_artifacts_download_url = hdp_default("gpl_artifacts_download_url","") + + # hdfs ha settings + $dfs_ha_nameservices = hdp_default("hdfs-site/dfs.nameservices") + $dfs_ha_namenode_ids = hdp_default("hdfs-site/dfs.ha.namenodes.${dfs_ha_nameservices}") + if (hdp_is_empty($dfs_ha_namenode_ids) == false) { + $dfs_ha_namenode_ids_array_len = inline_template("<%=(dfs_ha_namenode_ids).split(',').size()%>") + if ($dfs_ha_namenode_ids_array_len > 1) { + $dfs_ha_enabled = true + } + } else { + $dfs_ha_enabled = false + } $packages = 'bigtop' if ($packages == 'hdp') {
