0

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
  • so you wanna get rid of this message or you wanna redirect message to a file ? – Rahul May 20 '16 at 9:45
  • anything is good with me. – Alex Raj Kaliamoorthy May 20 '16 at 11:16
1

You're discarding the error output from wc, not from hdfs.

See my answer to something quote similar on serverfault.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.