-1

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
PATH=/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin

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
U880D
  • 1,146
yael
  • 13,106

1 Answers1

3

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).

Related:

Kusalananda
  • 333,661