内嵌模式的简介
使用hive自带默认元数据库derby来进行存储,通常用于测试
1. 优点:使用简单,不用进行配置
2. 缺点:只支持单session。
安装步骤:
1)解压hive并配置环境变量
local]# tar -zxvf apache-hive-2.1.1-bin.tar.gz -C /usr/local
#修改hive安装路径名,方便以后使用
local]# mv apache-hive-2.1.1-bin/ hive
local]# vi /etc/profile
# 添加如下内容:
export HIVE_HOME=/usr/local/hive
export PATH=$HIVE_HOME/bin:$PATH
#让profile生效
local]# source /etc/profile
2) 配置hive-env.sh
如果不存在,就用hive.env.sh.template复制一个
export HIVE_CONF_DIR=/usr/local/hive/conf
export JAVA_HOME=/usr/local/jdk
export HADOOP_HOME=/usr/local/hadoop
export HIVE_AUX_JARS_PATH=/usr/local/hive/lib
3) 配置hive-site.xml
默认是没有hive-site.xml,可以把conf/hive-default.xml.template拷贝过来使用
conf]# cp hive-default.xml.template hive-site.xml
conf]# vi hive-site.xml
把hive-site.xml 中所有包含 ${system:Java.io.tmpdir}替换成/usr/local/hive/iotmp.
如果系统默认没有指定系统用户名,那么要把配置${system:user.name}替换成当前用户名root
扩展:hive-site.xml中有两个重要的配置说明
<!-- 该参数主要指定Hive的数据存储目录 -->
<property>
<name>hive.metastore.warehouse.dir</name>
<value>/user/hive/warehouse</value>
<description>location of default database for the warehouse</description>
</property>
<!-- 该参数主要指定Hive的临时文件存储目录 -->
<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}/<username> is created, with ${hive.scratch.dir.permission}.</description>
</property>
在linux中新建上面两个目录,并且进行权限赋值(可选操作,hive会自动创建)
hive] # hdfs dfs -mkdir -p /user/hive/warehouse
hive] # hdfs dfs -mkdir -p /tmp/hive/
hive] # hdfs dfs -chmod 750 /user/hive/warehouse
hive] # hdfs dfs -chmod 777 /tmp/hive
- 启动hadoop
hadoop]# start-dfs.sh
hadoop]# start-yarn.sh
- 初始化hive的元数据库
hive]# schematool –initSchema –dbType derby
- 启动hive
(注:启动之前要启动hdfs sbin/start-dfs.sh 和yarn sbin/start-yarn.sh )
hive]# bin/hive
#进入后可以执行下面命令进行操作:
hive>show dataases

本文详细介绍了Hive的三种安装模式:内嵌、本地和远程。内嵌模式适合单用户,无需额外配置;本地模式需要安装如MySQL的关系型数据库,支持多session;远程模式则涉及服务端和客户端的配置,允许远程连接操作。文章涵盖了从环境配置到启动客户端的全过程,并强调了关键配置项和注意事项。
最低0.47元/天 解锁文章
5693

被折叠的 条评论
为什么被折叠?



