From 30d03095eb4c5ee13e6da245acafc60e1366f3cd Mon Sep 17 00:00:00 2001 From: Thanh Nguyen Date: Mon, 26 Aug 2024 11:44:21 -0500 Subject: [PATCH] update resource manager starting script --- hadoop/nodemanager/run.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/hadoop/nodemanager/run.sh b/hadoop/nodemanager/run.sh index bf8a39d..455945d 100644 --- a/hadoop/nodemanager/run.sh +++ b/hadoop/nodemanager/run.sh @@ -1,3 +1,21 @@ #!/bin/bash +check_namenode() { + safe_mode_status=$(hdfs dfsadmin -safemode get | grep 'Safe mode is OFF') + if [[ $safe_mode_status == *"Safe mode is OFF"* ]]; then + echo "NameNode is out of Safe Mode." + return 0 + else + echo "NameNode is still in Safe Mode. Waiting..." + return 1 + fi +} + +# Wait for NameNode to leave Safe Mode +until check_namenode; do + sleep 10 +done + +echo "Starting ResourceManager..." + $HADOOP_HOME/bin/yarn --config $HADOOP_CONF_DIR nodemanager