[Hive_2] Hive 的安装&配置


 

0. 说明

  在安装好 Hadoop 集群和 ZooKeeper 分布式的基础上装好 MySQL,再进行 Hive 安装配置

  

 


 

 

1. 安装

  1.1 将 Hive 安装包通过 Xftp 发送到 /home/centos 目录

  

 

  1.2 解压

 

tar -xzvf apache-hive-2.1.1-bin.tar.gz -C /soft/

 

 

  1.3 创建符号链接

cd /soft/

ln -s apache-hive-2.1.1-bin/ hive

 

 

  1.4 配置环境变量

# hive环境变量
export HIVE_HOME=/soft/hive
export PATH=$PATH:$HIVE_HOME/bin

 

 

  1.5 生效环境变量

source /etc/profile

 


 

 

2. 修改 Hive 配置文件

  2.1 重命名 /soft/hive/conf 目录所有的 template 文件后缀去掉

rename '.template' '' *.template

 

  2.2 修改 hive-env.sh 文件,添加

HADOOP_HOME=/soft/hadoop

 

  2.3 重命名 hive-default.xml 文件为 hive-site.xml

mv hive-default.xml hive-site.xml

 

  2.4 修改 hive-site.xml

<configuration>
  ...
  <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.ConnectionURL</name>
    <value>jdbc:mysql://s101:3306/hive</value>
    <description>
      JDBC connect string for a JDBC metastore.
      To use SSL to encrypt/authenticate the connection, provide database-specific SSL flag in the connection URL.
      For example, jdbc:postgresql://myhost/db?ssl=true for postgres database.
    </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>root</value>
    <description>password to use against metastore database</description>
  </property>
  <property>
    <name>hive.server2.enable.doAs</name>
    <value>false</value>
    <description>
      Setting this property to true will have HiveServer2 execute
      Hive operations as the user making the calls to it.
    </description>
  </property>
  <property>
    <name>hive.metastore.schema.verification</name>
    <value>false</value>
    <description>
      Enforce metastore schema version consistency.
      True: Verify that version information stored in metastore matches 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>


  ...
</configuration>

 

  2.5 修改 hive-site.xml 中的 ${system:user.name} 和 ${system:java.io.tmpdir} //可选

sed -i 's@${system:user.name}@centos@g' hive-site.xml
sed -i 's@${system:java.io.tmpdir}@/home/centos/hive@g' hive-site.xml

 

  2.6 拷贝 MySQL 驱动到 Hive 下

cp ~/mysql-connector-java-5.1.44.jar /soft/hive/lib/

 

  2.7 在 MySQL 中创建数据库 Hive

create database hive;

 

  2.8 初始化元数据库

schematool -initSchema -dbType mysql

 


 

 

3. 启动 Hive 的顺序

  3.1 启动 ZooKeeper

xzk.sh start

 

  3.2 启动 Hadoop(HDFS+MR)

start-all.sh

 


  3.3 启动 Hive

hive

 

 

  3.4 启动 Hive 2代服务

  hiveserver2 为 Hive 的 JDBC 接口,用户可以连接此端口来连接 Hive 服务器

# 先启动
hiveserver2

# 使用新一代客户端 beeline 连接 hiveserer2
beeline -u jdbc:hive2://s101:10000

 


 

转载于:https://www.cnblogs.com/share23/p/9726413.html

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值