AjayLohani
AjayLohani

Reputation: 952

User in Unix not able to run hadoop command

I installed Hadoop and Created a user named hduser and changes owner of hadoop folder to hduser.

After installing Hadoop i try to execute the hadoop command to check whether it is installed or not but it is giving "hadoop" command not found.

Then i had given execute privilege to hduser on all the files inside hadoop folder include bin folder But still output is same.

When i am trying the same hadoop command with root as a user its working fine.

I think it is related to unix commands. Please help me out to give my user the privilege to execute hadoop command.

One more thing if i switch to root then hadoop commands works fine.

Upvotes: 1

Views: 1874

Answers (2)

vefthym
vefthym

Reputation: 7462

It is not a problem of privileges. You can still execute hadoop, if you type /usr/local/hadoop/bin/hadoop, right?

The problem is that $PATH is user-specific. You have to add your $HADOOP_HOME/bin to the $PATH, as hduser, not as root. Login as hduser first (or just type su hduser) and then export PATH=$PATH:/$HADOOP_HOME/bin, as @iamkristian suggests, where $HADOOP_HOME is the directory in which you have placed hadoop (usually /usr/local/hadoop).

Upvotes: 2

krxio
krxio

Reputation: 21

I sounds like hadoop isn't in your path. You can test that with

which hadoop

If that gives you command not found the you probably just need to add it to your path. Depending on where you installed hadoop, you need to add this to your ~/.bashrc

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

And then reopen your terminal

Upvotes: 2

Related Questions