bootstraping ZKFC hangs forever
Opened this issue · 1 comments
wuzesheng commented
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(
hpttlook commented
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
to
echo Y | exec $java -cp $class_path