标签:
1[hadoop@hadoop02 ~]$ start-all.sh
2 [hadoop@hadoop02 ~]$ jps
2465 NameNode
2594 DataNode
3333 Jps
2759 SecondaryNameNode
3017 NodeManager
2909 ResourceManager
3 [hadoop@hadoop02 ~]$ cd file (注意 之前已存在file文件夹)
4 [hadoop@hadoop02 file]$ echo "dfadf adfadf adfas" > file1.txt
5. [hadoop@hadoop02 file]$ hadoop fs -put ~/file/file1.txt input1
16/08/14 05:35:24 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
put: Cannot create file/user/hadoop/input1._COPYING_. Name node is in safe mode.
6. [hadoop@hadoop02 app]$ cd app/hadoop-2.6.2
7. [hadoop@hadoop02 hadoop-2.6.2]$ bin/hadoop dfsadmin -safemode leave(关fafemode)
DEPRECATED: Use of this script to execute hdfs command is deprecated.
Instead use the hdfs command for it.
16/08/14 05:37:14 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Safe mode is OFF
8. [hadoop@hadoop02 hadoop-2.6.2]$ hadoop fs -put ~/file/file1.txt input1 (上传)
9. [hadoop@hadoop02 hadoop-2.6.2]$ hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.6.2.jar wordcount input1 output1 (执行)
执行过程
16/08/14 05:52:06 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
16/08/14 05:52:08 INFO client.RMProxy: Connecting to ResourceManager at hadoop02/192.168.174.133:8032
16/08/14 05:52:10 INFO input.FileInputFormat: Total input paths to process : 1
16/08/14 05:52:10 INFO mapreduce.JobSubmitter: number of splits:1
16/08/14 05:52:10 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_1471123767175_0001
16/08/14 05:52:11 INFO impl.YarnClientImpl: Submitted application application_1471123767175_0001
16/08/14 05:52:12 INFO mapreduce.Job: The url to track the job: http://hadoop02:8088/proxy/application_1471123767175_0001/
16/08/14 05:52:12 INFO mapreduce.Job: Running job: job_1471123767175_0001
16/08/14 05:52:29 INFO mapreduce.Job: Job job_1471123767175_0001 running in uber mode : false
16/08/14 05:52:29 INFO mapreduce.Job: map 0% reduce 0%
16/08/14 05:52:39 INFO mapreduce.Job: map 100% reduce 0%
16/08/14 05:52:50 INFO mapreduce.Job: map 100% reduce 100%
16/08/14 05:52:51 INFO mapreduce.Job: Job job_1471123767175_0001 completed successfully
16/08/14 05:52:51 INFO mapreduce.Job: Counters: 49
File System Counters
FILE: Number of bytes read=43
FILE: Number of bytes written=212945
FILE: Number of read operations=0
FILE: Number of large read operations=0
FILE: Number of write operations=0
HDFS: Number of bytes read=123
HDFS: Number of bytes written=25
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)=7906
Total time spent by all reduces in occupied slots (ms)=8688
Total time spent by all map tasks (ms)=7906
Total time spent by all reduce tasks (ms)=8688
Total vcore-seconds taken by all map tasks=7906
Total vcore-seconds taken by all reduce tasks=8688
Total megabyte-seconds taken by all map tasks=8095744
Total megabyte-seconds taken by all reduce tasks=8896512
Map-Reduce Framework
Map input records=1
Map output records=3
Map output bytes=31
Map output materialized bytes=43
Input split bytes=104
Combine input records=3
Combine output records=3
Reduce input groups=3
Reduce shuffle bytes=43
Reduce input records=3
Reduce output records=3
Spilled Records=6
Shuffled Maps =1
Failed Shuffles=0
Merged Map outputs=1
GC time elapsed (ms)=278
CPU time spent (ms)=3290
Physical memory (bytes) snapshot=391761920
Virtual memory (bytes) snapshot=4165275648
Total committed heap usage (bytes)=275775488
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=19
File Output Format Counters
Bytes Written=25
10.[hadoop@hadoop02 hadoop-2.6.2]$ hadoop fs -ls output1 (查看结果)
16/08/14 06:11:58 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Found 2 items
-rw-r--r-- 1 hadoop supergroup 0 2016-08-14 05:52 output1/_SUCCESS
-rw-r--r-- 1 hadoop supergroup 25 2016-08-14 05:52 output1/part-r-00000
[hadoop@hadoop02 hadoop-2.6.2]$ hadoop fs -cat output1/part-r-00000 (查看结果)
16/08/14 06:13:03 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
adfadf 1
adfas 1
dfadf 1
使用hadoop实现wordcount 自己的实现过程
标签:
原文地址:http://www.cnblogs.com/ailonglong/p/5771814.html