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
相关产品推荐
相关产品推荐

