zoukankan      html  css  js  c++  java
  • hive安装

    hive安装

    hive hadoop 安装 配置

    1. 安装文件

    上传文件apache-hive-2.3.3-bin.tar.gz到/opt/hadoop下

    解压

    tar -xzvf apache-hive-2.3.3-bin.tar.gz

    1540305751435

    1. 设置环境变量

    vi /etc/profile

    export HIVE_HOME=/opt/hadoop/apache-hive-2.3.3-bin

    export PATH=$PATH:$HIVE_HOME/bin

    1540306330915

    enter description here

    查看hive版本

    hive --version

    1540306497776

    1. 修改配置文件

    修改hive-site.xml文件

    cd /opt/hadoop/apache-hive-2.3.3-bin/conf

    cp hive-default.xml.template hive-site.xml

    vi hive-site.xml

    <property>

        <name>javax.jdo.option.ConnectionUserName</name>

        <value>hive</value>

        <description>Username to use against metastore database</description>

    </property>

    <property>

        <name>javax.jdo.option.ConnectionPassword</name>

        <value>hive</value>

        <description>password to use against metastore database</description>

    </property>

    <property>

        <name>javax.jdo.option.ConnectionURL</name>

        <value>jdbc:mysql://172.18.12.2:3306/hive</value>

    </property>

    <property>

        <name>javax.jdo.option.ConnectionDriverName</name>

        <value>com.mysql.jdbc.Driver</value>

        <description>Driver class name for a JDBC metastore</description>

    </property>

    修改hive-env.sh文件

    cp hive-env.sh.template hive-env.sh

    vi hive-env.sh

    HADOOP_HOME=/opt/hadoop/hadoop-2.8.5

    1. 连接mysql

    复制mysql的驱动程序到hive/lib下面

    创建mysql的元数据库

    schematool -dbType mysql -initSchema

    1540308528619

    hadoop fs -mkdir /user/hive

    hadoop fs -chown hive:hadoop /user/hive

    启动hvie

    运行hive之前首先要确保meta store服务已经启动,

    nohup hive --service metastore > metastore.log 2>&1 &

    启动hive service

    nohup hive --service hiveserver2 > hiveserver2.log 2>&1 &

    hive

    1540311014569

    通过beeline连接

    beeline -u jdbc:hive2://172.18.12.1:10000/default -n hive

    1540312311398

    访问web

    http://172.18.12.1:10002/

    1540472711497

    1. 报错处理

    Exception in thread "main" java.lang.IllegalArgumentException: java.net.URISyntaxException: Relative path in absolute URI: ${system:java.io.tmpdir%7D/$%7Bsystem:user.name%7D

    解决方案:将hive-site.xml配置文件的

    hive.querylog.location

    hive.exec.local.scratchdir

    hive.downloaded.resources.dir

    三个值(原始为$标识的相对路径)写成绝对值/var/log/hadoop/hive

    User: hive is not allowed to impersonate hive (state=08S01,code=0)

    1540311587546

    enter description here

    解决方案:

    修改core-site.xml文件

    <property>

        <name>hadoop.tmp.dir</name>

        <value>/u01/hadoop/tmp</value>

        <description>Abase for other temporary directories.</description>

      </property>

      <property>

        <name>hadoop.proxyuser.hive.hosts</name>

        <value>*</value>

      </property>

      <property>

        <name>hadoop.proxyuser.hive.groups</name>

       <value>*</value>

      </property>

  • 相关阅读:
    0309. Best Time to Buy and Sell Stock with Cooldown (M)
    0621. Task Scheduler (M)
    0106. Construct Binary Tree from Inorder and Postorder Traversal (M)
    0258. Add Digits (E)
    0154. Find Minimum in Rotated Sorted Array II (H)
    0797. All Paths From Source to Target (M)
    0260. Single Number III (M)
    0072. Edit Distance (H)
    0103. Binary Tree Zigzag Level Order Traversal (M)
    0312. Burst Balloons (H)
  • 原文地址:https://www.cnblogs.com/brock0624/p/9852934.html
Copyright © 2011-2022 走看看