HIVE安装环境:ubuntu14.04 hadoop-2.6.0 hive-2.0.0
SQL看了有一两周啦,开始环境实践!!
1.下载安装
下载链接:
解压安装:
-
tar -xzvf hive-x.y.z.tar.gz -C your_hive_path/hive
2.参数配置
2.1设置环境变量
打开/home/your_user_name/.bashrc
添加如下内容:
-
export HIVE_HOME=/home/warrior/bigData/hive
-
export PATH=$HIVE_HOME/bin:$PATH
2.2设置配置文件
在/../hive/conf下
将hive-default.xml.template改为hive-site.xml
-
mv hive-default.xml.template hive-site.xml
将hive-log4j.properties.template改为hive-log4j.properties
-
mv hive-log4j.properties.template hive-log4j.properties
将hive-exec-log4j.properties.template改为hive-exec-log4j.properties
-
mv hive-exec-log4j.properties.template hive-exec-log4j.properties
3.运行过程以及遇到问题:
执行hive遇到问题
(1)报错信息:
-
Exception in thread "main" java.lang.RuntimeException: Hive metastore database is not initialized. Please use schematool (e.g. ./schematool -initSchema -dbType ...) to create the schema. If needed, don't forget to include the option to auto-create the underlying database in your JDBC connection string (e.g. ?createDatabaseIfNotExist=true for mysql)
解决办法:
如果还没有运行过hive,则执行
-
schematool -initSchema -dbType derby
如果已经执行过hive并报错,则在$
HIVE_HOME/bin/下执行
-
mv metastore_db metastore_db.tmp
-
schematool -initSchema -dbType derby
然后再执行hive,可能还会出现后面的问题!!
(2)报错信息:
-
Exception in thread "main" java.lang.IllegalArgumentException: java.net.URISyntaxException: Relative path in absolute URI: ${system:java.io.tmpdir%7D/$%7Bsystem:user.name%7D
解决办法,修改hive-site.xml :
<1创建目录:
-
cd ~
-
mkdir -P ~/tmp/hive/local
-
mkdir -P ~/tmp/hive/resources
<修改配置文件
-
<property>
-
<name>hive.exec.scratchdir</name>
-
<value>/home/your_user_name/tmp/hive</value>
-
<description>HDFS root scratch dir for Hive jobs which gets created with write all (733) permission. For each connecting user, an
-
HDFS scratch dir: ${hive.exec.scratchdir}/<username> is created, with ${hive.scratch.dir.permission}.</description>
-
</property>
-
<property>
-
<name>hive.exec.local.scratchdir</name>
-
<value>home/your_user_name/tmp/hive/local</value>
-
<description>Local scratch space for Hive jobs</description>
-
</property>
-
<property>
-
<name>hive.downloaded.resources.dir</name>
-
<value>/home/your_user_name/tmp/hive/resources</value>
-
<description>Temporary local directory for added resources in the remote file system.</description>
-
</property>
再次执行hive,这回OK啦!!
参考链接:
http://www.cnblogs.com/likehua/p/3825479.html
阅读(2071) | 评论(0) | 转发(0) |