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()

必须使用文件头                 

相关文章:

  • 2021-04-05
  • 2022-02-27
  • 2022-01-06
  • 2022-12-23
  • 2021-12-24
  • 2021-11-30
  • 2022-02-07
  • 2021-09-13
猜你喜欢
  • 2021-09-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-23
  • 2022-12-23
  • 2022-01-21
相关资源
相似解决方案