The DISTCP command for Hadoop allows you to copy files from one HDFs file system to another, as follows:
$ bin/hadoop distcp-overwrite Hdfs://123.123.23.111:9000/hsd/t_url Hdfs://123.123.23.156:9000/data/t_url
Under normal circumstances, the following results should appear:
Java HotSpot(TM) 64-Bit Server VM warning: Insufficient space for shared memory file:
/tmp/hsperfdata_hugetable/16744
Try using the -Djava.io.tmpdir= option to select an alternate temp location.
15/04/29 20:35:07 INFO tools.DistCp: Input Options: DistCpOptions{atomicCommit=false, syncFolder=false, deleteMissing=false, ignoreFailures=false, maxMaps=20, sslConfigurationFile='null', copyStrategy='uniformsize', sourceFileListing=null, sourcePaths=[hdfs://192.168.34.135:9000/zyx/t_url], targetPath=hdfs://192.168.34.156:9000/data/t_url, targetPathExists=false, preserveRawXattrs=false}
15/04/29 20:35:07 INFO client.RMProxy: Connecting to ResourceManager at compute-23-06.local/192.168.34.135:8032
15/04/29 20:35:08 INFO Configuration.deprecation: io.sort.mb is deprecated. Instead, use mapreduce.task.io.sort.mb
15/04/29 20:35:08 INFO Configuration.deprecation: io.sort.factor is deprecated. Instead, use mapreduce.task.io.sort.factor
15/04/29 20:35:08 WARN conf.Configuration: bad conf file: element not <property>
15/04/29 20:35:08 WARN conf.Configuration: bad conf file: element not <property>
15/04/29 20:35:08 INFO client.RMProxy: Connecting to ResourceManager at compute-23-06.local/192.168.34.135:8032
15/04/29 20:35:09 INFO mapreduce.JobSubmitter: number of splits:21
15/04/29 20:35:10 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_1429262156603_0032
15/04/29 20:35:10 INFO impl.YarnClientImpl: Submitted application application_1429262156603_0032
15/04/29 20:35:10 INFO mapreduce.Job: The url to track the job: http://compute-23-06.local:8088/proxy/application_1429262156603_0032/
15/04/29 20:35:10 INFO tools.DistCp: DistCp job-id: job_1429262156603_0032
15/04/29 20:35:10 INFO mapreduce.Job: Running job: job_1429262156603_0032
15/04/29 20:35:21 INFO mapreduce.Job: Job job_1429262156603_0032 running in uber mode : false
15/04/29 20:35:21 INFO mapreduce.Job: map 0% reduce 0%
15/04/29 20:35:32 INFO mapreduce.Job: map 10% reduce 0%
15/04/29 20:35:33 INFO mapreduce.Job: map 18% reduce 0%
15/04/29 20:35:34 INFO mapreduce.Job: map 25% reduce 0%
……
But I have a permission denied error in the process of running, as follows:
Error: java.io.IOException: File copy failed: hdfs://192.168.34.135:9000/zyx/t_url/000031_0 --> hdfs://192.168.34.156:9000/data/000031_0
at org.apache.hadoop.tools.mapred.CopyMapper.copyFileWithRetry(CopyMapper.java:284)
at org.apache.hadoop.tools.mapred.CopyMapper.map(CopyMapper.java:252)
at org.apache.hadoop.tools.mapred.CopyMapper.map(CopyMapper.java:50)
at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:145)
at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:784)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341)
at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:168)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:415)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1642)
at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:163)
Caused by: java.io.IOException: Couldn't run retriable-command: Copying hdfs://192.168.34.135:9000/zyx/t_url/000031_0 to hdfs://192.168.34.156:9000/data/000031_0
at org.apache.hadoop.tools.util.RetriableCommand.execute(RetriableCommand.java:101)
at org.apache.hadoop.tools.mapred.CopyMapper.copyFileWithRetry(CopyMapper.java:280)
... 10 more
Caused by: org.apache.hadoop.security.AccessControlException: Permission denied: user=hugetable, access=WRITE, inode="/data":root:supergroup:drwxr-xr-x
at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.checkFsPermission(FSPermissionChecker.java:271)
at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.check(FSPermissionChecker.java:257)
at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.check(FSPermissionChecker.java:238)
at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.checkPermission(FSPermissionChecker.java:179)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.checkPermission(FSNamesystem.java:5584)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.checkPermission(FSNamesystem.java:5566)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.checkAncestorAccess(FSNamesystem.java:5540)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.startFileInternal(FSNamesystem.java:2282)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.startFileInt(FSNamesystem.java:2235)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.startFile(FSNamesystem.java:2188)
at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.create(NameNodeRpcServer.java:505)
at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.create(ClientNamenodeProtocolServerSideTranslatorPB.java:354)
at org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos$ClientNamenodeProtocol$2.callBlockingMethod(ClientNamenodeProtocolProtos.java)
at org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine.java:585)
at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:1026)
From the command can be clearly seen, is insufficient authority, "Supergroup:drwxr-x-r-x", through the Hadoop fs-ls/To view, visible for other users outside the group does not have write permission (the last 3 of the drwxr-xr-x is the other user rights outside the group, Currently only R:read and x:executable two permissions). Visible users do not have write access to the HDFs file.
Permissions can be modified through chmod:
Specific as follows:
$ hadoop fs -chmod 777 /lgh
$ hadoop fs -chmod 777 /data
The above code gives the HDFs file/lgh and/data two folders 777 permissions (777 permissions are all permissions for all users), running out of Hadoop FS/visible permissions have all been given up.
Full text, reproduced please specify the source: http://blog.csdn.net/ghuil/article/details/45372469
Permission denied error occurred with Hadoop distcp command