Changes between Initial Version and Version 1 of III130907/Lab8


Ignore:
Timestamp:
Sep 8, 2013, 8:32:58 AM (11 years ago)
Author:
jazz
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • III130907/Lab8

    v1 v1  
     1[[PageOutline]]
     2
     3◢ <[wiki:III130907/Lab7 實作七]> | <[wiki:III130907 回課程大綱]> ▲ | <[wiki:III130907/Lab9 實作九]> ◣
     4
     5= 實作八 Lab 8 =
     6
     7{{{
     8#!html
     9<div style="text-align: center;"><big style="font-weight: bold;"><big>在完全分散模式下編譯 MapReduce 程式<br/>Compiling Hadoop MapReduce Java Program in Hadoop Cluster</big></big></div>
     10}}}
     11
     12{{{
     13#!text
     14以下練習,請連線至 hadoop.nchc.org.tw 操作。底下的 hXXXX 等於您的用戶名稱。
     15}}}
     16
     17= Practice 1 : Word Count (Basic) =
     18
     19 * 上傳內容到 HDFS 內[[BR]]upload data to HDFS
     20{{{
     21$ mkdir lab8_input
     22$ echo "I like NCTU Cloud Course." > lab8_input/input1
     23$ echo "I like nctu Cloud Course, and we enjoy this course." > lab8_input/input2
     24$ hadoop fs -put lab8_input lab8_input
     25$ hadoop fs -ls lab8_input
     26Found 2 items
     27-rw-r--r--   2 hXXXX supergroup         26 2011-04-19 10:07 /user/hXXXX/lab8_input/input1
     28-rw-r--r--   2 hXXXX supergroup         52 2011-04-19 10:07 /user/hXXXX/lab8_input/input2
     29}}}
     30
     31 * 下載 [http://www.classcloud.org/hadoop4win/WordCount.java WordCount.java] 並存到家目錄;[[BR]]Download [http://www.classcloud.org/hadoop4win/WordCount.java WordCount.java] and save to your home directory
     32{{{
     33~$ wget http://www.classcloud.org/hadoop4win/WordCount.java
     34}}}
     35
     36 * 運作程式[[BR]]Compile WordCount.java and run it by '''hadoop jar''' command
     37
     38{{{
     39$ mkdir MyJava
     40$ ln -s /opt/hadoop/hadoop-*-core.jar hadoop-core.jar
     41$ javac -classpath hadoop-core.jar -d MyJava WordCount.java
     42$ jar -cvf wordcount.jar -C MyJava .
     43$ hadoop jar wordcount.jar WordCount lab8_input/ lab8_out1/
     44$ hadoop fs -cat lab8_out1/part-00000
     45}}}
     46
     47 * lab8_out1 執行結果 [[BR]]You should see results like this :
     48{{{
     49#!text
     50Cloud   2
     51Course, 1
     52Course. 1
     53I       2
     54NCTU    1
     55and     1
     56course. 1
     57enjoy   1
     58like    2
     59nctu    1
     60this    1
     61we      1
     62}}}
     63-----