在hadoop上运行字数

时间:2013-07-17 06:11:24

标签: java hadoop

MY HADOOP在单节点上启动。 但是在运行字数统计时,它会显示以下错误。 可能是什么问题?

 hduser@reshmi-Inspiron-1545:~/hadoop-1.0.4$hadoop-examples-1.0.4.jar wordcount 
 /home/hduser/hadoop-1.0.4/dft /home/hduser/hadoop-1.0.4/dft-output 
 /home/hduser/hadoop-1.0.4/hadoop-examples-1.0.4.jar: line 1: $'PK\003\004':command not found
 /home/hduser/hadoop-1.0.4/hadoop-examples-1.0.4.jar: line 2: syntax error near unexpected token `)'
 /home/hduser/hadoop-1.0.4/hadoop-examples-1.0.4.jar: line 2: `)CA META-INF/��PK'
 hduser@reshmi-Inspiron-1545:~/hadoop-1.0.4$ ^C
 hduser@reshmi-Inspiron-1545:~/hadoop-1.0.4$ cd ..
 hduser@reshmi-Inspiron-1545:~$ /hadoop-1.0.4  hadoop-examples-1.0.4.jar wordcount 
 /home/hduser/hadoop-1.0.4/dft /home/hduser/hadoop-1.0.4/dft-output 
 bash: /hadoop-1.0.4: No such file or directory
 hduser@reshmi-Inspiron-1545:~$ ^C

1 个答案:

答案 0 :(得分:0)

你需要使用bin文件夹中的hadoop脚本和jar子命令来调用你的工作,试试这个:

hduser@reshmi-Inspiron-1545:~$ cd ~/hadoop-1.0.4
hduser@reshmi-Inspiron-1545:~/hadoop-1.0.4$ bin/hadoop jar hadoop-examples-1.0.4.jar \
       wordcount /home/hduser/hadoop-1.0.4/dft \
       /home/hduser/hadoop-1.0.4/dft-output

我还假设您的输入和输出路径已将hadoop配置为本地模式(因为路径是本地路径:/ home / hduser)