使用插入覆盖目录拒绝配置单元权限

6yoyoihd  于 2021-06-02  发布在  Hadoop
关注(0)|答案(3)|浏览(468)

在运行以下命令时,我从hdfs获得了拒绝权限失败:

hive -e "insert overwrite directory '/user/hadoop/a/b/c/d/e/f' select * from table_name limit 10;"

错误消息是:

Permission denied: user=hadoop, access=WRITE, inode="/user/hadoop/a/b":hdfs:hive:drwxrwxr-x

但当我跑的时候: hadoop fs -ls /user/hadoop/a ,我得到:

drwxrwxrwx   - hadoop supergroup          0 2014-04-08 00:56 /user/hadoop/a/b

似乎我已经打开了文件夹b的完全权限,为什么我的权限仍然被拒绝?
附言:我已经准备好了 hive.insert.into.multilevel.dirs=true 在配置单元配置文件中。

gcxthw6b

gcxthw6b1#

打开一个新终端,然后尝试以下操作:
1.)将用户更改为根用户:

su

2.)将用户更改为hdfs:

su hdfs

3.)然后运行以下命令:

hadoop fs -chown -R hadoop /user/hadoop/a

现在您可以尝试运行的命令。
希望对你有帮助。。。!!!

pprl5pva

pprl5pva2#

问题实际上不是目录权限的问题。配置单元应该可以访问路径,我的意思是不在文件级别。
下面是有关如何向用户/组授予对hdfs路径和数据库的访问权限的步骤。每个命令的注解都以 # ```

Login as hive superuser to perform the below steps

create role <role_name_x>;

For granting to database

grant all on database to role <role_name_x>;

For granting to HDFS path

grant all on URI '/hdfs/path' to role <role_name_x>;

Granting the role to the user you will use to run the hive job

grant role <role_name_x> to group <your_user_name>;

After you perform the below steps you can validate with the below commands

grant role should show the URI or database access when you run the grant role check on the role name as below

show grant role <role_name_x>;

Now to validate if the user has access to the role

show role grant group <your_user_name>;

这是我通过 Impala 对类似问题的一个回答。有关配置单元权限的详细信息
如果您想查看某些hdfs路径或文件的权限,请根据此处的其他答案和注解给出其他建议 `hdfs dfs -ls` 不是你的朋友知道更多关于权限和它的老派做法。你可以用 `hdfs dfs -getfacl /hdfs/path` 将给你完整的细节,结果如下所示。

hdfs dfs -getfacl /tmp/

file: /tmp

owner: hdfs

group: supergroup

flags: --t

user::rwx
group::rwx
other::rwx

hgqdbh6s

hgqdbh6s3#

我也遇到了同样的问题,我只是通过使用完全限定的hdfs路径来解决它。这样地。

hive -e "insert overwrite directory 'hdfs://<cluster>/user/hadoop/a/b/c/d/e/f' select * from table_name limit 10;"

这里提到这个问题。
但是,我不知道根本原因,但它与权限无关。

相关问题