1

我在 AWS 服务器上运行 WordCount 示例。我想测试我的输出并分析它们。我想增加编号。映射器和没有。减速器,也没有。块。

我怎样才能达到同样的效果?

我必须设置否。创建工作时映射器/减速器的数量?或者我必须添加一些代码?我正在使用java。

4

1 回答 1

0

您可以在 Java 程序的 main 函数中设置映射器和缩减器的数量,该程序分别使用 JobConfconf.setNumMapTasks(int num)和启动 MapReduce 作业。conf.setNumRedTasks(int num)

对于映射器,请注意api 中的以下内容:

"This is only a hint to the framework. The actual number of spawned map tasks depends on the number of InputSplits generated by the job's InputFormat.getSplits(JobConf, int). A custom InputFormat is typically used to accurately control the number of map tasks for the job."

显式设置输入块的数量有点困难。输入的拆分方式取决于InputFormat您使用的方式和InputSplits它使用的对应方式。如果您希望操纵输入的拆分方式,则必须制作自己的自定义 InputFormat/InputSplits。

于 2012-10-05T17:32:27.517 回答