安装Hive

安装Hive

安装Java环境:Hive需要Java环境支持,所以需要先安装Java。安装文档:http://t.csdn.cn/deBJu

下载Hive

下载Hive的二进制文件。

链接:https://pan.baidu.com/s/1fdg76k9kvd896pMpfYEG5w
提取码:8888

解压Hive

将下载的Hive压缩包解压到指定目录。

[root@master ~]# cd /usr/local
[root@master local]# ll
总用量 279464
-rw-r--r--.  1 root  root  286170958 67 11:18 apache-hive-2.3.9-bin.tar.gz
drwxr-xr-x. 11  1000  1000       272 525 08:49 hadoop-3.3.1
drwxr-xr-x.  8 10143 10143       273 48 2021 jdk1.8.0_291

# 解压
[root@master local]# tar -zxvf apache-hive-2.3.9-bin.tar.gz
[root@master local]# ll
总用量 279464
drwxr-xr-x. 10 root  root        184 67 11:22 apache-hive-2.3.9-bin
-rw-r--r--.  1 root  root  286170958 67 11:18 apache-hive-2.3.9-bin.tar.gz
drwxr-xr-x. 11  1000  1000       272 525 08:49 hadoop-3.3.1
drwxr-xr-x.  8 10143 10143       273 48 2021 jdk1.8.0_291

配置Hive环境变量

将Hive的bin目录添加到系统环境变量中。

[root@master local]# vi /etc/profile
# Hive
export HIVE_HOME=/usr/local/apache-hive-2.3.9-bin
export PATH=$PATH:$HIVE_HOME/bin

[root@master local]# source /etc/profile

配置Hive配置文件

[root@master local]# cd apache-hive-2.3.9-bin/conf

[root@master conf]# vi hive-env.sh.template
HADOOP_HOME=$HADOOP_HOME
export HIVE_CONF_DIR=$HIVE_HOME/conf

修改Hive的配置文件hive-site.xml,设置Hive的元数据存储方式、Hadoop的配置文件路径等。

启动Hive

在命令行中输入hive命令,启动Hive。

[root@master conf]# hdfs namenode -format
[root@master conf]# start-dfs.sh
[root@master conf]# start-yarn.sh
[root@master conf]# hive
which: no hbase in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/jdk1.8.0_291/bin:/usr/local/jdk1.8.0_291/jre/bin:/usr/local/hadoop-3.3.1/bin:/usr/local/hadoop-3.3.1/sbin:/root/bin:/usr/local/jdk1.8.0_291/bin:/usr/local/jdk1.8.0_291/jre/bin:/usr/local/hadoop-3.3.1/bin:/usr/local/hadoop-3.3.1/sbin:/usr/local/apache-hive-2.3.9-bin/bin)
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/local/apache-hive-2.3.9-bin/lib/log4j-slf4j-impl-2.6.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/local/hadoop-3.3.1/share/hadoop/common/lib/slf4j-log4j12-1.7.30.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.apache.logging.slf4j.Log4jLoggerFactory]

Logging initialized using configuration in jar:file:/usr/local/apache-hive-2.3.9-bin/lib/hive-common-2.3.9.jar!/hive-log4j2.properties Async: true
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.
hive> 


  1. 测试Hive:在Hive命令行中输入一些Hive查询语句,测试Hive是否正常工作。

你可能感兴趣的:(大数据,hive,hadoop,大数据)