I have a below loop that is used to check the active namenode in Hadoop cluster and if the first node is inactive it picks up the second.
for (( i=0;i<$(($(wc -l < $LOCAL_DIR/'tempip.txt')/3));i++ )){
j=$(($i*3))
echo ${ipArray[j]} >> $LOCAL_DIR/tmpOp.txt 2> /dev/null
if hdfs dfs -test -e ${ipArray[$j+1]} ; then
hdfs dfs -cat ${ipArray[$j+1]}/* | wc -l>> $LOCAL_DIR/tmpOp.txt 2> /dev/null
elif hdfs dfs -test -e ${ipArray[$j+2]} ; then
hdfs dfs -cat ${ipArray[$j+2]}/* | wc -l>> $LOCAL_DIR/tmpOp.txt 2> /dev/null
else
echo "Invalid"
fi
}
The problem here is whenever the namenode is found inactive it throws the below message in the window and continues with another namenode. I have redirected my error to the null directory but I still receive it. How can I get rid of it?
test: Operation category READ is not supported in state standby. Visit https://s.apache.org/sbnn-error