Hard Worker
Hard Worker

Reputation: 1121

Hadoop Format NameNode after installation - Error: command not found (UBUNTO)

Hello i have just installed Hadoop and cant format namenode i am working with Ubunto

and its supposed to be quite simple but i get this error : "command not found"

barak@barak-VirtualBox:/usr/local/hadoop/hadoop-common-project/hadoop-common/src/main/bin$ ls -ltr
total 76
-rwxr-xr-x 1 root root  1462   2 23:08 stop-all.sh
-rw-r--r-- 1 root root  1770   2 23:08 stop-all.cmd
-rwxr-xr-x 1 root root  1471   2 23:08 start-all.sh
-rw-r--r-- 1 root root  1779   2 23:08 start-all.cmd
-rwxr-xr-x 1 root root  2145   2 23:08 slaves.sh
-rwxr-xr-x 1 root root  1776   2 23:08 rcc
-rwxr-xr-x 1 root root  1360   2 23:08 hadoop-daemons.sh
-rwxr-xr-x 1 root root  6452   2 23:08 hadoop-daemon.sh
-rw-r--r-- 1 root root 11179   2 23:08 hadoop-config.sh
-rw-r--r-- 1 root root  8023   2 23:08 hadoop-config.cmd
-rw-r--r-- 1 root root  8298   2 23:08 hadoop.cmd
-rwxr-xr-x 1 root root  5479   2 23:08 hadoop

barak@barak-VirtualBox:/usr/local/hadoop/hadoop-common-project/hadoop-common/src/main/bin$ sudo hadoop namenode -format
sudo: hadoop: command not found

barak@barak-VirtualBox:/usr/local/hadoop/hadoop-common-project/hadoop-common/src/main/bin$ hadoop namenode -format
hadoop: command not found

what do i need to do to format my name node ?

Upvotes: 1

Views: 5779

Answers (3)

BigData-Guru
BigData-Guru

Reputation: 1261

I faced the similar problem and while checking all the Hadoop configurations, my bashrc profile details had issues.

export HADOOP_HOME=/usr/local/hadoop 
export HADOOP_MAPRED_HOME=$HADOOP_HOME 
export HADOOP_COMMON_HOME=$HADOOP_HOME 

export HADOOP_HDFS_HOME=$HADOOP_HOME 
export YARN_HOME=$HADOOP_HOME 
export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native 
export PATH=$PATH:$HADOOP_HOME/sbin:$HADOOP_HOME/bin 
export HADOOP_INSTALL=$HADOOP_HOME

I had done a typo for my bin

Please check $ echo $PATH

Upvotes: 1

didowa
didowa

Reputation: 116

I faced the same issue at some point and I had to write the command as the following

 ./hadoop namenode -format

OR as the following (I believe that it depends on the linux version)

/hadoop namenode -format

Please, let me know if you still face the same problem

Upvotes: 1

Arun A K
Arun A K

Reputation: 2225

  • Add the HADOOP_HOME variable in the .profile file in your home directory
  • Add the Hadoop bin to the path load the profile file
  • Execute the command

STEPS -

Open .profile in your home directory and add following lines

export HADOOP_HOME=<path to your hadoop installation directory>
export PATH=$PATH:$HADOOP_HOME/bin

save and close .profile on a terminal load the changes in the profile by cd <your home directory>

. .profile

now issue the hadoop command to format the namenode

Looking at the path above, I doubt if the installation is proper. Please check the installation as well.

If you are looking for some resources, the official site gives the instructions, follow

http://hadoop.apache.org/docs/stable/hadoop-project-dist/hadoop-common/SingleCluster.html

Upvotes: 3

Related Questions