java在hadoop上运行word count

bybem2ql  于 2021-06-03  发布在  Hadoop
关注(0)|答案(1)|浏览(473)

我的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
q43xntqr

q43xntqr1#

您需要使用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配置为本地模式(因为路径是local path:/home/hduser)

相关问题