You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Hadoop Streaming中使用NLineInputFormat如何指定参数N?

在Hadoop Streaming中使用NLineInputFormat指定参数N的方法

要指定NLineInputFormat里每个Map任务处理的行数N,只需添加一条-D配置参数即可,参数名为mapred.line.input.format.linespermap,其值就是你需要设置的N。

修改后的完整执行命令如下:

hadoop jar /home/Software/hadoop/share/hadoop/tools/lib/hadoop-streaming-2.6.0.jar \
-D stream.non.zero.exit.is.failure=false \
-D mapred.map.tasks=2 \
-D mapred.reduce.tasks=1 \
-D mapred.line.input.format.linespermap=5 \  # 将5替换为你实际需要的N值
-files /home/hello.py \
-input /hello.txt \
-output /result \
-mapper "/home/.conda/envs/perimeter-pytorch2/bin/python hello.py" \
-inputformat org.apache.hadoop.mapred.lib.NLineInputFormat

mapred.line.input.format.linespermap的作用就是定义每个Map任务分配到的输入行数,你可以根据业务需求调整具体数值。

内容的提问来源于stack exchange,提问作者Perimeter Chou

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.20 21:12:01