hadoop 执行python 注意的地方

1,命令行

bin/hadoop jar contrib/streaming/hadoop-streaming-1.0.4.jar -input input -output output11 -mapper 'teststd.py 10' -file /home/hadoop/teststd.py -jobconf mapred.reduce.tasks=1

/home/hadoop/teststd.py , 文件的目录,文件的权限为可读可写

2, 文件的内容
#!/usr/bin/python
import sys, random

for line in sys.stdin:
    if random.randint(1,100) <= int(sys.argv[1]):
        print line.strip()

必须使用文件头                 

原文地址:https://www.cnblogs.com/csharponworking/p/2882188.html