在 Java 中尝试从 HDFS 复制 FromLocalFile 时出现“错误的 FS……预期:file:///”
“Wrong FS… expected: file:///” when trying to copyFromLocalFile from HDFS in Java
我正在尝试将 abc.json 从 port/example_File/2017 复制到另一个位置 /port/example_File/2018 在 HDFS 中,
通过下面的代码
String exampleFile= "hdfs://port/example_File/2017/abc.json"
String targetFile="hdfs://port/example_File/2018"
hdfs.copyFromLocalFile(new Path(exampleFile),new Path(targetFile))
我低于异常
org.jboss.resteasy.spi.UnhandledException:
java.lang.IllegalArgumentException: Wrong FS:
hdfs://port/example_File/2017/abc.json, expected: file:///
如何在 HDFS 中将文件从一个位置复制到另一个位置
谢谢,
copyFromLocal
是将文件从Local Filesystem复制到HDFS。
要在 HDFS 集群中复制文件,请使用 FileUtil.copy()
并为 srcFS
和 dstFs
指定相同的文件系统。
使用DistCp
when copying large number of files within a HDFS cluster or between two different HDFS clusters. Refer DistCp Java API here.
我正在尝试将 abc.json 从 port/example_File/2017 复制到另一个位置 /port/example_File/2018 在 HDFS 中, 通过下面的代码
String exampleFile= "hdfs://port/example_File/2017/abc.json"
String targetFile="hdfs://port/example_File/2018"
hdfs.copyFromLocalFile(new Path(exampleFile),new Path(targetFile))
我低于异常
org.jboss.resteasy.spi.UnhandledException:
java.lang.IllegalArgumentException: Wrong FS:
hdfs://port/example_File/2017/abc.json, expected: file:///
如何在 HDFS 中将文件从一个位置复制到另一个位置
谢谢,
copyFromLocal
是将文件从Local Filesystem复制到HDFS。
要在 HDFS 集群中复制文件,请使用 FileUtil.copy()
并为 srcFS
和 dstFs
指定相同的文件系统。
使用DistCp
when copying large number of files within a HDFS cluster or between two different HDFS clusters. Refer DistCp Java API here.