Hive 3.1.0 安装

环境初始化

  1. 预先安装mysql

解压安装包

安装Hive

1.解压

tar -zxf apache-hive-3.1.0-bin.tar.gz
  1. Set the environment variable HIVE_HOME to point to the installation directory(配置环境变量)
#Set the environment variable HIVE_HOME
export HIVE_HOME="/usr/lib/hive-current"
if [[ -n $HIVE_HOME ]]; then
  export PATH=$HIVE_HOME/bin:$PATH
fi

编辑hive-site.xml(服务端)

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
  <property>
    <name>javax.jdo.option.ConnectionUserName</name>
    <value>gggg</value>
    <description>Username to use against metastore database</description>
  </property>
  <property>
    <name>javax.jdo.option.ConnectionPassword</name>
    <value>123456</value>
    <description>password to use against metastore database</description>
  </property>
  <property>
    <name>javax.jdo.option.ConnectionURL</name>
    <value>jdbc:mysql://mysql_host/hive?createDatabaseIfNotExist=true&amp;characterEncoding=UTF-8</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>hive.metastore.warehouse.dir</name>
     <value>/user/hive/warehouse</value>
  </property>
  
  <property>
     <name>hive.server2.webui.host</name>
     <value>192.168.0.50</value>
  </property>

  <property>
     <name>hive.server2.webui.port</name>
     <value>10002</value>
  </property>
</configuration>

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.uris</name>
    <value>thrift://master:9083</value>
    <description>JDBC connect string for a JDBC metastore</description>
  </property>
  <property>
    <name>hive.metastore.local</name>
    <value>false</value>
    <description>this is local store</description>
  </property>
  <property>
     <name>hive.metastore.warehouse.dir</name>
     <value>/user/hive/warehouse</value>
  </property>
</configuration>

启动HIVE

#run  metastore
hive --service metastore &

#run hiveserver2
hive --service hiveserver2  --hiveconf hive.root.logger=INFO,console &

客户端连接

键入 hive

beeline

bin/beeline -u jdbc:hive2://master:10000
用户名/密码:(hadoop/ )

    原文作者:xiao_kong
    原文地址: https://www.jianshu.com/p/6aa63f6c83e7
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞