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/ )

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容