Ubuntu: Not getting `hadoop -version`



Question:

I installed Hadoop, but I cannot get its version:

ramesh@ramesh-H61M-S2P-B3:~$ echo $HADOOP_HOME  /home/hadoop/work/hadoop-1.1.2   ramesh@ramesh-H61M-S2P-B3:~$ hadoop -version  hadoop: command not found  

What do I have to do, to get Hadoop to work?


Solution:1

cd $HADOOP_HOME or cd $HADOOP_HOME/bin depending on how the product is installed.

In fact, I'm sure that the directory where the hadoop command is installed is not in your PATH.

You can modify the PATH of your account by editing the .bashrc file in your home directory and by putting this line at the end :

export PATH=$PATH:/home/hadoop/work/hadoop-1.1.2  

Of course, if the hadoop command is not right under /home/hadoop/work/hadoop-1.1.2, you will have to add the full directory and not limit you to Hadoop home directory.

You can find the right location of hadoop by typing locate hadoop.


Solution:2

you are using the wrong command.

To check hadoop version, type hadoop version in the terminal. here is the sample output

hduser@ipc:/usr/local/hadoop/sbin$ hadoop version
Hadoop 2.4.1
Subversion http://svn.apache.org/repos/asf/hadoop/common -r 1604318
Compiled by jenkins on 2014-06-21T05:43Z
Compiled with protoc 2.5.0
From source with checksum bb7ac0a3c73dc131f4844b873c74b630
This command was run using /usr/local/hadoop/share/hadoop/common/hadoop-common-2.4.1.jar


Solution:3

You need to add the path of the hadoop program to your $PATH variable.

Edit ~/.bashrc and add this line at the end:

export PATH=$PATH:$HADOOP_HOME/bin/  

Then do the following to apply the changes we did:

source ~/.bashrc  

Now try hadoop version. It should work. Remember that you need Java installed and set its path in conf/hadoop-env.sh (this is part of installing Hadoop).


Solution:4

Use $HADOOP_HOME/bin/hadoop version instead of hadoop -version.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »