前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Hive安装配置详解

Hive安装配置详解

作者头像
汤高
发布2018-01-11 16:29:26
1.7K0
发布2018-01-11 16:29:26
举报
文章被收录于专栏:积累沉淀积累沉淀

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> 

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2016-05-21 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • Hive安装配置详解
    • 1. 安装MySQL
      •  1). 建立数据库hive,
      •  2). 创建用户hive
      • 3).创建hive用户,并授权
    • 3. 添加环境变量etc/profile
      • 4. 修改hive-site.xml文件
        • 5.MySQL 驱动包
          • 6. 启动Hive
          相关产品与服务
          云数据库 SQL Server
          腾讯云数据库 SQL Server (TencentDB for SQL Server)是业界最常用的商用数据库之一,对基于 Windows 架构的应用程序具有完美的支持。TencentDB for SQL Server 拥有微软正版授权,可持续为用户提供最新的功能,避免未授权使用软件的风险。具有即开即用、稳定可靠、安全运行、弹性扩缩等特点。
          领券
          问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档