我想用以下命令编译hadoop示例,但出现了一个错误:
$ mkdir wordcount_classes
$ javac -classpath ${HADOOP_HOME}/hadoop-${HADOOP_VERSION}-core.jar -d wordcount_classes WordCount.java
$ jar -cvf /usr/joe/wordcount.jar -C wordcount_classes/ .
Assuming that:
/usr/joe/wordcount/input - input directory in HDFS
/usr/joe/wordcount/output - output directory in HDFS
Sample text-files as input:
$ bin/hadoop dfs -ls /usr/joe/wordcount/input/
/usr/joe/wordcount/input/file01
/usr/joe/wordcount/input/file02
$ bin/hadoop dfs -cat /usr/joe/wordcount/input/file01
Hello World Bye World
$ bin/hadoop dfs -cat /usr/joe/wordcount/input/file02
Hello Hadoop Goodbye Hadoop
1条答案
按热度按时间ymzxtsji1#
/usr/joe
是本地的,正如您在执行ls
命令在第一行。第二个命令需要hdfs位置的输入和输出,但是/usr/joe
hdfs上不存在。您需要将数据移动到hdfs上,然后执行命令。例如: