Skip to content

Commit

Permalink
fix resource manager docker waiting for namenode
Browse files Browse the repository at this point in the history
  • Loading branch information
thanh-nguyen-dang committed Aug 26, 2024
1 parent 67479b7 commit fc272d1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
19 changes: 0 additions & 19 deletions hadoop/nodemanager/run.sh
Original file line number Diff line number Diff line change
@@ -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
19 changes: 19 additions & 0 deletions hadoop/resourcemanager/run.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit fc272d1

Please sign in to comment.