windows下安装hive2.1.1


【偷懒计划】家里的笔记本懒得开虚拟机了,开个虚拟机啊卡的要死不划算,so在windows装一个

0.简介

这里以部署2.1.1作为介绍,下载hive3.+版本后,需要加上一个步骤,就是把hive2.x版本的bin目录下哪些cmd文件拷贝到3.x版本里面去,就可以在windows下直接用了,hive3的基本配置和2.1.1差不多,不过多介绍。

1.解压

http://archive.apache.org/dist/hive
下载hive包后解压,然后新建个文件夹my_hive
在这里插入图片描述
myhive里面建几个文件夹
在这里插入图片描述
然后把mysql驱动丢进lib里面
在这里插入图片描述

配置文件

首先改名字
hive-default.xml.template -----> hive-site.xml
hive-env.sh.template -----> hive-env.sh
hive-exec-log4j.properties.template -----> hive-exec-log4j2.properties
hive-log4j.properties.template -----> hive-log4j2.properties
对了,没有hive-site的童鞋把hive-default.xml复制一份叫hive-site。xml即可
然后配置

修改 hive-env.sh

# Set HADOOP_HOME to point to a specific hadoop install directory
export HADOOP_HOME=I:\develop_software\hadoop-2.7.7

# Hive Configuration Directory can be controlled by:
export HIVE_CONF_DIR=I:\develop_software\hive\apache-hive-2.1.1-bin\conf

# Folder containing extra ibraries required for hive compilation/execution can be controlled by:
export HIVE_AUX_JARS_PATH=I:\develop_software\hive\apache-hive-2.1.1-bin\lib

修改 hive-site.xml

 
<!--hive的临时数据目录,指定的位置在hdfs上的目录-->
 
<property>
 
<name>hive.metastore.warehouse.dir</name>
 
<value>/user/hive/warehouse</value>
 
<description>location of default database for the warehouse</description>
 
</property>
 
 
 
<!--hive的临时数据目录,指定的位置在hdfs上的目录-->
 
<property>
 
<name>hive.exec.scratchdir</name>
 
<value>/tmp/hive</value>
 
<description>HDFS root scratch dir for Hive jobs which gets created with write all (733) permission. For each connecting user, an HDFS scratch dir: ${hive.exec.scratchdir}/&lt;username&gt; is created, with ${hive.scratch.dir.permission}.</description>
 
</property>
 
 
 
<!-- scratchdir 本地目录 -->
 
<property>
 
<name>hive.exec.local.scratchdir</name>
 
<value>D:/Soft/apache-hive-2.1.1-bin/my_hive/scratch_dir</value>
 
<description>Local scratch space for Hive jobs</description>
 
</property>
 
<!-- resources_dir 本地目录 -->
 
<property>
 
<name>hive.downloaded.resources.dir</name>
 
<value>D:/Soft/apache-hive-2.1.1-bin/my_hive/resources_dir/${hive.session.id}_resources</value>
 
<description>Temporary local directory for added resources in the remote file system.</description>
 
</property>
 
<!-- querylog 本地目录 -->
 
<property>
 
<name>hive.querylog.location</name>
 
<value>D:/Soft/apache-hive-2.1.1-bin/my_hive/querylog_dir</value>
 
<description>Location of Hive run time structured log file</description>
 
</property>
 
<!-- operation_logs 本地目录 -->
 
<property>
 
<name>hive.server2.logging.operation.log.location</name>
 
<value>D:/Soft/apache-hive-2.1.1-bin/my_hive/operation_logs_dir</value>
 
<description>Top level directory where operation logs are stored if logging functionality is enabled</description>
 
</property>
 
<!-- 数据库连接地址配置 -->
 
<property>
 
<name>javax.jdo.option.ConnectionURL</name>
 
<value>jdbc:mysql://localhost:3306/hive?characterEncoding=UTF-8&amp;createDatabaseIfNotExist=true</value>
 
<description>
 
JDBC connect string for a JDBC metastore.
 
</description>
 
</property>
 
<!-- 数据库驱动配置 -->
 
<property>
 
<name>javax.jdo.option.ConnectionDriverName</name>
 
<value>com.mysql.jdbc.Driver</value>
 
<description>Driver class name for a JDBC metastore</description>
 
</property>
 
<!-- 数据库用户名 -->
 
<property>
 
<name>javax.jdo.option.ConnectionUserName</name>
 
<value>root</value>
 
<description>Username to use against metastore database</description>
 
</property>
 
<!-- 数据库访问密码 -->
 
<property>
 
<name>javax.jdo.option.ConnectionPassword</name>
 
<value>wmzycn</value>
 
<description>password to use against metastore database</description>
 
</property>
 
<!-- 解决 Caused by: MetaException(message:Version information not found in metastore. ) -->
 
<property>
 
<name>hive.metastore.schema.verification</name>
 
<value>false</value>
 
<description>
 
Enforce metastore schema version consistency.
 
True: Verify that version information stored in is compatible with one from Hive jars. Also disable automatic
 
schema migration attempt. Users are required to manually migrate schema after Hive upgrade which ensures
 
proper metastore schema migration. (Default)
 
False: Warn if the version information stored in metastore doesn't match with one from in Hive jars.
 
</description>
 
</property>
 
<!-- 自动创建全部 -->
 
<!-- hive Required table missing : "DBS" in Catalog""Schema" 错误 -->
 
<property>
 
<name>datanucleus.schema.autoCreateAll</name>
 
<value>true</value>
 
<description>Auto creates necessary schema on a startup if one doesn't exist. Set this to false, after creating it once.To enable auto create also set hive.metastore.schema.verification=false. Auto creation is not recommended for production use cases, run schematool command instead.</description>
 
</property>

hdfs上面建立文件夹

在这里插入图片描述在这里插入图片描述

创建hive数据库,注意编码 latin1

在mysql服务器上新建一个数据库叫hive
在这里插入图片描述
在这里插入图片描述
然后启动hadoop
start-all.cmd,没错,hadoop也装在windows
然后启动建表,命令: hive --service metastore
在这里插入图片描述
看到下面这个地方的话建表就成功了
在这里插入图片描述

在这里插入图片描述

测试一下

运行 hive.cmd
创建一张表
hive> create table test_table(id INT,name string);
hive> show tables;
然后在show tables后的信息打印了很多,一直拉下去,能看到test_table,那么我们就装成功辣。
在这里插入图片描述
当然,hdfs上肯定也有了
在这里插入图片描述

  • 1
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值