distcp: copy file from hdfs to s3 (How to use in scala or java)

distcp: copy file from hdfs to s3 (How to use in scala or java)

我正在尝试通过以下代码通过 distcp 将大文件从 hdfs 复制到 s3:

val files:Array[String] = new Array[String](2)
files(0) = "/****/in.zip"

val in =  new Path(new URI("/**/in.zip"))
val out = new Path(new URI("***/out.zip"))
var distcpOpt = new DistCpOptions(in,out)
ToolRunner.run(new DistCp(new Configuration(),distcpOpt), files)

我尝试做类似 this link 的事情。

以前有人做过这个,请帮忙。

我找到了解决方案:

1- files 数组应该有两个值:第一个用于输入,第二个用于输出。

2- distcpOpt 不需要有任何值(空字符串就够了)

3- 确保来自 s3 路径