Hive安装

1. 下载

可以从http://hive.apache.org/downloads.html下载你想要的版本,在这我们使用的是2.1.0版本

2. 解压

把下载好的文件解压到~/opt目录下:

  
  
  1. xiaosi@yoona:~$ tar -zxvf apache-hive-2.1.0-bin.tar.gz -C opt/
3. 配置

根据模板创建配置文件

  
  
  1. xiaosi@yoona:~/opt/hive-2.1.0/conf$ cp hive-default.xml.template hive-site.xml
  2. xiaosi@yoona:~/opt/hive-2.1.0/conf$ cp hive-log4j2.properties.template hive-log4j2.properties

修改配置文件

  
  
  1. <property>
  2.   <name>javax.jdo.option.ConnectionURL</name>
  3.   <value>jdbc:mysql://localhost:3306/hive_meta?createDatabaseIfNotExist=true</value>
  4.   <description>
  5.      JDBC connect string for a JDBC metastore.
  6.      To use SSL to encrypt/authenticate the connection, provide database-specific SSL flag in the connection URL.
  7.      For example, jdbc:postgresql://myhost/db?ssl=true for postgres database.
  8.   </description>
  9. </property>
  10. <property>
  11.   <name>javax.jdo.option.ConnectionDriverName</name>
  12.   <value>com.mysql.jdbc.Driver</value>
  13.   <description>Driver class name for a JDBC metastore</description>
  14. </property>
  15. <property>
  16.   <name>javax.jdo.option.ConnectionUserName</name>
  17.   <value>root</value>
  18.   <description>Username to use against metastore database</description>
  19. </property>
  20. <property>
  21.   <name>javax.jdo.option.ConnectionPassword</name>
  22.   <value>root</value>
  23.   <description>password to use against metastore database</description>
  24. </property>
  25. <property>
  26.   <name>hive.metastore.warehouse.dir</name>
  27.   <value>/user/hive/warehouse</value>
  28.   <description>location of default database for the warehouse</description>
  29. </property>
4. Hive元数据

创建存储Hive元数据的数据库,这里我们使用mysql存储:

  
  
  1. mysql> create database hive_meta;
  2. Query OK, 1 row affected (0.00 sec)
5. 设置环境变量

在/etc/profile文件下添加如下配置:

  
  
  1. # hive path
  2. export HIVE_HOME=/home/xiaosi/opt/hive-2.1.0
  3. export PATH=${HIVE_HOME}/bin:$PATH
6. 启动

运行bin/hive命令,即可启动:

  
  
  1. xiaosi@yoona:~$ cd $HIVE_HOME
  2. xiaosi@yoona:~/opt/hive-2.1.0$ ./bin/hive
  3. SLF4J: Class path contains multiple SLF4J bindings.
  4. SLF4J: Found binding in [jar:file:/home/xiaosi/opt/hive-2.1.0/lib/log4j-slf4j-impl-2.4.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
  5. SLF4J: Found binding in [jar:file:/home/xiaosi/opt/hadoop-2.7.3/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
  6. SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
  7. SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
  8. Logging initialized using configuration in file:/home/xiaosi/opt/hive-2.1.0/conf/hive-log4j2.properties Async: true
  9. Hive-on-MR is deprecated in Hive 2 and may not be available in the future versions. Consider using a different execution engine (i.e. spark, tez) or using Hive 1.X releases.
  10. hive>
如果遇到问题,可以查看[Hive]那些年踩过的Hive坑: 点击打开链接
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值