Version 6 (modified by waue, 13 years ago) (diff) |
---|
用指令編譯 Hadoop 程式碼
WordCount1 練習
$ cd /opt/hadoop $ mkdir -p input_local $ bin/hadoop fs -mkdir input_hdfs $ echo "I like NCHC Cloud Course." > input_local/input1 $ echo "I like nchc Cloud Course, and we enjoy this course." > input_local/input2 $ bin/hadoop fs -put input_local/* input_hdfs $ bin/hadoop fs -ls input_hdfs $ wget http://trac.nchc.org.tw/cloud/raw-attachment/wiki/jazz/Hadoop_Lab6/WordCount.java $ mkdir MyJava $ javac -classpath hadoop-*-core.jar -d MyJava WordCount.java $ jar -cvf wordcount.jar -C MyJava . $ bin/hadoop jar wordcount.jar WordCount input_hdfs/ output_hdfs/ $ bin/hadoop fs -cat output_hdfs/part-00000