Created 01-03-2018 08:26 PM
how to verify if name node is in safe mode ?
goal - in case of name node in safe mode , then bash script will perform the following steps on one of the masters machines
# su - hdfs $ hdfs dfsadmin -safemode get $ hdfs dfsadmin -safemode leave
second how to perform the steps as described in the bash script
is it ok to do the following :
su - hdfs -c "hdfs dfsadmin -safemode get" su - hdfs -c "hdfs dfsadmin -safemode leave"
Created 01-04-2018 03:32 AM
Yes. You can use the second way to achieve your task. You can also use the below to check if namenode is in SafeMode and leave conditionally.
su - hdfs -c "hdfs dfsadmin -safemode get" | grep ON if [ $? -ne 0 ] then su - hdfs -c "hdfs dfsadmin -safemode leave" fi
To run the above script, put the content in a file say xyz.sh
chmod +x xyz.sh ./xyz.sh
Thanks,
Aditya
Created 01-04-2018 03:32 AM
Yes. You can use the second way to achieve your task. You can also use the below to check if namenode is in SafeMode and leave conditionally.
su - hdfs -c "hdfs dfsadmin -safemode get" | grep ON if [ $? -ne 0 ] then su - hdfs -c "hdfs dfsadmin -safemode leave" fi
To run the above script, put the content in a file say xyz.sh
chmod +x xyz.sh ./xyz.sh
Thanks,
Aditya