2

我正在尝试导入数据(具有两列 int 和 string 的简单文件),表格看起来:

hive> describe test;
id      int
name    string

当我尝试导入时:

hive> load data inpath '/user/test.txt' overwrite into table test;
Loading data to table default.test
rmr: org.apache.hadoop.security.AccessControlException: Permission denied: user=hadoop, access=ALL, inode="/user/hive/warehouse/test":hive:hadoop:drwxrwxr-x
Failed with exception org.apache.hadoop.security.AccessControlException: Permission denied: user=hadoop, access=WRITE, inode="/user/hive/warehouse/test":hive:hadoop:drwxrwxr-x
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.MoveTask

看起来用户 hadoop 拥有所有权限,但仍然无法加载数据,但是我能够创建表。怎么了?

4

3 回答 3

4

Hive 使用 Metastore 作为元数据。所有表定义都在其中创建,但实际数据存储在hdfs中。目前 hive 权限和hdfs权限是完全不同的东西。他们是无关的。您有几种解决方法:

  1. 完全禁用权限(对于 hdfs hdfs)
  2. 使用基于存储的https://cwiki.apache.org/confluence/display/Hive/HCatalog+Authorization(在这种情况下,如果您在 hdfs 上没有数据库目录,您将无法创建表)
  3. 提交 hive 用户下的所有作业 ( sudo -u hive hive )
  4. 创建数据库:

    create database hadoop;

并在具有正确权限的hdfs中创建所需的目录

hdfs dfs -mkdir /user/hive/warehouse/hadoop.db; 
hdfs dfs -chown hadoop:hive /user/hive/warehouse/hadoop.db
hdfs dfs -chmod g+w /user/hive/warehouse/hadoop.db

当然,您应该启用hive.metastore.client.setugi=trueand hive.metastore.server.setugi=true。这些参数指示 hive 在当前 shell 用户下执行作业(看起来这些参数已经启用,因为 hive 无法创建目录)。

于 2012-10-08T18:55:28.273 回答
2

这个问题是因为语法。

为生成表格而给出的格式应该与输入文件格式相似。

于 2013-12-26T10:13:58.743 回答
0

是的,这是 HDFS 中目标目录的权限错误。一种对我有用的方法:

  1. 识别 HDFS 中的目标目录,hive > describe extended [problem table name];在 location 参数下,如果你不知道那在哪里,那么
  2. 更改该目录的权限:

hadoop fs -chmod [-R] nnn /问题/表/目录

根据您的设置,可能必须以超级用户身份运行。使用 -R 选项将新权限应用于目录中的所有内容。选择适合您系统的 nnn。

于 2016-05-19T10:51:48.660 回答