Hive 安装

1.下载软件包

https://mirrors.tuna.tsinghua.edu.cn/apache/hive/hive-1.2.2/

2.上传节点并解压

3.配置环境变量,hive加入/etc/profile

4.修改配置文件

1.hive-env.sh
    export JAVA_HOME=/opt/software/jdk1.8
    export HADOOP_HOME=/opt/software/hadoop-2.7.7
    export HIVE_HOME=/opt/software/hive-1.2.2

2.hive-log4j.properties
    hive.log.dir=/opt/software/hive-1.2.2/logs
    log4j.appender.EventCounter=org.apache.hadoop.log.metrics.EventCounter

3.hive-site.xml
<configuration>
    <property>
        <name>javax.jdo.option.ConnectionURL</name>
        <value>jdbc:mysql://sugar01:3306/hive?createDatabaseIfNotExist=true</value>
    </property>
        <property>
                <name>javax.jdo.option.ConnectionDriverName</name>
                <value>com.mysql.jdbc.Driver</value>
        </property>
        <property>
                <name>javax.jdo.option.ConnectionUserName</name>
                <value>root</value>
        </property>
        <property>
                <name>javax.jdo.option.ConnectionPassword</name>
                <value>sugar</value>
        </property>
</configuration>

4.把hive/lib下的line2.12拷贝到hadoop下的share/hadoop/yarn/lib/下,若存在旧版本就替换掉
    cp /opt/software/hive-1.2.2/lib/jline-2.12.jar /opt/software/hadoop-2.7.7/share/hadoop/yarn/lib/

5.把mysql-connector这个jar包,拷贝到hive下的lib下
  mysql-connector这个jar包在
/usr/share/java/mysql-connector-java.jar
6.启动hive(启动前关闭namenode安全模式)
  hdfs dfsadmin -safemode get      查看NameNode是否处于安全模式
  hdfs dfsadmin -safemode enter    进入安全模式
  hdfs dfsadmin -safemode leave    退出安全模式

  hive      
 

 

posted @ 2020-03-15 20:38  Tsugar  阅读(155)  评论(0编辑  收藏  举报