Hive安装配置详解
2016-05-21 20:20
260 查看
Hive安装配置详解
1. 安装MySQL
sudo apt-get install mysql-server mysql-client1). 建立数据库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-binexport 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/hiveLogging 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>
相关文章推荐
- 冒泡排序的实现
- windows获取进程id和当前进程的会话id
- Java基础(二)
- HDU 5692 (线段树 dfs序)
- Android EditText在ScrollView中被输入法遮挡
- JAVA敏捷开发环境搭建
- 实习入职第三天:真机调试,用eclipse单步跟踪查看代码---代码超大的情况
- 乘法游戏(tyvj P1014)区间dp
- Android EditText在ScrollView中被输入法遮挡
- Spring MVC学习笔记——给Controller传值
- 送给前线码农的话 - 大牛们的经典语录
- Javascript 理解 js闭包 应用
- Spring、Spring MVC、Hibernate相关内容
- 财务系统数字转化方法
- 函数返回局部变量问题
- Longest Increasing Path in a Matrix | leetcode
- 2016"百度之星" - 初赛(Astar Round2A)
- Linux背景知识
- SQLite数据类型
- hdu1551题解(wa了好多次)