Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bootstraping ZKFC hangs forever #5

Open
wuzesheng opened this issue Dec 31, 2013 · 1 comment
Open

bootstraping ZKFC hangs forever #5

wuzesheng opened this issue Dec 31, 2013 · 1 comment
Assignees

Comments

@wuzesheng
Copy link
Contributor

Forks may find that when bootstraping ZKFC after cleaning up, it will hang forever, to fix this, you need to patch the following diff to your ZKFC:

diff --git a/hadoop/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/ZKFailoverController.java b/hadoop/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/ZKFailoverController.java
--- a/hadoop/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/ZKFailoverController.java
+++ b/hadoop/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/ZKFailoverController.java
@@ -195,6 +195,8 @@
           }   
         }   
         return formatZK(force, interactive);
+      } else if ("-clearZK".equals(args[0])) {
+        return clearZK();
       } else {
         badArg(args[0]);
       }   
@@ -272,6 +274,19 @@
     return 0;
   }   

+  private int clearZK()
+      throws IOException, InterruptedException {
+    if (elector.parentZNodeExists()) {
+      try {
+        elector.clearParentZNode();
+      } catch (IOException e) {
+        LOG.error("Unable to clear zk parent znode", e); 
+        return 1;
+      }   
+    }   
+    return 0;
+  }
+   
   private boolean confirmFormat() {
     String parentZnode = getParentZnode();
     System.err.println(
@ghost ghost assigned wuzesheng Dec 31, 2013
@hpttlook
Copy link

hpttlook commented Jan 1, 2014

There is another choice which you don't need to re-build your hadoop project.
Change the follwing line in bootstrap_hdfs.sh.tmpl
exec $java -cp $class_path $params $@
to
echo Y | exec $java -cp $class_path $params $@

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants