如何在java代码中使用S3DistCp

问题描述 投票:3回答:1

我想以编程方式将作业的输出从EMR集群复制到Amazon S3。

如何在java代码中使用S3DistCp来做同样的事情。

java hadoop amazon-s3 amazon-emr
1个回答
3
投票

hadoop ToolRunner can run this.. since 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脚本调用这个程序。

希望有所帮助!

© www.soinside.com 2019 - 2024. All rights reserved.