wiki:jazz/Hadoop_Lab6

Version 2 (modified by waue, 16 years ago) (diff)

--

實做六

cd $HADOOP_HOME
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
  • 編輯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/ output/
    dfs -cat output/part-00000
    

echo "\." >pattern.txt && echo "\," >>pattern.txt
bin/hadoop dfs -put pattern.txt ./
mkdir MyJava2
  • 編輯WordCount2.java
    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)

Download all attachments as: .zip