【问题标题】:How to set number of reducers based on input size如何根据输入大小设置减速器的数量
【发布时间】:2013-10-09 10:46:50
【问题描述】:

如何根据我的 mapreduce 作业的输入大小设置减速器数量。 我知道它在蜂巢和猪身上

hive.exec.reducers.bytes.per.reducer
pig.exec.reducers.bytes.per.reducer

我想在我的 Map-Reduce 工作中做类似的工作,请帮助我

【问题讨论】:

    标签: hadoop mapreduce hive apache-pig


    【解决方案1】:

    我想到的一件事是在提交作业之前分析输入并根据输入大小设置减速器数量。

    例如,如果您使用的是 HDFS 输入源,则有一个名为 getContentSummary (http://hadoop.apache.org/docs/current/api/org/apache/hadoop/fs/FileSystem.html#getContentSummary(org.apache.hadoop.fs.Path)) 的方法可以返回输入大小。

    之后,您可以使用该信息来计算减速器的数量。 (满足您需求的一些逻辑)然后使用 setNumReduceTasks 设置该数字。

    对于其他数据源,您应该使用类似的方法。

    【讨论】:

    • 那么 FileSystemOBJ.getContentSummary(Path filePath).getLength() 会做我的工作吗?
    • 你应该使用 getSpaceConsumed() 方法来获取文件的实际大小。
    猜你喜欢
    • 2014-09-10
    • 2016-04-27
    • 1970-01-01
    • 2015-05-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多