- 爱易网页
-
Linux
- hdfs上传下载中,报权限异常,求解释~hadoop开发
日期:2014-05-16 浏览次数:20670 次
hdfs上传下载中,报权限错误,求解释~hadoop开发
在hadoop集群中的机子运行时,正确;
但在非hadoop集群中的机子中运行时报错,估计报的是权限错误,求解释~~!
求高人指导~~~
代码如下:
public class Loadup {
public static void main(String[] args) throws Exception{
// TODO Auto-generated method stub
final int piece=10;
String localSrc=args[0];
String Dst=args[1];
Configuration conf=new Configuration();
InputStream in=new BufferedInputStream(new FileInputStream(localSrc));
FileSystem fs=FileSystem.get(URI.create(Dst),conf);
OutputStream out=fs.create(new Path(Dst),new Progressable(){
public void progress(){
System.out.println("copy:......");
}
});
IOUtils.copyBytes(in, out, 4096,true);
System.out.println("success");
}
}
报错情况如下:
Exception in thread "main" org.apache.hadoop.security.AccessControlException: org.apache.hadoop.security.AccessControlException: Permission denied: user=lenovo-pc\lenovo, access=WRITE, inode="hadoopnode":hadoopnode:supergroup:rwxr-xr-x
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.apache.hadoop.ipc.RemoteException.instantiateException(RemoteException.java:96)
at org.apache.hadoop.ipc.RemoteException.unwrapRemoteException(RemoteException.java:58)
at org.apache.hadoop.hdfs.DFSClient$DFSOutputStream.<init>(DFSClient.java:2710)
at org.apache.hadoop.hdfs.DFSClient.create(DFSClient.java:492)
at org.apache.hadoop.hdfs.DistributedFileSystem.create(DistributedFileSystem.java:195)
at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:484)
at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:384)
at Loadup.main(Loadup.java:23)
Caused by: org.apache.hadoop.ipc.RemoteException: org.apache.hadoop.security.AccessControlException: Permission denied: user=lenovo-pc\lenovo, access=WRITE, inode="hadoopnode":hadoopnode:supergroup:rwxr-xr-x
at org.apache.hadoop.hdfs.server.namenode.PermissionChecker.check(PermissionChecker.java:176)
at org.apache.hadoop.hdfs.server.namenode.PermissionChecker.check(PermissionChecker.java:157)
at org.apache.hadoop.hdfs.server.namenode.PermissionChecker.checkPermission(PermissionChecker.java:105)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.checkPermission(FSNamesystem.java:4514)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.checkAncestorAccess(FSNamesystem.java:4484)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.startFileInternal(FSNamesystem.java:1027)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.startFile(FSNamesystem.java:981)
at org.apache.hadoop.hdfs.server.namenode.NameNode.create(NameNode.java:377)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:508)
at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:959)
at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:955)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:416)
at org.apache.hadoop.ipc.Server$Handler.run(Server.java:953)
at org.apache.hadoop.ipc.Client.call(Client.java:740)
at org.apache.hadoop.ipc.RPC$Invoker.invoke(RPC.java:220)
at $Proxy0.create(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)