hive无法通过hiveserver2创建表

wlp8pajw  于 2021-05-29  发布在  Hadoop
关注(0)|答案(1)|浏览(636)

我正在构建一个最简单的配置单元服务器(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)

我的sql on cli是 create table test2(id int) 这很简单。我已经在两个cli上测试了sql hive 以及 beeline 另外,jdbc也有相同的错误输出。
其他事项:
1 show tables 很好用。
2在/config/下配置:
1) 配置单元站点.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) 配置单元默认值.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.metastore.uri进行连接。
我有hdfs /user/hive/warehouse 目录是chmod755,由其他so主题通知。
我挣扎了一整天。希望有什么建议。谢谢
创建数据库时更新也失败:

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用户的设置问题,但我不确定在哪里可以找到所有相关的设置。

ffscu2ro

ffscu2ro1#

它正试图从当地得到位置。确保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>

相关问题