Hadoop平台搭建--06hive搭建

安装MySQL
https://blog.csdn.net/qq_38821502/article/details/90053717
安装HIVE

  1. 切换到/usr/local/目录下
    cd /usr/local/

  2. 上传hive安装包
    Hadoop平台搭建--06hive搭建
    Hadoop平台搭建--06hive搭建

  3. 解压hive tar -zxcf apache-hive-2.3.4-bin.tar.gz
    Hadoop平台搭建--06hive搭建
    Hadoop平台搭建--06hive搭建

  4. 修改目录名 mv apache-hive-2.3.4-bin hive
    Hadoop平台搭建--06hive搭建

  5. 删除hive安装包 rm -r apache-hive-2.3.4-bin.tar.gz
    Hadoop平台搭建--06hive搭建

  6. 配置环境变量 vi /etc/profile/
    Hadoop平台搭建--06hive搭建

  7. 让环境变量生效 source /etc/profile

  8. cd conf 切换到conf目录下
    Hadoop平台搭建--06hive搭建

  9. 修改 hive-env.sh.template 名称为hive-site.sh
    cp hive-env.sh.template hive-env.sh
    Hadoop平台搭建--06hive搭建

  10. 配置hive-env.sh 文件 vi hive-env.sh
    配置HADOOP_HOME、HIVE_CONF_DIR、HIVE_AUX_JARS_PATH路径
    Hadoop平台搭建--06hive搭建

  11. 创建两个hdfs目录
    hadoop fs -mkdir /tmp
    hadoop fs -mkdir -p /user/hive/warehouse
    Hadoop平台搭建--06hive搭建
    Hadoop平台搭建--06hive搭建
    Hadoop平台搭建--06hive搭建

  12. cp hive-default.xml.template hive-site.xml (以下配置极为重要配置错误可能会出现各种错误)

    <property>
        <name>javax.jdo.option.ConnectionURL</name>
    	<value>jdbc:mysql://master:3306/metastore?createDatabaseIfNotExist=true&amp;useSSL=false&amp;useUnicode=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>javax.jdo.option.ConnectionPassword</name>
        <value>Triumph.007</value>
        <description>password to use against metastore database</description>
    </property>
    <property>
        <name>javax.jdo.option.ConnectionUserName</name>
        <value>root</value>
        <description>Username to use against metastore database</description>
    </property>
    <property>
        <name>hive.exec.local.scratchdir</name>
        <value>/usr/local/hive/tmp//${user.name}</value>
        <description>Local scratch space for Hive jobs</description>
    </property>
    <property>
        <name>hive.downloaded.resources.dir</name>
        <value>/usr/local/hive/tmp//${hive.session.id}_resources</value>
        <description>Temporary local directory for added resources in the remote file system.</description>
    </property>
    <property>
        <name>hive.server2.logging.operation.log.location</name>
        <value>/usr/local/hive/tmp//${system:user.name}/operation_logs</value>
        <description>Top level directory where operation logs are stored if logging functionality is enabled</description>
    </property>
    <property>
        <name>hive.querylog.location</name>
        <value>/usr/local/hive/tmp//${system:user.name}</value>
        <description>Location of Hive run time structured log file</description>
    </property>
    <property>
        <name>datanucleus.schema.autoCreateAll</name>
        <value>true</value>
        <description>Auto creates necessary schema on a startup if one doesn't exist. Set this to false, after creating it once.To enable auto create also set hive.metastore.schema.verification=false. Auto creation is not recommended for production use cases, run schematool command instead.</description>
    </property>
  1. 上传mysql-connector-java-5.1.47.tar.gz,然后解压
    tar -zxvf mysql-connector-java-5.1.47.tar.gz
  2. 切换到该压缩包目录下
    将jar包拷贝到hive安装目录的lib目录下
    cp mysql-connector-java-5.1.47-bin.jar /usr/local/hive/lib/
    Hadoop平台搭建--06hive搭建
  3. schematool -dbType mysql -initSchema 初始化源数据库
  4. hive 运行hive即可
    Hadoop平台搭建--06hive搭建
上一篇:软件测试常见术语(英->汉)收藏好随时备用!


下一篇:HBase原理之HBase MetaStore&Compaction剖析