我想以编程方式将作业输出从 EMR 集群复制到 Amazon S3。
如何在 java 代码中使用 S3DistCp
来做同样的事情。
最佳答案
hadoop ToolRunner
可以运行这个.. 因为 S3DistCP extends Tool
下面是使用示例:
import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.util.ToolRunner; import com.amazon.external.elasticmapreduce.s3distcp.S3DistCp public class CustomS3DistCP{ private static final Log log = LogFactory.getLog(CustomS3DistCP.class); public static void main(String[] args) throws Exception { log.info("Running with args: " + args); System.exit(ToolRunner.run(new S3DistCp(), args)); }
你的类路径中必须有 s3distcp jar 您可以从 shell 脚本调用此程序。
希望对您有所帮助!
关于java - 如何在java代码中使用S3DistCp,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18124845/