Java 找不到 Hadoop 命令
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21369102/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Hadoop command not found
提问by lucifer
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
我已经在 linux 机器上安装并配置了 hadoop。现在我正在尝试运行一个示例 MR 作业。我已经通过命令 /usr/local/hadoop/bin/start-all.sh 启动了 hadoop,输出是
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
所以我认为我的 hadoop 配置成功。但是当我尝试在命令下运行时,它给出了
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 trying
我是 hadoop 新手。请帮忙。我还发布了我正在尝试的截图
采纳答案by Philip Voronov
As it seems from your commands history, you can replace hadoop
by /usr/local/hadoop/bin/hadoop
and it should help.
从您的命令历史记录看来,您可以替换hadoop
为/usr/local/hadoop/bin/hadoop
,它应该会有所帮助。
If you want to use hadoop
command without specifying the full path to it, you can edit ~/.bashrc
file and add the following line:
如果您想在hadoop
不指定完整路径的情况下使用命令,您可以编辑~/.bashrc
文件并添加以下行:
export PATH=$PATH:/usr/local/hadoop/bin/
Then you need to reopen your terminal.
然后你需要重新打开你的终端。
回答by Jigar Joshi
edit PATH
variable, if you want to be able to invoke hadoop without specifying full path
编辑PATH
变量,如果您希望能够在不指定完整路径的情况下调用 hadoop
export PATH=$PATH:/usr/local/hadoop/bin/
if you want it for each bash profile then edit ~/.bash_profile
to include this
如果您希望每个 bash 配置文件都使用它,请编辑~/.bash_profile
以包含此内容
回答by Alen
cd ~
vi .bashrc
export PATH=$PATH:<hadoop installation path>
for example replace <hadoop installation path>
by /usr/local/hadoop/bin/
例如替换<hadoop installation path>
为/usr/local/hadoop/bin/
回答by thedheeraz
I got the same error, and this worked for me
我遇到了同样的错误,这对我有用
I configured path variable in.bashrc.
我在.bashrc 中配置了路径变量。
export HADOOP_HOME=/opt/hadoop
导出 HADOOP_HOME=/opt/hadoop
export PATH= $PATH:$HADOOP_HOME/bin
导出路径= $PATH:$HADOOP_HOME/bin
Sometime restarting your machine can resolve the issue ,only if you have configured everything correct.
有时重新启动机器可以解决问题,前提是您已正确配置所有内容。
回答by andani
once echo your path ,if your path hasn't set ,then go to your .bashrc file
一旦回显您的路径,如果您的路径尚未设置,则转到您的 .bashrc 文件
vi ~/.bashrc
and add folliwing in that.
并在其中添加以下内容。
export PATH=$PATH:/usr/local/hadoop/bin/
回答by DJAdmin
Please make sure that you are logged into the particular user, whose .bashrc file has got this entry
请确保您登录到特定用户,其 .bashrc 文件具有此条目
export PATH=$PATH:/usr/local/hadoop/bin/
导出路径=$PATH:/usr/local/hadoop/bin/
Assuming that your hadoop setup is lying at /usr/local
假设您的 hadoop 设置位于 /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.
示例 您已经在 /home/hadoopuser/.bashrc 中为用户 hadoopuser 设置了 .bashrc 文件,那么您应该仅以 hadoop 用户身份登录,而不能以任何其他用户身份登录。