Hadoop 流 - 意想不到的争论

Hadoop streaming - unexpected argument

我试图在 cloudera hadoop 上执行下面的命令,但它遇到了问题,我收到了错误消息。
不知道是bug还是我做错了什么。
任何信息将不胜感激。

 hadoop jar /usr/lib/hadoop-mapreduce/hadoop-streaming.jar -files /home/cloudera/mapper.py /home/cloudera/reducer.py -mapper "python mapper.py" -reducer "python reducer.py" -input /user/cloudera/test_file -output /user/cloudera/wc_output01

错误信息:

Found 1 unexpected arguments on the command line [/home/cloudera/reducer.py]
Try -help for more information Streaming Command Failed!

解决了这个问题。我使用了 -files 这会产生问题。早些时候我使用了 -file 但控制台给出了警告 'deprecated, use -files as generic option'。但这并没有解决问题,所以我又回到了 -file 选项,它 运行 给出了同样的警告。

您可以通过 reading the documentation

深入了解错误

The -files and -archives options are generic options. Be sure to place the generic options before the command options, otherwise the command will fail.

你正确地放置了参数,所以这不是问题

Multiple entries can be specified like this:

-files hdfs://host:fs_port/user/testfile1.txt,hdfs://host:fs_port/user/testfile2.txt

mapper 和 reducer 文件之间没有逗号


如果文件是可执行的并且以 #!/usr/bin/env python

开头,您可以只传递 mapper.py