Repository: bigtop
Updated Branches:
  refs/heads/master a4850e641 -> 1883e81c3


BIGTOP-1650: puppet: Bootstrap secondary namenode in HA mode auto

Use hadoop namenode -bootstrapStandby if HA mode auto is in use. Supply
configurable, longer connection timeouts in case primary not is not yet
up or just rebooting.


Project: http://git-wip-us.apache.org/repos/asf/bigtop/repo
Commit: http://git-wip-us.apache.org/repos/asf/bigtop/commit/ba936c08
Tree: http://git-wip-us.apache.org/repos/asf/bigtop/tree/ba936c08
Diff: http://git-wip-us.apache.org/repos/asf/bigtop/diff/ba936c08

Branch: refs/heads/master
Commit: ba936c084db0b80251c082b488e29a0b643cf6b4
Parents: a4850e6
Author: Michael Weiser <[email protected]>
Authored: Thu Feb 5 19:41:04 2015 +0100
Committer: Roman Shaposhnik <[email protected]>
Committed: Thu Feb 5 21:17:07 2015 +0000

----------------------------------------------------------------------
 .../puppet/modules/hadoop/manifests/init.pp        | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/bigtop/blob/ba936c08/bigtop-deploy/puppet/modules/hadoop/manifests/init.pp
----------------------------------------------------------------------
diff --git a/bigtop-deploy/puppet/modules/hadoop/manifests/init.pp 
b/bigtop-deploy/puppet/modules/hadoop/manifests/init.pp
index 32eebe2..22efea8 100644
--- a/bigtop-deploy/puppet/modules/hadoop/manifests/init.pp
+++ b/bigtop-deploy/puppet/modules/hadoop/manifests/init.pp
@@ -288,7 +288,10 @@ class hadoop {
     Exec <| title == "activate nn1" |>  -> Exec["HDFS rsync $title"]
   }
 
-  define namenode ($host = $fqdn , $port = "8020", $auth = "simple", $dirs = 
["/tmp/nn"], $ha = 'disabled', $zk = '') {
+  define namenode ($host = $fqdn , $port = "8020", $auth = "simple", $dirs = 
["/tmp/nn"], $ha = 'disabled', $zk = '',
+      $standby_bootstrap_retries = 10,
+      # milliseconds
+      $standby_bootstrap_retry_interval = 30000) {
 
     $first_namenode = inline_template("<%= Array(@host)[0] %>")
     $hadoop_namenode_host = $host
@@ -413,6 +416,18 @@ class hadoop {
           }
         }
       }
+    } elsif ($ha == "auto") {
+      $retry_params = 
"-Dipc.client.connect.max.retries=$standby_bootstrap_retries \
+        -Dipc.client.connect.retry.interval=$standby_bootstrap_retry_interval"
+
+      exec { "namenode bootstrap standby":
+        user => "hdfs",
+        # first namenode might be rebooting just now so try for some time
+        command => "/bin/bash -c 'hdfs namenode -bootstrapStandby 
$retry_params >> /var/lib/hadoop-hdfs/nn.bootstrap-standby.log 2>&1'",
+        creates => "${dirs[0]}/current/VERSION",
+        require => [ Package["hadoop-hdfs-namenode"], File[$dirs], 
File["/etc/hadoop/conf/hdfs-site.xml"] ],
+        tag     => "namenode-format",
+      }
     } elsif ($ha != "disabled") {
       hadoop::namedir_copy { $namenode_data_dirs: 
         source       => $first_namenode,

Reply via email to