Hadoop集群下跑.py文件(入门wordcount)

hadoop jar /export/servers/hadoop-2.7.4/share/hadoop/tools/lib/hadoop-streaming-2.7.4.jar -D stream.non.zero.exit.is.failure=false \
-file /export/servers/hadoop-2.7.4/test/code/mapper.py \
-mapper /export/servers/hadoop-2.7.4/test/code/mapper.py \
-file /export/servers/hadoop-2.7.4/test/code/reduce.py \
-reducer /export/servers/hadoop-2.7.4/test/code/reduce.py \
-input /user/root/hdfs_in/wordcount.txt \
-output /user/root/hdfs_out12

需要注意的点:

  • -D参数必须加(https://blog.csdn.net/CSNDRYL/article/details/77752010)
  • python文件要注意,尽量在Linux环境下编
  • 用vim打开该sh文件,输入:
    :set ff
    回车,显示fileformat=dos,重新设置下文件格式:
    :set ff=unix
    保存退出

你可能感兴趣的:(数据分析)