gpt4 book ai didi

hadoop - hive无法通过hiveserver2创建表

转载 作者:行者123 更新时间:2023-12-02 20:54:16 24 4
gpt4 key购买 nike

我正在构建一个最简单的配置单元服务器(v2.1.1),并希望在其上创建一个简单的表。但是遇到错误:

FAILED: Execution Error, return code 1 from 
org.apache.hadoop.hive.ql.exec.DDLTask.
MetaException(message:file:/user/hive/warehouse/test2 is not a directory
or unable to create one)

我在CLI上的sql是 create table test2(id int),这很简单。
我已经在CLI上测试了 hivebeeline的sql,此外,JDBC也具有相同的错误输出。

其他事情:
1. show tables正常工作。
2. <项目目录> / config /下的配置:
1)hive-site.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://192.168.1.230:3306/hive?createDatabaseIfNotExist=true</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.ConnectionUserName</name>
<value>hive</value>
<description>username to use against metastore database</description>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>hive</value>
<description>password to use against metastore database</description>
</property>

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

2)hive-default.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://192.168.1.230:3306/hive?createDatabaseIfNotExist=true</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.ConnectionUserName</name>
<value>hive<value>
<description>username to use against metastore database</description>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>hive</value>
<description>password to use against metastore database</description>
</property>
</configuration>

3)hadoop用户配置的core-site.xml
<configuration>
<property>
<name>hadoop.proxyuser.hadoop.groups</name>
<value>*</value>
<description>Allow the superuser oozie to impersonate any members of the group group1 and group2</description>
</property>

<property>
<name>hadoop.proxyuser.hadoop.hosts</name>
<value>*</value>
<description>The superuser can connect only from host1 and host2 to impersonate a user</description>
</property>
</configuration>
  • presto可以通过presto-cli在hive中创建表,该表通过hive.metastore.uri连接。
  • 我已通过其他SO主题建议确保hdfs /user/hive/warehouse目录为chmod 755。

  • 我整天都在挣扎。希望有什么建议。谢谢

    更新
    也因创建数据库失败:
    hive> create database testdb;
    FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:Unable to create database path file:/user/hive/warehouse/testdb.db, failed to create database testdb)

    更新
    我认为这可能是hdfs用户的设置问题,但是我不确定在哪里可以找到所有相关设置。

    最佳答案

    它正在尝试从本地获取位置。确保hive-site.xml具有这样的配置

    <property>
    <name>hive.metastore.warehouse.dir</name>
    <value>hdfs://CP000187:9000/user/hive/warehouse</value>
    <description>location of default database for the
    warehouse</description>
    </property>

    关于hadoop - hive无法通过hiveserver2创建表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45078983/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com