I have followed this tutorial for my hadoop setup up to "Format the new Hadoop File System" and I get the "Command not found" message when I enter
hadoop namenode -formatHow should I proceed?
27 Answers
In your ~/.bashrc, instead of writing
export HADOOP_INSTALL=/usr/local/hadoopchange it to
export HADOOP_INSTALL=/usr/local/hadoop/bin/hadoopI was facing the same issue for a long time. This worked for me.
Or try this:
/usr/local/hadoop/bin/hadoop namenode -format Re-do everything from the beginning. It may be possible that you have not set the path properly. As the output says Command not found, this means hadoop has not been installed properly.
You can try
/usr/local/hadoop/bin/hadoop namenode -formatIf you want to use hadoop command without specifying the path you can edit your ~/.bashrc file. If you have alredy done it, reopen your terminal and try it again.
I also did the same installation and actually the path is /usr/local/hadoop/hadoop-2.6.0/hadoop/
so you should move everything from /usr/local/hadoop/hadoop-2.6.0/ to /usr/local/hadoop so that the hadoop command will work.
Command to move everything is
mv -v /usr/local/hadoop/hadoop-2.6.0/* /usr/local/hadoopIt worked for me.
If path is correct and still facing the error
then
after adding path variables in ~/.bashrc
run this command source ~/.bashrc
Set your path:
sudo gedit /etc/profileAdd to end:
export HADOOP_PREFIX="/usr/local/hadoop/"
export PATH=$PATH:$HADOOP_PREFIX/bin
export PATH=$PATH:$HADOOP_PREFIX/sbin
export HADOOP_MAPRED_HOME=${HADOOP_PREFIX}
export HADOOP_COMMON_HOME=${HADOOP_PREFIX}
export HADOOP_HDFS_HOME=${HADOOP_PREFIX}
export YARN_HOME=${HADOOP_PREFIX}Then,
source /etc/profile
Make sure all your environment variables are set correctly and HADOOP can find JAVA. And Include both in your PATH. Assuming you have Java and Hadoop under /usr/local/ like me,
Add these to the very end of your ~./bashrc file.
export JAVA_HOME=/usr/local/jdk1.8.0_171
export PATH=${PATH}:${JAVA_HOME}/bin
export HADOOP_INSTALL=/usr/local/hadoop
export HADOOP_HOME=/usr/local/hadoop
export PATH=${PATH}:${HADOOP_INSTALL}/bin:${HADOOP_HOME}/bin