简体   繁体   English

在Hadoop上运行Hive时出现问题

[英]Problem running Hive on Hadoop

I downloaded the latest Hive release 0.7.1. 我下载了最新的Hive版本0.7.1。

Cannot find hadoop installation: $HADOOP_HOME must be set or hadoop must be in the path 找不到hadoop安装:必须设置$ HADOOP_HOME或hadoop必须在路径中

I went into this directory /home/hadoop/hive-0.7.1-bin/bin and tried running the Hive Shell. 我进入此目录/home/hadoop/hive-0.7.1-bin/bin并尝试运行Hive Shell。

./hive shell But I am getting the above error in the CLI. ./hive shell但是我在CLI中遇到了以上错误。

I tried setting the path: $HADOOP_HOME=home/hadoop/hadoop/bin 我尝试设置路径:$ HADOOP_HOME = home / hadoop / hadoop / bin

I am using Hadoop 0.20.2 我正在使用Hadoop 0.20.2

As per the link : http://wiki.apache.org/hadoop/GettingStartedWithHadoop 按照链接: http : //wiki.apache.org/hadoop/GettingStartedWithHadoop

Hadoop home is HADOOP_HOME is the parent directory of the bin directory that holds the Hadoop scripts. Hadoop的主目录是HADOOP_HOME,是存放Hadoop脚本的bin目录的父目录。

Also the following $HADOOP_HOME=home/hadoop/hadoop/bin seems to be a relative path. 同样,以下$HADOOP_HOME=home/hadoop/hadoop/bin似乎是相对路径。 It is better to give the full path from root. 最好从根目录给出完整的路径。

In addition to your path not being absolute, the syntax is wrong. 除了您的路径不是绝对路径之外,语法也是错误的。 Use HADOOP_HOME= not $HADOOP_HOME= 使用HADOOP_HOME=而不是$HADOOP_HOME=

You should setup environmental variable to your operating system, also hadoop home path should be "hadoop_0.20.2" directory not "bin". 您应该为您的操作系统设置环境变量,hadoop主目录路径也应该是“ hadoop_0.20.2”目录而不是“ bin”。

For example in Ubuntu 例如在Ubuntu中

export HADOOP_HOME="/path/to/hadoop/"

to check : 去检查 :

echo $HADOOP_HOME

You are going to want to set this for each time you log on. 您将需要在每次登录时进行设置。

First you have to determine your path to hadoop/bin 首先,您必须确定通往hadoop / bin的路径

From your post my guess is it might be 从您的帖子中,我猜可能是

/home/hadoop/hadoop/bin

Now you can do 现在你可以做到

EXPORT HADOOP_HOME=/home/hadoop/hadoop/bin

but this would need to be done every time you log on and off. 但是每次登录和注销时都需要这样做。

So I recommend going and adding this file to your profile folder. 因此,我建议将此文件添加到您的配置文件文件夹中。 Usually found in /etc/profile. 通常在/ etc / profile中找到。 So try 所以试试吧

sudo vi /etc/profile

and add the following line right on the top. 并在顶部添加以下行。

EXPORT HADOOP_HOME=/home/hadoop/hadoop/bin 

Save and quit 保存并退出

:wq

And then run the following commmand to update your variables 然后运行以下命令来更新变量

source /etc/profile

To confirm it works try the following. 为了确认它是否有效,请尝试以下操作。 Notice when using echo you use $ but when assigning the variable you do not. 请注意,在使用echo时使用$,但在分配变量时则不使用$。

echo $HADOOP_HOME

示例:导出HADOOP_HOME = / usr / local / hadoop

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM