HadoopStreaming常用引數簡單說明

2021-09-12 09:30:47 字數 962 閱讀 2634

1 、基本開發引數

-input"$" \        輸入路徑,指的是hdfs上的路徑

-output"$" \       輸出路徑,指的也是hdfs上的路徑

-reducer"python  red.py" \        執行reduce過程的**的執行引數

-file"map.py" \                    需要分發的檔案(將上述map、reduce的**檔案分發到hdfs上)

2、優化引數(加粗部分還會在其他博文中進行詳細解釋)

-d stream.map.output.field.separator :設定map輸出中key和value的分隔符

-d stream.num.map.output.key.fields :  設定map程式分隔符的位置,該位置之前的部分作為key,之後的部分作為value

(該引數個人認為是非常有用且使用頻率非常高,會根據這個引數決定的key而進行分割槽。map的排序以及reduce的歸併排序都和它息息相關)

-d map.output.key.field.separator : 設定map輸出中key內部的分割符

-dnum.key.fields.for.partition : 指定分桶時,key按照分隔符切割後,其中用於分桶key所佔的列數(配合-partitionerorg.apache.hadoop.mapred.lib.keyfieldbasedpartitioner 使用)

-dstream.reduce.output.field.separator:設定reduce輸出中key和value的分隔符

-d stream.num.reduce.output.key.fields:設定reduce程式分隔符的位置

-d mapred.job.name=$ \ #

任務名-d mapred.map.tasks=$ \ # map

個數

hadoop streaming記憶體超限解決方案

解決方案 1.提高記憶體上限 增加配置,將上限調高到8000m,這樣就解決了,如下 d stream.memory.limit 8000 2.將讀入詞表的操作轉到reducer階段完成 這樣需要點思路轉換,我需要對比的key是地理位置,詞表的key也是地理位置,可以在reducer階段將它們歸併起來...

Hadoop Streaming框架使用(二)

提交hadoop任務示例 hadoop home bin hadoop streaming input user test input output user test output file file home work myreducer.sh jobconf mapred.job.name f...

Hadoop Streaming框架使用(二)

提交hadoop任務示例 hadoop home bin hadoop streaming input user test input output user test output file home work myreducer.sh jobconf mapred.job.name file d...