Changes between Initial Version and Version 1 of TCCA140822/Lab8


Ignore:
Timestamp:
Aug 23, 2014, 12:11:20 AM (10 years ago)
Author:
jazz
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TCCA140822/Lab8

    v1 v1  
     1[[PageOutline]]
     2
     3◢ <[wiki:TCCA140822/Lab7 實作七]> | <[wiki:TCCA140822 回課程大綱]> ▲ | <[wiki:TCCA140822/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.3du.me 操作。底下的 userXX 等於您的用戶名稱。
     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-----