From fc272d10907ee359a5c3d118c7061bbaa1e3d925 Mon Sep 17 00:00:00 2001 From: Thanh Nguyen Date: Mon, 26 Aug 2024 14:01:33 -0500 Subject: [PATCH] fix resource manager docker waiting for namenode --- hadoop/nodemanager/run.sh | 19 ------------------- hadoop/resourcemanager/run.sh | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/hadoop/nodemanager/run.sh b/hadoop/nodemanager/run.sh index 101e1ad..bf8a39d 100644 --- a/hadoop/nodemanager/run.sh +++ b/hadoop/nodemanager/run.sh @@ -1,22 +1,3 @@ #!/bin/bash -check_namenode() { - echo "Checking if namenode is ready" - 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 30 -done - -echo "Starting ResourceManager..." - $HADOOP_HOME/bin/yarn --config $HADOOP_CONF_DIR nodemanager diff --git a/hadoop/resourcemanager/run.sh b/hadoop/resourcemanager/run.sh index 231babe..8e2783a 100644 --- a/hadoop/resourcemanager/run.sh +++ b/hadoop/resourcemanager/run.sh @@ -1,3 +1,22 @@ #!/bin/bash +check_namenode() { + echo "Checking if namenode is ready" + 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 30 +done + +echo "Starting ResourceManager..." + $HADOOP_HOME/bin/yarn --config $HADOOP_CONF_DIR resourcemanager \ No newline at end of file