write down,forget

Hive安装Tips

<Category: Hadoop> 查看评论

Hive安装

下载地址
http://.apache.org/releases.html

wget http://labs.renren.com/apache-mirror//hive/hive-0.6.0/hive-0.6.0-bin.tar.gz

tar vxzf hive-0.6.0-bin.tar.gz

sudo mv hive-0.6.0-bin /usr/local/hive-0.6.0

fs -mkdir /tmp
hadoop fs -mkdir /user/{your username}/warehouse
hadoop fs -chmod g+w /tmp
hadoop fs -chmod g+w /user/{your username}/warehouse

打开配置文件,查找scratchdir设置
vi conf/hive-default.xml

mkdir /tmp/hive-{your username}
chmod 777 /tmp/hive-{your username}/

设置环境变量
sudo vi /etc/profile
export HIVE_HOME=/usr/local/hive-0.6.0
export PATH=$HIVE_HOME/bin:$PATH

修改sudo vi /usr/lib/hadoop-0.20/conf/hadoop-env.sh

export HADOOP_CLASSPATH=”$HBASE_HOME:$HBASE_HOME/lib/hbase-0.20.3.jar:$HADOOP_CLASSPATH”

执行生效
. /etc/profile

hive cli>

报错
hive> CREATE TABLE pokes (foo INT, bar STRING);
Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/hadoop/sec
urity/UnixUserGroupInformation
at org.apache.hadoop.hive.ql.processors.CommandProcessorFactory.get(Comm
andProcessorFactory.java:49)
at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:131)
at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:197)
at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:302)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.hadoop.util.RunJar.main(RunJar.java:186)
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.security.UnixUser
GroupInformation
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
… 9 more

不知道什么问题,先记下来,以后再折腾

还是使用Cloudera的源快速方便,
sudo yum install hadoop-hive
清理之前的环境变量
logout
login

hive> show TABLES;
OK
Time taken: 4.825 seconds

https://docs.cloudera.com/display/DOC/Hive+Installation

Hive Statements
http://archive.cloudera.com/cdh/3/hive/language_manual/data-manipulation-statements.html

Join Syntax

本文来自: Hive安装Tips