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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 08:20:28  来源:igfitidea点击:

Hadoop command not found

javahadoop

提问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 tryingenter image description here

我是 hadoop 新手。请帮忙。我还发布了我正在尝试的截图enter image description here

采纳答案by Philip Voronov

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

从您的命令历史记录看来,您可以替换hadoop/usr/local/hadoop/bin/hadoop,它应该会有所帮助。



If you want to use hadoopcommand without specifying the full path to it, you can edit ~/.bashrcfile 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 PATHvariable, 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_profileto 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 用户身份登录,而不能以任何其他用户身份登录。