mirror of
https://github.com/floci-io/floci.git
synced 2026-11-26 23:29:28 -05:00
fix(emr): keep a primary node running on an emr-6.x image (#7800)
Once a cluster's HDFS was up, the primary node's script ran wait -n to end the container when a daemon exited. The bash of an emr-6.x image, 4.2, does not have wait -n, so the call failed at once and the node exited as soon as it was ready: every step of an emr-6.x cluster failed with "The HDFS of EMR cluster ... stopped before it was ready". The script now watches the count of daemons it started, as it already does while they start.
This commit is contained in:
1 parent
3c398103ed
commit
943efbbcc4
2 files changed
+20
-15
No files matched your search
@@ -129,16 +129,16 @@ public class EmrClusterStorage implements ClusterStorage, ContainerTeardown {
|
||||
"exec setpriv --reuid=hadoop --regid=hadoop --clear-groups bash -c '"
|
||||
+ "[ -d /mnt/namenode/current ] || hdfs namenode -format -nonInteractive || exit; "
|
||||
+ "cid=$(sed -n \"s/^clusterID=//p\" /mnt/namenode/current/VERSION); "
|
||||
+ "hdfs namenode & hdfs datanode & "
|
||||
+ "hdfs namenode & hdfs datanode & n=2; "
|
||||
+ "until curl -sf -m 5 \"" + NAMENODE_JMX + "NameNodeInfo\""
|
||||
+ " | grep -q \"\\\"ClusterId\\\" : \\\"$cid\\\"\"; do "
|
||||
+ "[ \"$(jobs -rp | wc -l)\" = 2 ] || exit 1; sleep 0.2; done; "
|
||||
+ "[ \"$(jobs -rp | wc -l)\" = $n ] || exit 1; sleep 0.2; done; "
|
||||
+ "until curl -sf -m 5 \"" + NAMENODE_JMX + "FSNamesystemState\""
|
||||
+ " | grep -q \"\\\"NumLiveDataNodes\\\" : 1,\"; do "
|
||||
+ "[ \"$(jobs -rp | wc -l)\" = 2 ] || exit 1; sleep 0.2; done; "
|
||||
+ "[ \"$(jobs -rp | wc -l)\" = $n ] || exit 1; sleep 0.2; done; "
|
||||
+ "until curl -sf -m 5 \"" + NAMENODE_JMX + "NameNodeInfo\""
|
||||
+ " | grep -q \"\\\"Safemode\\\" : \\\"\\\"\"; do "
|
||||
+ "[ \"$(jobs -rp | wc -l)\" = 2 ] || exit 1; sleep 0.2; done; "
|
||||
+ "[ \"$(jobs -rp | wc -l)\" = $n ] || exit 1; sleep 0.2; done; "
|
||||
+ "hdfs dfs -mkdir -p /tmp /user/hadoop || exit 1; "
|
||||
+ "if [ -n \"$" + HIVE_METASTORE_VARIABLE + "\" ]; then "
|
||||
+ "hdfs dfs -mkdir -p /user/hive/warehouse " + HIVE_JARS + " || exit 1; "
|
||||
@@ -156,12 +156,14 @@ public class EmrClusterStorage implements ClusterStorage, ContainerTeardown {
|
||||
+ " --hiveconf datanucleus.schema.autoCreateAll=true"
|
||||
+ " --hiveconf hive.metastore.schema.verification=false"
|
||||
+ " --hiveconf hive.metastore.warehouse.dir=hdfs://$FLOCI_HDFS_HOST:8020/user/hive/warehouse"
|
||||
+ " \"${site[@]}\" & "
|
||||
+ " \"${site[@]}\" & n=$((n + 1)); "
|
||||
+ "until (exec 3<>/dev/tcp/127.0.0.1/" + HIVE_METASTORE_PORT + ") 2>/dev/null; do "
|
||||
+ "[ \"$(jobs -rp | wc -l)\" = 3 ] || exit 1; sleep 0.2; done; "
|
||||
+ "[ \"$(jobs -rp | wc -l)\" = $n ] || exit 1; sleep 0.2; done; "
|
||||
+ "fi; "
|
||||
+ "touch " + HDFS_READY + "; "
|
||||
+ "wait -n; rm -f " + HDFS_READY + "; kill $(jobs -rp) 2>/dev/null; exit 1'");
|
||||
// Not wait -n: an emr-6.x image's bash, 4.2, does not have it.
|
||||
+ "while [ \"$(jobs -rp | wc -l)\" = $n ]; do sleep 1; done; rm -f " + HDFS_READY
|
||||
+ "; kill $(jobs -rp) 2>/dev/null; exit 1'");
|
||||
|
||||
// One start at a time in a namespace the steps share, whatever the cluster, as it holds one HDFS.
|
||||
private final Object sharedNamespaceStarts = new Object();
|
||||
|
||||
Reference in new issue
Block a user