Member since
06-27-2017
1
Post
2
Kudos Received
0
Solutions
06-27-2017
03:29 AM
2 Kudos
To find the active namenode, we can try executing the test hdfs command on each of the namenodes and find the active name node corresponding to the successful run. Below command executes successfully if the name node is active and fails if it is a standby node. hadoop fs -test -e hdfs://<Name node>/
Unix script active_node=''
if hadoop fs -test -e hdfs://<NameNode-1>/ ; then
active_node='<NameNode-1>'
elif hadoop fs -test -e hdfs://<NameNode-2>/ ; then
active_node='<NameNode-2>'
fi
echo "Active Dev Name node : $active_node"
... View more