如何在Java代码中使用S3DistCp
作者:互联网
我想以语法方式将作业的输出从EMR集群复制到Amazon S3.
如何在Java代码中使用S3DistCp进行相同操作.
解决方法:
hadoop ToolRunner可以运行此程序..由于S3DistCP扩展了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脚本调用此程序.
希望有帮助!
标签:amazon-emr,hadoop,amazon-s3,java 来源: https://codeday.me/bug/20191122/2063614.html