1.安装hive

下载hive:https://downloads.apache.org/hive/
安装及配置hive:hive:https://blog.csdn.net/qq_28854219/article/details/81185610?

2.hive启动失败,hive报错及解决办法

错误一
[root@node01 conf]# hive
19/03/31 09:57:31 WARN conf.HiveConf: HiveConf of name hive.metastore.local does not exist

Logging initialized using configuration in jar:file:/opt/sxt/apache-hive-1.2.2-bin/lib/hive-common-1.2.2.jar!/hive-log4j.properties
Exception in thread “main” java.lang.RuntimeException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient…

可能原因: 没有mysql和hive没有连接上
解决办法: 将mysql-connector-java-5.1.32-bin.jar拷贝一份到hive的lib目录下。
(下载jar包:https://dev.mysql.com/downloads/connector/j/
)

错误二
Terminal initialization failed; falling back to unsupported

可能原因: 这是由于hadoop的目录中存在老版本的jline-0.9.94.jar
解决办法: 将hive下的新版本jline的JAR包拷贝到hadoop下 cp /hive/apache-hive-1.1.0-bin/lib/jline-2.12.jar /hadoop-2.5.2/share/hadoop/yarn/lib/
并删除老版本:jline-0.9.94.jar

错误三
hive.site.xml配置文件出错
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>

  <property>
      <name>hive.server2.thrift.bind.host</name>
      <value>hadoop1</value>
      <description>Bind host on which to run the HiveServer2 Thrift service.</description>
  </property>

   <property>
        <name>datanucleus.fixedDatastore</name>
        <value>false</value>
   </property>
   <property>
        <name>hive.metastore.execute.setugi</name>
        <value>true</value>
    </property>
        <property>
                <name>javax.jdo.option.ConnectionURL</name>
                <value>jdbc:mysql://192.168.223.10:3306/hive?createDatabaseIfNotExist=true&amp;useSSL=false</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>admin</value>
        </property>
        <property>
                <name>hive.metastore.warehouse.dir</name>
                <value>/usr/hive/apache-hive-1.2.2-bin/warehouse</value>
        </property>
        <property>
                <name>hive.exec.scratchdir</name>
                <value>/usr/hive/apache-hive-1.2.2-bin/tmp</value>
        </property>
        <property>
                <name>hive.querylog.location</name>
                <value>/usr/hive/apache-hive-1.2.2-bin/log</value>
        </property>
        <property>
                <name>hive.metastore.schema.verification</name>
                <value>false</value>
        </property>
        <property>
                <name>hbase.zookeeper.quorum</name>
                <value>hadoop1:2181,hadoop2:2181,hadoop3:2181</value>
        </property>
</configuration>

主要修改其中的
jdbc:mysql://master:3306/hive?createDatabaseIfNotExist=true&useSSL=false
master改为对应的主机ip如:
jdbc:mysql://192.168.223.10:3306/hive?createDatabaseIfNotExist=true&useSSL=false

Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐