Apache Hive安装及配置

转载 2013年12月06日 10:09:25

原文地址:http://blog.yidooo.net/archives/apache-hive-installation.html

安装前

在安装Hive之前,请保证已经安装了Hadoop。

Apache Hive安装及配置

安装Mysql

本文选用mysql作为Hive的metastore。

1
sudo yum install mysql-server
  • 创建数据库
1
2
mysql> create database hive;
Query OK, 1 row affected (0.00 sec)
  • 修改数据库操作权限
1
2
3
4
5
mysql> grant all on hive.* to hive@'%'  identified by 'hive';
Query OK, 0 rows affected (0.00 sec)
 
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

Hive安装

1
tar zcvf hive-0.12.0.tar.gz hive-0.12.0

Hive配置

1
2
3
4
5
cd conf
cp hive-default.xml.template hive-site.xml
cp hive-env.sh.template hive-env.sh
cp hive-log4j.properties.template hive-log4j.properties
cp hive-exec-log4j.properties.template hive-exec-log4j.properties
  • hive-site.xml
1
2
3
4
5
<property>
  <name>javax.jdo.option.ConnectionURL</name>
  <value>jdbc:mysql://localhost:3306/hive</value>
  <description>JDBC connect string for a JDBC metastore</description>
</property>
1
2
3
4
5
<property>
  <name>javax.jdo.option.ConnectionDriverName</name>
  <value>com.mysql.jdbc.Driver</value>
  <description>Driver class name for a JDBC metastore</description>
</property>
1
2
3
4
5
<property>
  <name>javax.jdo.option.ConnectionUserName</name>
  <value>root</value>
  <description>username to use against metastore database</description>
</property>
1
2
3
4
5
<property>
  <name>javax.jdo.option.ConnectionPassword</name>
  <value>welcome123</value>
  <description>password to use against metastore database</description>
</property>
1
2
3
4
5
6
7
8
9
10
11
<property>
  <name>hive.metastore.schema.verification</name>
  <value>false</value>
   <description>
   Enforce metastore schema version consistency.
   True: Verify that version information stored in metastore matches with one from Hive jars.  Also disable automatic
         schema migration attempt. Users are required to manully migrate schema after Hive upgrade which ensures
         proper metastore schema migration. (Default)
   False: Warn if the version information stored in metastore doesn't match with one from in Hive jars.
   </description>
</property>
  • hive-env.sh
1
2
3
4
5
# Set HADOOP_HOME to point to a specific hadoop install directory
HADOOP_HOME=/home/hadoop/hadoop-2.2.0
 
# Hive Configuration Directory can be controlled by:
export HIVE_CONF_DIR=/home/hadoop/hive-0.12.0/conf

安装Mysql JDBC Connector

下载页面:http://www.mysql.com/downloads/connector/j/5.1.html

1
cp mysql-connector-java-5.1.26-bin.jar to hive/lib

测试

1
2
3
hive> create table test (key string);
OK
Time taken: 1.09 seconds
1
2
3
4
5
hive> create table test (key string);
hive> show tables;
OK
test
Time taken: 0.084 seconds, Fetched: 1 row(s)

常见错误

错误:ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)
解决方法:sudo service mysqld start
错误:ERROR 1044 (42000): Access denied for user ”@’localhost’ to database ‘hive’
解决方法:
[hadoop@zhenlong-master ~]$ mysql -h localhost -u root -p
Enter password:
错误:FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient
这个错误的原因很多,因此需要进行调试。 启动hive带上调试参数,./hive -hiveconf hive.root.logger=DEBUG,console,从调试信息中可以获得错误详细信息。
如果错误信息为:
Caused by: org.datanucleus.exceptions.NucleusException: Attempt to invoke the “BoneCP” plugin to create a ConnectionPool gave an error : The specified datastore driver (“com.mysql.jdbc.Driver”) was not found in the CLASSPATH. Please check your CLASSPATH specification, and the name of the driver.
解决方法:将mysql的jdbc driver拷贝到hive/lib即可。
如果错误信息为:
Caused by: MetaException(message:Version information not found in metastore. )
解决方法:set hive.metastore.schema.verification = false
1
2
3
4
5
6
7
8
9
10
11
<property>
   <name>hive.metastore.schema.verification</name>
   <value>false</value>
    <description>
    Enforce metastore schema version consistency.
    True: Verify that version information stored in metastore matches with one from Hive jars.  Also disable automatic
          schema migration attempt. Users are required to manully migrate schema after Hive upgrade which ensures
          proper metastore schema migration. (Default)
    False: Warn if the version information stored in metastore doesn't match with one from in Hive jars.
    </description>
 </property>

hadoop入门第七步---hive部署安装(apache-hive-1.1.0)

以下操作在hdpsrc3 节点上操作 一,下载安装包 1,下载hive http://mirrors.hust.edu.cn/apache/   得到apache-hive-1.1.0.tar.gz ...

Apache Hive2.1.0安装笔记

Hive2.x已经足够稳定了,前面也安装过hive0.x和Hive1.x的版本,今天我们来看下hive2.x如何安装使用。 环境: centos7.1 Hadoop2.7.3 ...

Hive1.2本地模式安装教程--hive学习

hive安装方式有内嵌方式、本地方式和远程方式。此次搭建hive的目的主要是项目需要学习hive,因此选用较为简单方便的本地模式。这个需要借助mysql,下面进入具体步骤。 一、环境搭建 1.h...

hive2.1.1 部署安装

hive 安装教程 版本 2.1.1,本教程以mysql为元数据存储一、下载Hive下载地址:https://mirrors.tuna.tsinghua.edu.cn/apache/hive/二、my...

基于mysql的hive安装配置(apache-hive-2.0.1-bin.tar.gz)

基于mysql的hive安装配置(apache-hive-2.0.1-bin.tar.gz)
  • nengyu
  • nengyu
  • 2016年06月09日 15:54
  • 1995

Hive安装与配置

  • 2016年10月30日 16:22
  • 521KB
  • 下载

apche hive0.8.1安装配置 doc

  • 2012年07月13日 18:28
  • 20KB
  • 下载

Apache Hive2.1.1安装部署

记录Hive2.1.1版本在CentOS7下的安装部署,及个人遇到的一些坑,一些解决办法。...

Hive2.1.1安装和配置

  • 2017年10月17日 13:55
  • 810KB
  • 下载
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Apache Hive安装及配置
举报原因:
原因补充:

(最多只允许输入30个字)