【问题标题】:Unable to start Hive on Windows 10: Error applying authorization policy on hive configuration无法在 Windows 10 上启动 Hive:在 Hive 配置上应用授权策略时出错
【发布时间】:2018-02-09 16:45:52
【问题描述】:

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

在 hive 配置上应用授权策略时出错:org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeException: Unable to instance 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

有人知道我哪里出错了吗?

【问题讨论】:

    标签: hadoop hive windows-10 authorization


    【解决方案1】:

    我遇到了和你一样的问题。

    我使用:
    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”
    C:\TestHive
    1. 运行 start-all.cmd
    C:\Users\{YOUR_PC-NAME}\start-all
    1. 切换到“TestHive”目录
    C:\Users\{YOUR_PC-NAME}\cd C:\TestHive
    1. 在“TestHive”目录中启动 startNetworkServer -h 0.0.0.0
    C:\TestHive\startNetworkServer -h 0.0.0.0
    1. 检查 NetworkServerControl
    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
    C:\TestHive&gt;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

    希望这能帮助您解决问题。

    【讨论】:

      【解决方案2】:

      对我来说,我不得不在 hive-site.xml 中更改这一行,而不是使用 localhost:1527

      jdbc:derby:,databaseName=$HIVE_HOME/metastore_db;create=true
      

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

      <property>
      <name>hive.downloaded.resources.dir</name>
      <value>c:/tmp/hive/${hive.session.id}_resources</value>
      </property>
      <property>
      <name>hive.metastore.schema.verification</name>
      <value>false</value>
      </property>
      

      【讨论】:

        猜你喜欢
        • 2017-07-30
        • 2019-10-25
        • 2016-08-01
        • 1970-01-01
        • 2017-11-04
        • 1970-01-01
        • 1970-01-01
        • 2018-07-17
        • 2019-08-14
        相关资源
        最近更新 更多