无法在Windows 10上启动Hive:在配置单元配置

时间:2018-02-09 16:45:53

标签: hadoop hive windows-10 authorization

我尝试在Windows 10上安装Hive。尝试启动Hive时收到以下错误:

  

在配置单元配置上应用授权策略时出错:org.apache.hadoop.hive.ql.metadata.HiveException:java.lang.RuntimeException:无法实例化org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient

我使用Derby作为Hive的后端。这是我的hive-site.xml文件:

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
    <name>javax.jdo.option.ConnectionURL</name>
    <value>jdbc:derby://localhost:1527/metastore_db;create=true</value>
    <description>JDBC connect string for a JDBC metastore</description>
</property>
<property>
    <name>javax.jdo.option.ConnectionDriverName</name>
    <value>org.apache.derby.jdbc.ClientDriver</value>
    <description>Driver class name for a JDBC metastore</description>
</property>
<property>
    <name>hive.server2.enable.impersonation</name>
    <description>Enable user impersonation for HiveServer2</description>
    <value>true</value>
</property>
<property>
    <name>hive.server2.authentication</name>
    <value>NONE</value>
    <description>
      Client authentication types.
        NONE: no authentication check
        LDAP: LDAP/AD based authentication
        KERBEROS: Kerberos/GSSAPI authentication
        CUSTOM: Custom authentication provider
                (Use with property hive.server2.custom.authentication.class)
    </description>
</property>
<property>
    <name>datanucleus.autoCreateTables</name>
    <value>True</value>
</property>
</configuration>

我首先启动networkServer:

d:\Hadoop-2.8.1\sbin>startNetworkServer -h 0.0.0.0
Fri Feb 09 08:57:01 EST 2018 : Security manager installed using the Basic server security policy.
Fri Feb 09 08:57:01 EST 2018 : Apache Derby Network Server - 10.14.1.0 - (1808820) started and ready to accept connections on port 1527

然后运行start-all.cmd:

d:\Hadoop-2.8.1\sbin>start-all.cmd

检查NetworkServerControl:

d:\Hadoop-2.8.1\sbin>jps -m
12532 ResourceManager
7156 NetworkServerControl start -h 0.0.0.0
20504 Jps -m
27336 DataNode
22604 NodeManager
492 NameNode

最后,我尝试启动Hive,这就是我收到错误时:

d:\Hadoop-2.8.1\sbin>hive

我注意到在hive的bin目录中没有创建metastore_db:

Directory of d:\Hadoop-2.8.1\hive2_1\bin

02/06/2018  01:48 PM    <DIR>          .
02/06/2018  01:48 PM    <DIR>          ..
11/28/2016  04:32 PM             1,261 beeline
11/28/2016  04:32 PM             2,553 beeline.cmd
02/06/2018  01:48 PM    <DIR>          ext
11/28/2016  04:35 PM             8,692 hive
11/28/2016  04:32 PM             1,584 hive-config.cmd
02/09/2018  08:20 AM             1,900 hive-config.sh
11/28/2016  04:32 PM             8,823 hive.cmd
11/28/2016  04:32 PM               885 hiveserver2
11/28/2016  04:32 PM             1,030 hplsql
11/28/2016  04:32 PM             2,278 hplsql.cmd
11/28/2016  04:32 PM               832 metatool
11/28/2016  04:32 PM               884 schematool
              11 File(s)         30,722 bytes
               3 Dir(s)  427,455,606,784 bytes free

任何人都会看到我出错的地方?

2 个答案:

答案 0 :(得分:0)

我遇到和你一样的问题。

我用:
 的 1。 Hadoop的2.7.6
 2. derby-10.12.1.1
 3. hive-2.1.0

这是我的hive-site.xml文件:

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

<configuration>
    <property>
        <name>javax.jdo.option.ConnectionURL</name>
        <value>jdbc:derby://localhost:1527/metastore_db;create=true</value>
        <description>JDBC connect string for a JDBC metastore</description>
    </property>

    <property>
        <name>javax.jdo.option.ConnectionDriverName</name>
        <value>org.apache.derby.jdbc.ClientDriver</value>
        <description>Driver class name for a JDBC metastore</description>
    </property>

    <property>
        <name>hive.server2.enable.impersonation</name>
        <description>Enable user impersonation for HiveServer2</description>
        <value>true</value>
    </property>

    <property>
        <name>hive.server2.authentication</name>
        <value>NONE</value>
        <description>
            Client authentication types.
              NONE: no authentication check
              LDAP: LDAP/AD based authentication
              KERBEROS: Kerberos/GSSAPI authentication
              CUSTOM: Custom authentication provider (Use with property hive.server2.custom.authentication.class)
        </description>
    </property>

    <property>
        <name>datanucleus.autoCreateSchema</name>
        <value>true</value>
    </property>

    <property>
        <name>datanucleus.fixedDatastore</name>
        <value>true</value>
    </property>

    <property>
        <name>datanucleus.autoCreateTables</name>
        <value>True</value>
    </property>

    <property>
        <name>datanucleus.autoCreateTables</name>
        <value>True</value>
    </property>
</configuration>  

这是我所做的步骤:

  1. 创建一个目录,让我们在驱动器C中说“TestHive”
  2. C:\TestHive
    1. 运行start-all.cmd
    2. C:\Users\{YOUR_PC-NAME}\start-all
      1. 切换到'TestHive'目录
      2. C:\Users\{YOUR_PC-NAME}\cd C:\TestHive
        1. 在“TestHive”目录中启动startNetworkServer -h 0.0.0.0
        2. C:\TestHive\startNetworkServer -h 0.0.0.0
          1. 检查NetworkServerControl
          2. C:\TestHive>jps -m  
            11012 Jps -m  
            6196 DataNode  
            9284 NetworkServerControl start -h 0.0.0.0  
            7544 NameNode  
            10092 NodeManager  
            316 ResourceManager
            1. 在'TestHive'目录中启动hive.cmd
            2. C:\TestHive>hive

              最后,这是我得到的结果:

              C:\TestHive>hive  
              ERROR StatusLogger No log4j2 configuration file found. Using default configurati  
              on: logging only errors to the console.  
              Connecting to jdbc:hive2://  
              SLF4J: Class path contains multiple SLF4J bindings.  
              SLF4J: Found binding in [jar:file:/D:/hive-2.1.0/lib/log4j-slf4j-impl-2.4.1.jar!  
              /org/slf4j/impl/StaticLoggerBinder.class]  
              SLF4J: Found binding in [jar:file:/D:/hadoop-2.7.6/share/hadoop/common/lib/slf4j  
              -log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]  
              SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.  
              
              SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]  
              Connected to: Apache Hive (version 2.1.0)  
              Driver: Hive JDBC (version 2.1.0)  
              Transaction isolation: TRANSACTION_REPEATABLE_READ  
              Beeline version 2.1.0 by Apache Hive  
              hive>  
              

              这是'TestHive'目录的内容:

              Directory of C:\TestHive
              
              10/05/2018  16:37    <DIR>          .
              10/05/2018  16:37    <DIR>          ..
              10/05/2018  16:37               757 derby.log
              10/05/2018  16:37    <DIR>          metastore_db
                             1 File(s)            757 bytes
                             3 Dir(s)  22.890.254.336 bytes free  
              

              注意:我假设您已在Windows环境变量中正确设置了所有变量和路径,并以管理员身份运行cmd

              希望这可以帮助您解决问题。

答案 1 :(得分:0)

对我来说,我必须在hive-site.xml中更改此行,而不是使用localhost:1527

#sign_in_and_redirect

还在hive-site.xml中添加了以下两个属性

jdbc:derby:,databaseName=$HIVE_HOME/metastore_db;create=true
相关问题