设为首页 加入收藏

TOP

ubuntu16.04 本地安装hive
2019-02-19 12:59:41 】 浏览:108
Tags:ubuntu16.04 本地 安装 hive

前提条件 安装hadoop

1.下载hive2.3.3
2.创建hive文件夹
sudo mkdir /usr/share/hive
3.解压hive
sudo tar -zxvf apache-hive-2.3.3-bin.tar.gz -C /usr/share/hive
4.下载mysql-connector-java-5.1.46.tar.gz
sudo tar -zxvf mysql-connector-java-5.1.46.tar.gz
cd mysql-connector-java-5.1.46
cp mysql-connector-java-5.1.46-bin.jar  /usr/share/hive/apache-hive-2.3.3-bin/lib/
5.配置环境变量
# hive2.3.3 environment
export HIVE_HOME=/usr/share/hive/apache-hive-2.3.3-bin
export PATH=$PATH:$HIVE_HOME/bin
#保存退出 :wq
6.配置mysql
#进入mysql
mysql -u root -p
#回车后输入数据库密码
create database hive;
grant all privileges on hive.* to root@localhost identified by '设置密码' with grant option;
flush privileges;
exit
7.配置hive的conf
cd /usr/share/hive/apache-hive-2.3.3-bin
sudo mkdir warehouse
cd /usr/share/hive/apache-hive-2.3.3-bin/conf
sudo vim hive-site.xml

<configuration>
<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 manully 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>
    <!-- 存储在hdfs上的数据路径 -->
    <property>
        <name>hive.metastore.warehouse.dir</name>
        <value>/user/hive/warehouse</value>
        <description>location of default database for the warehouse</description>
    </property>
    <!-- 本地mysql -->
    <property>
        <name>hive.metastore.local</name>
        <value>true</value>
    </property>
    <property>
       <name>javax.jdo.option.ConnectionURL</name>
       <value>jdbc:mysql://localhost:3306/hivecreateDatabaseIfNotExist=true</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>javax.jdo.option.ConnectionPassword</name>
       <value>你mysql的hive数据密码</value>
    </property>
    <property>
        <name>javax.jdo.option.ConnectionUserName</name>
        <value>root</value>
        <description>Username to use against metastore database</description>
     </property>
</configuration>
#保存退出:wq
cd /usr/share/hive/apache-hive-2.3.3-bin/conf
cp hive-env.sh.template hive-env.sh
8.初始化hive的数据库
cd /usr/share/hive/apache-hive-2.3.3-bin/bin
schematool  -dbType mysql -initSchema
schematool  -dbType mysql -info
9.运行
hive --service metastore
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇华为云服务器centos7.2下Hive的UD.. 下一篇第20天:   嵌套复杂类型

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目