Complete error statement :
No command 'hdfs' found, did you mean: Command 'hfs' from package 'hfsutils-tcltk' (universe) Command 'hdfls' from package 'hdf4-tools' (universe) hdfs: command not found 2 4 Answers
There may be something wrong with your HDFS installation, try giving the full path to hdfs in your command.
/path/to/dir/hdfs namenode -formatthe path depends on your OS and hadoop distribution you're using etc. Use locate or find for it.
If it works with full path, its probably a PATH issue, export the path in your .bashrc and then try.
Cheers.
Check if you have added your hadoop executables to PATH properly.
add the below given export commands in .bashrc if not:
export HADOOP_INSTALL=/path/where/hadoop/is/installed
export PATH=$PATH:$HADOOP_INSTALL/bin
export PATH=$PATH:$HADOOP_INSTALL/sbin
export HADOOP_MAPRED_HOME=$HADOOP_INSTALL
export HADOOP_COMMON_HOME=$HADOOP_INSTALL
export HADOOP_HDFS_HOME=$HADOOP_INSTALL
export YARN_HOME=$HADOOP_INSTALL
export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_INSTALL/lib/native
export HADOOP_OPTS="-Djava.library.path=$HADOOP_INSTALL/lib"
Finally source the bashrc file
1try with bin/hdfs instead of hdfs. It worked for me.
I hope this error is resolved by now, but this error occurs because the hdfs path may not be set, so first check hdfs path by using this command,
which hdfs
if path is not set, then check the environment variable in ~/.bash_profile if it PATH is written like this,
PATH=$PATH:$HOME/bin
change it to this PATH=$PATH:$HADOOP_HOME/bin
source ~/.bash_profile
then check the your hdfs path, if it is set by using which command(as shown above) Then your problem might get resolved. Hope this helps!
0