使用 API 在 Hadoop 中移动文件

Moving Files in Hadoop using API

是否可以使用 FileSystem class https://hadoop.apache.org/docs/r2.7.1/api/index.html?org/apache/hadoop/fs/FileSystem.html 或类似的方法在 hadoop 中移动文件?

是的,这是可能的。

对于比 hadoop fs -cp 更快的 MapReduce 副本,请查看 DistCp source code

或者如果您真的想移动文件 hadoop fs -mv source code。注意:"move"在HDFS中实际上是一个"rename"。

FileSystem#rename就是你想要的。