2016年5月5日 星期四

[Hadoop2.7.1] Wordcount


hadoop fs -mkdir -p /opt/hadoop-2.7.1/input

hadoop fs -copyFromLocal /opt/hadoop-2.7.1/text/text34mb.txt /opt/hadoop-2.7.1/input

hadoop jar /opt/hadoop-2.7.1/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.1.jar wordcount /opt/hadoop-2.7.1/input/text34mb.txt /opt/hadoop-2.7.1/output




[hadoop@master01 lib]$ hadoop jar /opt/hadoop-2.7.1/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.1.jar wordcount /opt/hadoop-2.7.1/input/text34mb.txt /opt/hadoop-2.7.1/output
16/05/05 16:30:43 INFO client.RMProxy: Connecting to ResourceManager at /0.0.0.0:8032
16/05/05 16:30:43 INFO input.FileInputFormat: Total input paths to process : 1
16/05/05 16:30:44 INFO mapreduce.JobSubmitter: number of splits:1
16/05/05 16:30:44 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_1462429858916_0001
16/05/05 16:30:45 INFO impl.YarnClientImpl: Submitted application application_1462429858916_0001
16/05/05 16:30:45 INFO mapreduce.Job: The url to track the job: http://master01:8088/proxy/application_1462429858916_0001/
16/05/05 16:30:45 INFO mapreduce.Job: Running job: job_1462429858916_0001
16/05/05 16:30:53 INFO mapreduce.Job: Job job_1462429858916_0001 running in uber mode : false
16/05/05 16:30:53 INFO mapreduce.Job:  map 0% reduce 0%
16/05/05 16:31:04 INFO mapreduce.Job:  map 42% reduce 0%
16/05/05 16:31:09 INFO mapreduce.Job:  map 67% reduce 0%
16/05/05 16:31:11 INFO mapreduce.Job:  map 100% reduce 0%
16/05/05 16:31:19 INFO mapreduce.Job:  map 100% reduce 100%
16/05/05 16:31:19 INFO mapreduce.Job: Job job_1462429858916_0001 completed successfully
16/05/05 16:31:19 INFO mapreduce.Job: Counters: 49
    File System Counters
        FILE: Number of bytes read=9917184
        FILE: Number of bytes written=15106616
        FILE: Number of read operations=0
        FILE: Number of large read operations=0
        FILE: Number of write operations=0
        HDFS: Number of bytes read=35926297
        HDFS: Number of bytes written=3103134
        HDFS: Number of read operations=6
        HDFS: Number of large read operations=0
        HDFS: Number of write operations=2
    Job Counters
        Launched map tasks=1
        Launched reduce tasks=1
        Data-local map tasks=1
        Total time spent by all maps in occupied slots (ms)=15003
        Total time spent by all reduces in occupied slots (ms)=4504
        Total time spent by all map tasks (ms)=15003
        Total time spent by all reduce tasks (ms)=4504
        Total vcore-seconds taken by all map tasks=15003
        Total vcore-seconds taken by all reduce tasks=4504
        Total megabyte-seconds taken by all map tasks=15363072
        Total megabyte-seconds taken by all reduce tasks=4612096
    Map-Reduce Framework
        Map input records=788346
        Map output records=6185757
        Map output bytes=59289268
        Map output materialized bytes=4958589
        Input split bytes=121
        Combine input records=6185757
        Combine output records=328274
        Reduce input groups=272380
        Reduce shuffle bytes=4958589
        Reduce input records=328274
        Reduce output records=272380
        Spilled Records=984822
        Shuffled Maps =1
        Failed Shuffles=0
        Merged Map outputs=1
        GC time elapsed (ms)=209
        CPU time spent (ms)=11810
        Physical memory (bytes) snapshot=327483392
        Virtual memory (bytes) snapshot=4164567040
        Total committed heap usage (bytes)=219676672
    Shuffle Errors
        BAD_ID=0
        CONNECTION=0
        IO_ERROR=0
        WRONG_LENGTH=0
        WRONG_MAP=0
        WRONG_REDUCE=0
    File Input Format Counters
        Bytes Read=35926176
    File Output Format Counters
        Bytes Written=3103134



---------------------------------------------------------------------------------------

Delete the file
hdfs dfs -rm -r /opt/hadoop-2.7.1/output

---------------------------------------------------------------------------------------
[hadoop@master01 lib]$ ls /opt/hadoop-2.7.1/share/hadoop/mapreduce/
hadoop-mapreduce-client-app-2.7.1.jar
hadoop-mapreduce-client-common-2.7.1.jar
hadoop-mapreduce-client-core-2.7.1.jar
hadoop-mapreduce-client-hs-2.7.1.jar
hadoop-mapreduce-client-hs-plugins-2.7.1.jar
hadoop-mapreduce-client-jobclient-2.7.1.jar
hadoop-mapreduce-client-jobclient-2.7.1-tests.jar
hadoop-mapreduce-client-shuffle-2.7.1.jar
hadoop-mapreduce-examples-2.7.1.jar
lib
lib-examples
sources
---------------------------------------------------------------------------------------


Reference
http://kurthung1224.pixnet.net/blog/post/175503049
https://hadoop.apache.org/docs/current/hadoop-mapreduce-client/hadoop-mapreduce-client-core/MapReduceTutorial.html#Example:_WordCount_v1.0

沒有留言: