[Hive]Hive安装

  1. 云栖社区>
  2. 博客>
  3. 正文

[Hive]Hive安装

sjf0115 2016-12-04 17:26:37 浏览735
展开阅读全文
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/SunnyYoona/article/details/53455285
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/500
评论
sjf0115
+ 关注