Hive1.1.0 安装

来源:互联网 发布:康奈尔大学商学院 知乎 编辑:程序博客网 时间:2024/06/02 11:08

一、 hive下载:
http://hive.apache.org/downloads.html
解压 apache-hive-1.1.0-bin.tar.gz 到你想要的目录下

tar xzf hadoop.2.6.0.tar.gz

二、配置
1. 设置环境变量,可以配置在/etc/profile文件中。

export HIVE_HOME=/home/hadoop/apache-hive-1.1.0-binexport PATH=$PATH:$HIVE_HOME/binexport CLASSPATH=$CLASSPATH:$HIVE_HOME/lib
  1. 配置文件修改
    配置文件位置/XXXX/apache-hive-1.1.0-bin/conf
    cp hive-env.sh.template hive-env.sh
    更改hive-env.sh的内容:
    HADOOP_HOME=/XXXX/hadoop/hadoop-2.6.0
    export HIVE_CONF_DIR=/home/hadoop/apache-hive-1.1.0-bin/conf

配置hive-site.xml(这里不要把文件命名为hive-default.xml)
cp hive-default.xml.template hive-site.xml
hive-site.xml主要是配置以下几个属性:

<property>   <name>javax.jdo.option.ConnectionURL</name>   <value>jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true</value>   <description>JDBC connect string for a JDBCmetastore</description></property><property>   <name>javax.jdo.option.ConnectionDriverName</name>   <value>com.mysql.jdbc.Driver</value>   <description>Driver class name for a JDBCmetastore</description></property><property>   <name>javax.jdo.option.ConnectionUserName</name>   <value>hive</value>   <description>Username to use against metastoredatabase</description></property><property>   <name>javax.jdo.option.ConnectionPassword</name>   <value>hive</value>   <description>password to use against metastoredatabase</description></property>

然后启动mysql,再启动hive

hive启动时会报一些常见错误:
1. system:java.io.tmpdir
解决方案:http://blog.csdn.net/zwx19921215/article/details/42776589
2. permission denied
解决方案: chmod 777 文件名
3. Found class jline.Terminal, but interface was expected
解决方案:http://www.mamicode.com/info-detail-516526.html

good luck!
解决完一堆错误之后,成功启动hive如下:

XXXX@ubuntu:~$ hiveLogging initialized using configuration in jar:file:/opt/hive/apache-hive-1.1.0-bin/lib/hive-common-1.1.0.jar!/hive-log4j.propertiesSLF4J: Class path contains multiple SLF4J bindings.SLF4J: Found binding in [jar:file:/opt/hadoop/hadoop-2.6.0/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]SLF4J: Found binding in [jar:file:/opt/hive/apache-hive-1.1.0-bin/lib/hive-jdbc-1.1.0-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> show tables;OKTime taken: 0.753 secondshive> 
0 0
原创粉丝点击