删除hdfs文件报 permission denied的处理

删除hdfs文件报 permission denied的处理,


参考:
http://heipark.iteye.com/blog/1068139
http://blog.sina.com.cn/s/blog_5f3895a00100w2pu.html

分M/R和客户端程序两种情况.
case A: M/R,只要在执行的机器上加入java参数
-Dhadoop.job.ugi=shentingting,supergroup

case B: 客户端连接去操作,此时加入参数就不管用了,应该修改配置xml文件
(hdfs-site.xml)

<property>
<name>dfs.permissions</name>
<value>false</value>
<description>
If "true", enable permission checking in HDFS.
If "false", permission checking is turned off,
but all other behavior is unchanged.
Switching from one parameter value to the other does not change the mode,
owner or group of files or directories.默认为true,如果true,那么要删除别人创建的文件(夹)就会报 Permission denied: user=xxx, access=WRITE, inode...
</description>
</property>

此处一改,第一种情况也解决了.但是要重启集群环境.

客户端直接访问集群报权限错误:

[FS] INFO [main] HdfsFile.<init>(44) | --分布式文件路径:hdfs://192.168.0.220:9000/usr/local/hadoop/hadoop-root/tmp/oak/local/stt
[FS] ERROR [main] HdfsFile.delete(233) | [分布式文件系统]删除遇到错误
org.apache.hadoop.security.AccessControlException: org.apache.hadoop.security.AccessControlException: Permission denied: user=chenjd, access=WRITE, inode=".svn":shentingting:supergroup:rwxr-xr-x
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.apache.hadoop.ipc.RemoteException.instantiateException(RemoteException.java:95)
at org.apache.hadoop.ipc.RemoteException.unwrapRemoteException(RemoteException.java:57)
at org.apache.hadoop.hdfs.DFSClient.delete(DFSClient.java:830)
at org.apache.hadoop.hdfs.DistributedFileSystem.delete(DistributedFileSystem.java:234)
at com.mw.fs.impl.dfs.HdfsFileSystem.delete(HdfsFileSystem.java:211)
at com.mw.fs.impl.dfs.HdfsFile.delete(HdfsFile.java:231)
at com.mw.fs.utils.MLFileUtils.delete(MLFileUtils.java:143)
at com.mw.fs.utils.MLFileUtils.delete(MLFileUtils.java:182)
at com.mw.fs.utils.MLFileUtils.delete(MLFileUtils.java:178)
at com.mw.fs.utils.MLFileUtils.delete(MLFileUtils.java:178)
at com.mw.fs.utils.MLFileUtils.delete(MLFileUtils.java:198)
at test.TestDFS.delete(TestDFS.java:117)
at test.TestDFS.main(TestDFS.java:27)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值