频道栏目
首页 > 资讯 > 云计算 > 正文

Hive安装配置详解

16-05-28        来源:[db:作者]  
收藏   我要投稿

Hive安装配置详解

1. 安装MySQL

sudo apt-get install mysql-server mysql-client

1). 建立数据库hive,

create database hive;

2). 创建用户hive

create user 'hive'@'%' identified by 'hive';

3).创建hive用户,并授权

grant all on hive.* to hive@'%' identified by 'hive';
flush privileges;

 

2.安装Hive

1). 官网下载hive安装包,并解压。
2).hive配置信息,(hive仅需要在master节点配置即可)
我安装在根目录的software下

tg@master:/software$ ls
apache-hive-1.1.1-bin hadoop-2.6.4 hbase-1.2.1-bin.tar.gz zookeeper-3.4.8
apache-hive-1.1.1-bin.tar.gz hbase-1.2.1 jdk1.7.0_80 zookeeper-3.4.8.tar.gz
tg@master:/software$ cd apache-hive-1.1.1-bin/
tg@master:/software/apache-hive-1.1.1-bin$ cd bin
tg@master:/software/apache-hive-1.1.1-bin/bin$ sudo gedit hive-config.sh
在最后加三行
export JAVA_HOME=/software/jdk1.7.0_80
export HIVE_HOME=/software/apache-hive-1.1.1-bin
export HADOOP_HOME=/software/hadoop-2.6.4

3. 添加环境变量etc/profile

export HIVE_HOME=/software/apache-hive-1.1.1-bin
export PATH=$HIVE_HOME/bin:$PATH


4. 修改hive-site.xml文件



javax.jdo.option.ConnectionURL
jdbc:mysql://master:3306/hive?createDatabaseInfoNotExist=true




javax.jdo.option.ConnectionDriverName
com.mysql.jdbc.Driver





javax.jdo.option.ConnectionUserName
hive



javax.jdo.option.ConnectionPassword
hive







5.MySQL 驱动包

下载mysql-connector-java-5.0.6-bin.jar文件,并放到$HIVE_HOME/lib目录下




6. 启动Hive

tg@master:/software/apache-hive-1.1.1-bin$ bin/hive


Logging initialized using configuration in jar:file:/software/apache-hive-1.1.1-bin/lib/hive-common-1.1.1.jar!/hive-log4j.properties
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/software/hadoop-2.6.4/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/software/apache-hive-1.1.1-bin/lib/hive-jdbc-1.1.1-standalone.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
[ERROR] Terminal initialization failed; falling back to unsupported
java.lang.IncompatibleClassChangeError: Found class jline.Terminal, but interface was expected
at jline.TerminalFactory.create(TerminalFactory.java:101)
at jline.TerminalFactory.get(TerminalFactory.java:158)
at jline.console.ConsoleReader.(ConsoleReader.java:229)
at jline.console.ConsoleReader.(ConsoleReader.java:221)
at jline.console.ConsoleReader.(ConsoleReader.java:209)
at org.apache.hadoop.hive.cli.CliDriver.getConsoleReader(CliDriver.java:773)
at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:715)
at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:675)
at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:615)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

如果报错了,解决办法:进入到hadoop安装目录下的share/hadoop/yarn下删除 jline的jar文件。再启动hive即可

tg@master:/software/apache-hive-1.1.1-bin$ bin/hive


Logging initialized using configuration in jar:file:/software/apache-hive-1.1.1-bin/lib/hive-common-1.1.1.jar!/hive-log4j.properties
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/software/hadoop-2.6.4/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/software/apache-hive-1.1.1-bin/lib/hive-jdbc-1.1.1-standalone.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
hive> create table tanggao (key string);
OK
Time taken: 1.414 seconds
hive> show tables;
OK
tanggao
test
Time taken: 0.142 seconds, Fetched: 2 row(s)
hive>





相关TAG标签
上一篇:Java使用JDBC连接Hive(新版本)API封装
下一篇:从零开始学Fuzzing系列:带领nduja突破Grinder的壁垒
相关文章
图文推荐

关于我们 | 联系我们 | 广告服务 | 投资合作 | 版权申明 | 在线帮助 | 网站地图 | 作品发布 | Vip技术培训 | 举报中心

版权所有: 红黑联盟--致力于做实用的IT技术学习网站