Version 7 (modified by waue, 16 years ago) (diff) |
---|
實做六
$ cd /opt/hadoop $ bin/hadoop dfs -mkdir input $ echo "I like NCHC Cloud Course." > input1 $ echo "I like nchc Cloud Course, and we enjoy this crouse." > input2 $ bin/hadoop dfs -put input1 input $ bin/hadoop dfs -put input2 input $ bin/hadoop dfs -ls input
$ mkdir MyJava $ javac -classpath hadoop-*-core.jar -d MyJava WordCount.java $ jar -cvf wordcount.jar -C MyJava . $ bin/hadoop jar wordcount.jar WordCount input/ output/ $ dfs -cat output/part-00000
$ echo "\." >pattern.txt && echo "\," >>pattern.txt $ bin/hadoop dfs -put pattern.txt ./ $ mkdir MyJava2
$ javac -classpath hadoop-*-core.jar -d MyJava2 WordCount2.java $ jar -cvf wordcount2.jar -C MyJava2 . $ bin/hadoop jar wordcount2.jar WordCount2 input output2 -skip pattern.txt $ dfs -cat output2/part-00000 $ bin/hadoop jar wordcount2.jar WordCount2 -Dwordcount.case.sensitive=false input output3 -skip pattern.txt $ dfs -cat output3/part-00000
Attachments (2)
- WordCount.java (1.8 KB) - added by waue 16 years ago.
- WordCount2.java (4.2 KB) - added by waue 16 years ago.
Download all attachments as: .zip