linux上安装hive

文章详细描述了如何下载并解压Hive3.1.2安装包,然后配置环境变量,创建并编辑hive-site.xml以连接MySQL数据库,替换Guavajar包,最后初始化并启动Hive的过程。
摘要由CSDN通过智能技术生成

一.hive安装包下载 和解压

首先在hive官网下载安装:Apache Hive

 下载安装包,我这儿下的3.1.2版本

打开之前安装单机版hadoop虚拟机

借助xftp工具将压缩包放入/opt/install/ 的目录

解压压缩包放到/opt/soft/目录

[root@gree2 install]# tar -zxf apache-hive-3.1.2-bin.tar.gz -C ../soft/

改名为hive312

[root@gree2 soft]# mv apache-hive-3.1.2-bin/ hive312

二.配置变量

先配置环境变量

root@gree2 hive312]# vim /etc/profile

填入以下配置

#HIVE_HOME
export HIVE_HOME=/opt/soft/hive312
export PATH=$PATH:$HIVE_HOME/bin

 

刷新一下

source /etc/profile

 再进入到conf文件目录中

[root@gree2 hive312]# cd conf/

 创建hive-site.xml文件

[root@gree2 conf]# touch hive-site.xml

 修改该文件

[root@gree2 conf]# vim hive-site.xml

 往其中填入配置

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
  <property>
    <name>hive.metastore.warehouse.dir</name>
    <value>/opt/soft/hive312/warehouse</value>
  </property>
  <property>
    <name>hive.metastore.db.type</name>
    <value>mysql</value>
  </property>
  <property>
    <name>javax.jdo.option.ConnectionURL</name>
    <value>jdbc:mysql://192.168.61.141:3306/hive143?createDatabaseIfNotExist=true</value>
  </property>
  <property>
    <name>javax.jdo.option.ConnectionDriverName</name>
    <value>com.mysql.cj.jdbc.Driver</value>
  </property>
  <property>
    <name>javax.jdo.option.ConnectionUserName</name>
    <value>root</value>
  </property>
  <property>
    <name>javax.jdo.option.ConnectionPassword</name>
    <value>root</value>
  </property>
  <property>
    <name>hive.metastore.schema.verification</name>
    <value>false</value>
    <description>关闭schema验证</description>
  </property>
  <property>
    <name>hive.cli.print.current.db</name>
    <value>true</value>
    <description>提示当前数据库名</description>
  </property>
  <property>
    <name>hive.cli.print.header</name>
    <value>true</value>
    <description>查询输出时带列名一起输出</description>
  </property>
</configuration>

 三.修改其他内容配置

[root@gree2 hive312]# ls ./lib/ | grep guava

 [root@gree2 hive312]# rm -f ./lib/guava-19.0.jar 

 转入新的jar包

查看guava jar包

[root@gree2 hive312]# find /opt/soft/hadoop313/ -name guava*

转移到hive312路径

 [root@gree2 hive312]# cp /opt/soft/hadoop313/share/hadoop/common/lib/guava-27.0-jre.jar ./lib/

四.初始化启动hive 

初始化hive

[root@gree2 hive312]# schematool -dbType mysql -initSchema

 出现如上图就时成功

输入hive指令

 出现上图为成功

输入exit;指令退出

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值