且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

找不到hadoop安装:必须设置$ HADOOP_HOME或hadoop必须位于路径中

更新时间:2022-10-15 11:54:36

/etc/profile.d目录,并在那里创建一个hadoop.sh文件。

  export HADOOP_HOME = / opt / hadoop / hadoop 
export HIVE_HOME = / opt / hadoop / hive
export PATH = $ PATH:$ HADOOP_HOME / bin:$ HIVE_HOME / bin

保存文件后,请确保

  chmod + x / etc / profile.d / hadoop.sh 
source /etc/profile.d/hadoop.sh

这应该照顾它。


So a little background. I've been trying to setup Hive on a CentOS 6 machine. I followed the instructions of this *** video: http://www.***.com/watch?v=L2lSrHsRpOI

For my case, I'm using Hadoop-1.1.2 and Hive 0.9.0, all the directories labeled "mnt" in this video I replaced it with "opt" because that's where all of my hadoop and hive packages have been opened up.

As I reached the portion of the video where I was actually supposed to run Hive via "./hive" this error popped up:

"Cannot find hadoop installation: $HADOOP_HOME must be set or hadoop must be in the path"

I guess one of the questions I have is, in which directory did I have to edit the ".profile" file? because I don't understand why we would have to go to the "home" directory for this change. And also if this helps, this is what I had put down in the ".profile" file in my /home/hadoop directory

export HADOOP_HOME=/opt/hadoop/hadoop
export HIVE_HOME=/opt/hadoop/hive
export PATH=$HADOOP_HOME/bin:$HIVE_HOME/bin

Thank you so much!

Go to /etc/profile.d directory and create a hadoop.sh file in there with

export HADOOP_HOME=/opt/hadoop/hadoop
export HIVE_HOME=/opt/hadoop/hive
export PATH=$PATH:$HADOOP_HOME/bin:$HIVE_HOME/bin

After you save the file, make sure to

chmod +x /etc/profile.d/hadoop.sh
source /etc/profile.d/hadoop.sh

This should take care of it.