[[PageOutline]]
◢ <[wiki:III130126/Lab4 實作四]> | <[wiki:III130126 回課程大綱]> ▲ | <[wiki:III130126/Lab6 實作六]> ◣
= 實作五 Lab 5 =
{{{
#!html
在單機模式執行 MapReduce 基本運算
Running MapReduce in local mode by Examples
}}}
{{{
#!text
以下練習,請在本機的 Hadoop4Win 環境操作。
}}}
== 範例一『字數統計(WordCount)』 ==
* STEP 1 : 練習 MapReduce 丟 Job 指令: 『__'''hadoop jar '''__』
{{{
Jazz@human ~
$ cd /opt/hadoop/
Jazz@human /opt/hadoop
$ hadoop jar hadoop-*-examples.jar wordcount input output
11/10/21 14:08:58 INFO input.FileInputFormat: Total input paths to process : 12
11/10/21 14:09:00 INFO mapred.JobClient: Running job: job_201110211130_0001
11/10/21 14:09:01 INFO mapred.JobClient: map 0% reduce 0%
11/10/21 14:09:31 INFO mapred.JobClient: map 16% reduce 0%
11/10/21 14:10:29 INFO mapred.JobClient: map 100% reduce 27%
11/10/21 14:10:33 INFO mapred.JobClient: map 100% reduce 100%
11/10/21 14:10:35 INFO mapred.JobClient: Job complete: job_201110211130_0001
11/10/21 14:10:35 INFO mapred.JobClient: Counters: 17
11/10/21 14:10:35 INFO mapred.JobClient: Job Counters
11/10/21 14:10:35 INFO mapred.JobClient: Launched reduce tasks=1
11/10/21 14:10:35 INFO mapred.JobClient: Launched map tasks=12
11/10/21 14:10:35 INFO mapred.JobClient: Data-local map tasks=12
11/10/21 14:10:35 INFO mapred.JobClient: FileSystemCounters
11/10/21 14:10:35 INFO mapred.JobClient: FILE_BYTES_READ=16578
11/10/21 14:10:35 INFO mapred.JobClient: HDFS_BYTES_READ=18312
11/10/21 14:10:35 INFO mapred.JobClient: FILE_BYTES_WRITTEN=32636
11/10/21 14:10:35 INFO mapred.JobClient: HDFS_BYTES_WRITTEN=10922
11/10/21 14:10:35 INFO mapred.JobClient: Map-Reduce Framework
11/10/21 14:10:35 INFO mapred.JobClient: Reduce input groups=592
11/10/21 14:10:35 INFO mapred.JobClient: Combine output records=750
11/10/21 14:10:35 INFO mapred.JobClient: Map input records=553
11/10/21 14:10:35 INFO mapred.JobClient: Reduce shuffle bytes=15674
11/10/21 14:10:35 INFO mapred.JobClient: Reduce output records=592
11/10/21 14:10:35 INFO mapred.JobClient: Spilled Records=1500
11/10/21 14:10:35 INFO mapred.JobClient: Map output bytes=24438
11/10/21 14:10:35 INFO mapred.JobClient: Combine input records=1755
11/10/21 14:10:35 INFO mapred.JobClient: Map output records=1755
11/10/21 14:10:35 INFO mapred.JobClient: Reduce input records=750
}}}
* [[BR]][[Image(Hadoop4Win:hadoop4win_14.jpg,width=600)]]
* STEP 2 : 練習從 http://localhost:50030 查看目前 MapReduce Job 的運作情形
* [[BR]][[Image(Hadoop4Win:hadoop4win_15.jpg,width=600)]]
* STEP 3 : 使用 HDFS 指令: 『__'''hadoop fs -get '''__』,並了解輸出檔案檔名均為 part-r-*****,且執行參數會紀錄於 _