I have installed and configured hadoop in a linux machine .Now i am trying to run a sample MR job.I have started the hadoop via the command /usr/local/hadoop/bin/start-all.sh and the output is

namenode running as process 7876. Stop it first. localhost: datanode running as process 8083. Stop it first. localhost: secondarynamenode running as process 8304. Stop it first. jobtracker running as process 8398. Stop it first. localhost: tasktracker running as process 8612. Stop it first. 

so i think that my hadoop is configured successfully.But when i am tryinh to run below command it is giving

jeet@jeet-Vostro-2520:~$ hadoop fs -put gettysburg.txt /user/jeet/getty/gettysburg.txt hadoop: command not found 

i am new in hadoop.somebody please help .I am also posting the screenshot of what i am tryingenter image description here

2

7 Answers

As it seems from your commands history, you can replace hadoop by /usr/local/hadoop/bin/hadoop and it should help.


If you want to use hadoop command without specifying the full path to it, you can edit ~/.bashrc file and add the following line:

export PATH=$PATH:/usr/local/hadoop/bin/ 

Then you need to reopen your terminal.

3

edit PATH variable, if you want to be able to invoke hadoop without specifying full path

export PATH=$PATH:/usr/local/hadoop/bin/ 

if you want it for each bash profile then edit ~/.bash_profile to include this

I got the same error, and this worked for me

I configured path variable in.bashrc.

export HADOOP_HOME=/opt/hadoop

export PATH= $PATH:$HADOOP_HOME/bin

Sometime restarting your machine can resolve the issue ,only if you have configured everything correct.

cd ~ vi .bashrc export PATH=$PATH:<hadoop installation path> 

for example replace <hadoop installation path> by /usr/local/hadoop/bin/

2

once echo your path ,if your path hasn't set ,then go to your .bashrc file

vi ~/.bashrc 

and add folliwing in that.

export PATH=$PATH:/usr/local/hadoop/bin/ 

Please make sure that you are logged into the particular user, whose .bashrc file has got this entry

export PATH=$PATH:/usr/local/hadoop/bin/

Assuming that your hadoop setup is lying at /usr/local

Example You have set the .bashrc file for user hadoopuser in /home/hadoopuser/.bashrc, then you should be logged in as hadoop user only and not as any other user.

Hadoop command not found?

put this 3 commands at the end of ~/.bashrc file sudo gedit ~/.bashrc

export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64

export HADOOP_HOME=/home/Work/hadoop-1.2.1

export PATH=$HADOOP_HOME/bin:$PATH*

java-8-openjdk-amd64 - put your folder name

hadoop-1.2.1 - put your folder name

save the file and use below command source ~/.bashrc

or simply close the terminal and open it again

0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.