Hive安装配置详解

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文件

<configuration>

 <property> 

   <name>javax.jdo.option.ConnectionURL</name> 

   <value>jdbc:mysql://master:3306/hive?createDatabaseInfoNotExist=true</value> 

</property> 

<property> 

   <name>javax.jdo.option.ConnectionDriverName</name> 

   <value>com.mysql.jdbc.Driver</value> 

</property>

 <property>

        <name>javax.jdo.option.ConnectionUserName</name>

        <value>hive</value>

    </property>

<property> 

   <name>javax.jdo.option.ConnectionPassword</name> 

   <value>hive</value> 

</property> 

</configuration>

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.<init>(ConsoleReader.java:229)

at jline.console.ConsoleReader.<init>(ConsoleReader.java:221)

at jline.console.ConsoleReader.<init>(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> 

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

发表于

我来说两句

0 条评论
登录 后参与评论

相关文章

来自专栏流柯技术学院

Python WMI获取Windows系统信息 监控系统

1331
来自专栏木宛城主

SharePoint 2013 Service 状态无法启动,显示“启动中(Starting)”

Problem 在SharePoint 2013 Central Administration中启动 SharePoint Service(也称为:Servic...

2288
来自专栏大数据学习笔记

Spark2.x学习笔记:13、Spark SQL快速入门

13、 Spark SQL快速入门 13.1 本地表 (1)准备数据 [root@node1 ~]# mkdir /tmp/data [root@node1 ~...

5405
来自专栏Spring相关

快速创建SpringBoot+SSM解析

此处使用IDEA快速搭建SpringBoot应用,首先用SpringBoot搭建WEB工程:

1572
来自专栏小尘哥的专栏

springboot使用rabbitMQ(带回调)

配置文件2:RabbitConstants(主要用于用户名、密码等值从配置文件获取,也可以用@Value方式)

1236
来自专栏Java成神之路

hive_异常_01_ Terminal initialization failed; falling back to unsupported

Hadoop lib 下已经存在了 jline 0.9x ,但是在hive中将Jline升级到了Jline2。

1004
来自专栏Android 开发学习

IntelliJ IDEA spring mvc +mybatis 环境搭建服务器(下)直接使用类来生成Mapper:

2016
来自专栏张善友的专栏

SharePoint Foundation 2010

下图是一张SharePoint 2010基本架构图,它简要的描述出了SharePoint 2010的基本结构。SharePoint Foundation在之前的...

2049
来自专栏Hongten

spring开发_JDBC操作MySQL数据库_使用xml配置事务管理

http://www.cnblogs.com/hongten/archive/2012/03/09/java_spring_jdbc.html

1221
来自专栏石奈子的Java之路

原 荐 SpringBoot 2.0 系列0

2384

扫码关注云+社区

领取腾讯云代金券