We have a RHEL 7.x with Hortonworks (HDP) installed and need an advice why we get on which command:

no hadoop in ...

The Hadoop client is installed under /usr/bin and from env we get

[root@hadoop_machine ~]# env | grep PATH

as it should be. So why we get on which hadoop this error?

[root@hadoop_machine ~]# which hadoop
/usr/bin/which: no hadoop in (/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)

[root@hadoop_machine ~]# ls -ltr /usr/bin | grep hadoop
lrwxrwxrwx. 1 root root         44 Jun  4 11:24 yarn -> /usr/hdp/current/hadoop-yarn-client/bin/yarn
lrwxrwxrwx. 1 root root         51 Jun  4 11:24 mapred -> /usr/hdp/current/hadoop-mapreduce-client/bin/mapred
lrwxrwxrwx. 1 root root         44 Jun  4 11:24 hdfs -> /usr/hdp/current/hadoop-hdfs-client/bin/hdfs
lrwxrwxrwx. 1 root root         41 Jun  4 11:24 hadoop -> /usr/hdp/current/hadoop-client/bin/hadoop
  • 4
    The hadoop program in /usr/bin is a symbolic link. Does the endpoint of that link exist? – Kusalananda Jun 5 '18 at 13:38
  • yes you absolutely right – yael Jun 5 '18 at 15:00

The hadoop executable in /usr/bin is a symbolic link to /usr/hdp/current/hadoop-client/bin/hadoop. It is likely that the target for that symbolic link does not exist. If it exists, one should investigate it to make sure that it is executable.

which would not display it if the symbolic link was pointing to a file that was either missing (a dead symbolic link), or not executable.

Also, it's generally better to use command -v rather than which (especially in scripts that should be portable).


| improve this answer | |

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.