• hadoop+hive+spark搭建(二)


    上传hive软件包到任意节点

    一、安装hive软件 

      解压缩hive软件包到/usr/local/hadoop/目录下

         

      重命名hive文件夹

         

      在/etc/profile文件中添加环境变量

          export HIVE_HOME=/usr/local/hadoop/hive

          export PATH=$HIVE_HOME/bin:$PATH

      运行命令source /etc/profile

     

       使用mysql作为数据库时需要安装mysql

       在mysql中创建hive用户,数据库等

         create user 'hive' identified by 'hive';
         create database hive;
         grant all on hive.* to hive@'%'  identified by 'hive';
         grant all on hive.* to hive@'localhost'  identified by 'hive';
         flush privileges;

       退出mysql

       拷贝mysql-connector-java.jar到hive目录下lib/中

    二、修改配置文件

        修改hive目录中conf/hive-default.xml.template文件为conf/hive-site.xml

        在conf目录中修改配置文件hive-site.xml

          (使用默认数据库)

         

          <property>
            <name>hive.exec.local.scratchdir</name>
            <value>/home/hive/iotmp</value>
            <description>Local scratch space for Hive jobs</description>
          </property>
          <property>
            <name>hive.downloaded.resources.dir</name>
            <value>/home/hive/iotmp</value>
            <description>Temporary local directory for added resources in the remote file system.</description>
          </property>
          <property>
            <name>hive.querylog.location</name>
            <value>/home/hive/iotmp</value>
            <description>Location of Hive run time structured log file</description>
          </property>

          <property>
            <name>hive.exec.local.scratchdir</name>
            <value>/home/hive/iotmp</value>
            <description>Local scratch space for Hive jobs</description>
          </property>

         (mysql数据库)
         
          <property> 
             <name>javax.jdo.option.ConnectionURL </name> 
             <value>jdbc:mysql://localhost:3306/hive </value> 
          </property> 
     
          <property> 
             <name>javax.jdo.option.ConnectionDriverName </name> 
             <value>com.mysql.jdbc.Driver </value> 
          </property>
     
          <property> 
             <name>javax.jdo.option.ConnectionPassword </name> 
             <value>hive </value> 
          </property>

          <property>
            <name>hive.exec.local.scratchdir</name>
            <value>/home/hive/iotmp</value>
            <description>Local scratch space for Hive jobs</description>
          </property>
          

          <property>
            <name>hive.downloaded.resources.dir</name>
            <value>/home/hive/iotmp</value>
            <description>Temporary local directory for added resources in the remote file system.</description>
          </property>
          <property>
            <name>hive.querylog.location</name>
            <value>/home/hive/iotmp</value>
            <description>Location of Hive run time structured log file</description>
          </property>

          <property>
            <name>hive.exec.local.scratchdir</name>
            <value>/home/hive/iotmp</value>
            <description>Local scratch space for Hive jobs</description>
          </property>

     
     

    三、运行hive

      输入命令格式化数据库

        默认数据库  schematool -initSchema -dbType derby 

        mysql数据库 schematool -initSchema -dbType mysql 

     

      启动hive

          输入命令hive

          

    hive安装完毕

      
  • 相关阅读:
    C# 创建Excel或需不安装Office
    Spring学习之旅(八)Spring 基于AspectJ注解配置的AOP编程工作原理初探
    Spring学习之旅(七)基于XML配置与基于AspectJ注解配置的AOP编程比较
    开发Spring过程中几个常见异常(三):java.lang.ClassCastException: com.sun.proxy.$Proxy4 cannot be cast to com.edu.aop.ArithmeticCalculatorImpl at com.edu.aop.Main.main(Main.java:11)
    Spring学习之旅(六)Spring AOP工作原理初探
    开发Spring过程中几个常见异常(二):Exception encountered during context initialization
    Spring学习之旅(五)极速创建Spring AOP java工程项目
    Spring学习之旅(四)Spring工作原理再探
    Spring学习之旅(三)Spring工作原理初探
    Spring学习之旅(二)极速创建Spring框架java Web工程项目
  • 原文地址:https://www.cnblogs.com/lonenysky/p/6775876.html
Copyright © 2020-2023  润新知