아래 3개 파일을 열어 환결설정을 해주어야 한다. (기본적으로 되어 있어서 아마 바꿀 것은 없을 것이다.)
$ vi $HADOOP_HOME/etc/hadoop/mapred-site.xml.template
$ vi $HADOOP_HOME/etc/hadoop/hdfs-site.xml
$ vi $HADOOP_HOME/etc/hadoop/core-site.xml
위 3개 파일 내에 있는 <configuration> 태그의 시작과 종료 태그 사이에 있는 모든 문자열을 제거한 후 저장한다.
각각에 대한 보충 설명은 아래와 같다.
mapred-site.xml.template : MapReduce 프레임워크와 관련된 내용을 편집할 때 사용
hdfs-site.xml : HDFS와 관련된 내용을 편집할 때 사용
core-site.xml : 하둡 네임노드의 위치를 지정할 때 사용
명령 수행
$ bin/hadoop jar hadoop-examples-1.0.3.jar wordcount README.txt README.txt.result
root@ailabhadoop:/home/redcarrot/hadoop-1.0.3# bin/hadoop jar hadoop-examples-1.0.3.jar wordcount README.txt README.txt.result Warning: $HADOOP_HOME is deprecated.
14/04/08 19:38:13 INFO util.NativeCodeLoader: Loaded the native-hadoop library 14/04/08 19:38:13 INFO input.FileInputFormat: Total input paths to process : 1 14/04/08 19:38:13 WARN snappy.LoadSnappy: Snappy native library not loaded 14/04/08 19:38:13 INFO mapred.JobClient: Running job: job_local_0001 14/04/08 19:38:13 INFO util.ProcessTree: setsid exited with exit code 0 14/04/08 19:38:13 INFO mapred.Task: Using ResourceCalculatorPlugin : org.apache.hadoop.util.LinuxResourceCalculatorPlugin@567a4593 14/04/08 19:38:13 INFO mapred.MapTask: io.sort.mb = 100 14/04/08 19:38:13 INFO mapred.MapTask: data buffer = 79691776/99614720 14/04/08 19:38:13 INFO mapred.MapTask: record buffer = 262144/327680 14/04/08 19:38:13 INFO mapred.MapTask: Starting flush of map output 14/04/08 19:38:13 INFO mapred.MapTask: Finished spill 0 14/04/08 19:38:13 INFO mapred.Task: Task:attempt_local_0001_m_000000_0 is done. And is in the process of commiting 14/04/08 19:38:14 INFO mapred.JobClient: map 0% reduce 0% 14/04/08 19:38:16 INFO mapred.LocalJsobRunner: 14/04/08 19:38:16 INFO mapred.Task: Task 'attempt_local_0001_m_000000_0' done. 14/04/08 19:38:16 INFO mapred.Task: Using ResourceCalculatorPlugin : org.apache.hadoop.util.LinuxResourceCalculatorPlugin@191c2c15 14/04/08 19:38:16 INFO mapred.LocalJobRunner: 14/04/08 19:38:16 INFO mapred.Merger: Merging 1 sorted segments 14/04/08 19:38:16 INFO mapred.Merger: Down to the last merge-pass, with 1 segments left of total size: 1832 bytes 14/04/08 19:38:16 INFO mapred.LocalJobRunner: 14/04/08 19:38:16 INFO mapred.Task: Task:attempt_local_0001_r_000000_0 is done. And is in the process of commiting 14/04/08 19:38:16 INFO mapred.LocalJobRunner: 14/04/08 19:38:16 INFO mapred.Task: Task attempt_local_0001_r_000000_0 is allowed to commit now 14/04/08 19:38:16 INFO output.FileOutputCommitter: Saved output of task 'attempt_local_0001_r_000000_0' to result_README.txt 14/04/08 19:38:17 INFO mapred.JobClient: map 100% reduce 0% 14/04/08 19:38:19 INFO mapred.LocalJobRunner: reduce > reduce 14/04/08 19:38:19 INFO mapred.Task: Task 'attempt_local_0001_r_000000_0' done. 14/04/08 19:38:20 INFO mapred.JobClient: map 100% reduce 100% 14/04/08 19:38:20 INFO mapred.JobClient: Job complete: job_local_0001 14/04/08 19:38:20 INFO mapred.JobClient: Counters: 20 14/04/08 19:38:20 INFO mapred.JobClient: File Output Format Counters 14/04/08 19:38:20 INFO mapred.JobClient: Bytes Written=1326 14/04/08 19:38:20 INFO mapred.JobClient: FileSystemCounters 14/04/08 19:38:20 INFO mapred.JobClient: FILE_BYTES_READ=289802 14/04/08 19:38:20 INFO mapred.JobClient: FILE_BYTES_WRITTEN=357038 14/04/08 19:38:20 INFO mapred.JobClient: File Input Format Counters 14/04/08 19:38:20 INFO mapred.JobClient: Bytes Read=1366 14/04/08 19:38:20 INFO mapred.JobClient: Map-Reduce Framework 14/04/08 19:38:20 INFO mapred.JobClient: Map output materialized bytes=1836 14/04/08 19:38:20 INFO mapred.JobClient: Map input records=31 14/04/08 19:38:20 INFO mapred.JobClient: Reduce shuffle bytes=0 14/04/08 19:38:20 INFO mapred.JobClient: Spilled Records=262 14/04/08 19:38:20 INFO mapred.JobClient: Map output bytes=2055 14/04/08 19:38:20 INFO mapred.JobClient: Total committed heap usage (bytes)=447610880 14/04/08 19:38:20 INFO mapred.JobClient: CPU time spent (ms)=0 14/04/08 19:38:20 INFO mapred.JobClient: SPLIT_RAW_BYTES=109 14/04/08 19:38:20 INFO mapred.JobClient: Combine input records=179 14/04/08 19:38:20 INFO mapred.JobClient: Reduce input records=131 14/04/08 19:38:20 INFO mapred.JobClient: Reduce input groups=131 14/04/08 19:38:20 INFO mapred.JobClient: Combine output records=131 14/04/08 19:38:20 INFO mapred.JobClient: Physical memory (bytes) snapshot=0 14/04/08 19:38:20 INFO mapred.JobClient: Reduce output records=131 14/04/08 19:38:20 INFO mapred.JobClient: Virtual memory (bytes) snapshot=0 14/04/08 19:38:20 INFO mapred.JobClient: Map output records=179 root@ailabhadoop:/home/redcarrot/hadoop-1.0.3#
결과 확인
$ bin/hadoop fs -cat README.txt.result1/*
root@ailabhadoop:/home/redcarrot/hadoop-1.0.3# bin/hadoop fs -cat README.txt.result1/* Warning: $HADOOP_HOME is deprecated.
(BIS), 1 (ECCN) 1 (TSU) 1 (see 1 5D002.C.1, 1 740.13) 1 <http://www.wassenaar.org/> 1 Administration 1 Apache 1 BEFORE 1 BIS 1 Bureau 1 Commerce, 1 Commodity 1 Control 1 Core 1 Department 1 ENC 1 Exception 1 Export 2 For 1 ...