Changes between Version 3 and Version 4 of III120825/Lab8


Ignore:
Timestamp:
Aug 26, 2012, 2:00:52 PM (12 years ago)
Author:
jazz
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • III120825/Lab8

    v3 v4  
    3939{{{
    4040$ mkdir MyJava
    41 $ ln -s /usr/lib/hadoop/hadoop-*-core.jar hadoop-core.jar
     41$ ln -s /opt/hadoop/hadoop-*-core.jar hadoop-core.jar
    4242$ javac -classpath hadoop-core.jar -d MyJava WordCount.java
    4343$ jar -cvf wordcount.jar -C MyJava .
     
    6363}}}
    6464-----
    65 
    66 = Practice 2 : Word Count (Advanced) =
    67 
    68 {{{
    69 $ echo "\." >pattern.txt && echo "\," >>pattern.txt
    70 $ hadoop fs -put pattern.txt .
    71 $ mkdir -p MyJava2
    72 }}}
    73 
    74 
    75  * 下載 [http://hadoop.nchc.org.tw/WordCount2.java WordCount2.java] 並存到家目錄;[[BR]]Download [http://hadoop.nchc.org.tw/WordCount2.java WordCount2.java] to home directory
    76 {{{
    77 ~$ wget http://hadoop.nchc.org.tw/WordCount2.java
    78 }}}
    79 
    80 {{{
    81 $ javac -classpath hadoop-core.jar -d MyJava2 WordCount2.java
    82 $ jar -cvf wordcount2.jar -C MyJava2 .
    83 $ hadoop jar wordcount2.jar WordCount2 lab8_input lab8_out2 -skip pattern.txt
    84 $ hadoop fs -cat lab8_out2/part-00000
    85 }}}
    86 
    87  * lab8_out2 執行結果[[BR]]You should see results like this:
    88 {{{
    89 #!text
    90 Cloud   2
    91 Course  2
    92 I       2
    93 NCTU    1
    94 and     1
    95 course  1
    96 enjoy   1
    97 like    2
    98 nctu    1
    99 this    1
    100 we      1
    101 }}}
    102 
    103  * Let's given case insensitive and ignore pattern for this example
    104 {{{
    105 $ hadoop jar wordcount2.jar WordCount2 -Dwordcount.case.sensitive=false lab8_input lab8_out3 -skip pattern.txt
    106 $ hadoop fs -cat lab8_out3/part-00000
    107 }}}
    108 
    109  * lab8_out3 執行結果[[BR]]You should see results like this:
    110 {{{
    111 #!text
    112 and     1
    113 cloud   2
    114 course  3
    115 enjoy   1
    116 i       2
    117 like    2
    118 nctu    2
    119 this    1
    120 we      1
    121 }}}