- public class Test_multi {
- public static void main(String[] args) throws Exception {
- Configuration conf = new Configuration();
- String[] otherArgs = new GenericOptionsParser(conf, args).getRemainingArgs();
- if (otherArgs.length != 2) {
- System.err.println("Usage: test_multi <in> <out>");
- System.exit(2);
- }
- Job job = new Job(conf, "test_multi");
- job.setJarByClass(Test_multi.class);
- job.setMapperClass(MultiMapper.class);
- // job.setInputFormatClass(LineInputFormat.class);//自定义了InputFormat
- //job.setCombinerClass(IntSumReducer.class);
- //job.setReducerClass(IntSumReducer.class);
- job.setOutputKeyClass(Text.class);
- job.setOutputValueClass(Text.class);
- FileInputFormat.addInputPath(job, new Path(otherArgs[0]));
- FileOutputFormat.setOutputPath(job, new Path(otherArgs[1]));
- //job.waitForCompletion(true);
- System.exit(job.waitForCompletion(true) ? 0 : 1);
- }
不使用自定义的InputFormat的处理结果是
- 11/11/10 14:54:25 INFO jvm.JvmMetrics: Initializing JVM Metrics with processName=JobTracker, sessionId=
- 11/11/10 14:54:25 WARN mapred.JobClient: No job jar file set. User classes may not be found. See JobConf(Class) or JobConf#setJar(String).
- 11/11/10 14:54:25 INFO input.FileInputFormat: Total input paths to process : 1
- 11/11/10 14:54:25 INFO mapred.JobClient: Running job: job_local_0001
- 11/11/10 14:54:25 INFO input.FileInputFormat: Total input paths to process : 1
- 11/11/10 14:54:26 INFO mapred.MapTask: io.sort.mb = 100
- 11/11/10 14:54:26 INFO mapred.JobClient: map 0% reduce 0%
- 11/11/10 14:54:26 INFO mapred.MapTask: data buffer = 79691776/99614720
- 11/11/10 14:54:26 INFO mapred.MapTask: record buffer = 262144/327680
- 11/11/10 14:54:32 INFO mapred.LocalJobRunner:
- 11/11/10 14:54:33 INFO mapred.JobClient: map 58% reduce 0%
- 11/11/10 14:54:34 INFO mapred.MapTask: Starting flush of map output
- 11/11/10 14:54:35 INFO mapred.LocalJobRunner:
- 11/11/10 14:54:35 INFO mapred.JobClient: map 100% reduce 0%
- 11/11/10 14:54:35 INFO mapred.MapTask: Finished spill 0
- 11/11/10 14:54:35 INFO mapred.TaskRunner: Task:attempt_local_0001_m_000000_0 is done. And is in the process of commiting
- 11/11/10 14:54:35 INFO mapred.LocalJobRunner:
- 11/11/10 14:54:35 INFO mapred.TaskRunner: Task 'attempt_local_0001_m_000000_0' done.
- 11/11/10 14:54:35 INFO mapred.LocalJobRunner:
- 11/11/10 14:54:35 INFO mapred.Merger: Merging 1 sorted segments
- 11/11/10 14:54:35 INFO mapred.Merger: Down to the last merge-pass, with 1 segments left of total size: 2974 bytes
- 11/11/10 14:54:35 INFO mapred.LocalJobRunner:
- 11/11/10 14:54:36 INFO mapred.TaskRunner: Task:attempt_local_0001_r_000000_0 is done. And is in the process of commiting
- 11/11/10 14:54:36 INFO mapred.LocalJobRunner:
- 11/11/10 14:54:36 INFO mapred.TaskRunner: Task attempt_local_0001_r_000000_0 is allowed to commit now
- 11/11/10 14:54:36 INFO output.FileOutputCommitter: Saved output of task 'attempt_local_0001_r_000000_0' to hdfs://an.local:9100/user/an/out2
- 11/11/10 14:54:36 INFO mapred.LocalJobRunner: reduce > reduce
- 11/11/10 14:54:36 INFO mapred.TaskRunner: Task 'attempt_local_0001_r_000000_0' done.
- 11/11/10 14:54:36 INFO mapred.JobClient: map 100% reduce 100%
- 11/11/10 14:54:36 INFO mapred.JobClient: Job complete: job_local_0001
- 11/11/10 14:54:36 INFO mapred.JobClient: Counters: 14
- 11/11/10 14:54:36 INFO mapred.JobClient: FileSystemCounters
- 11/11/10 14:54:36 INFO mapred.JobClient: FILE_BYTES_READ=35990
- 11/11/10 14:54:36 INFO mapred.JobClient: HDFS_BYTES_READ=8052
- 11/11/10 14:54:36 INFO mapred.JobClient: FILE_BYTES_WRITTEN=72570
- 11/11/10 14:54:36 INFO mapred.JobClient: HDFS_BYTES_WRITTEN=2642
- 11/11/10 14:54:36 INFO mapred.JobClient: Map-Reduce Framework
- 11/11/10 14:54:36 INFO mapred.JobClient: Reduce input groups=165
- 11/11/10 14:54:36 INFO mapred.JobClient: Combine output records=0
- 11/11/10 14:54:36 INFO mapred.JobClient: Map input records=165
- 11/11/10 14:54:36 INFO mapred.JobClient: Reduce shuffle bytes=0
- 11/11/10 14:54:36 INFO mapred.JobClient: Reduce output records=165
- 11/11/10 14:54:36 INFO mapred.JobClient: Spilled Records=330
- 11/11/10 14:54:36 INFO mapred.JobClient: Map output bytes=2642
- 11/11/10 14:54:36 INFO mapred.JobClient: Combine input records=0
- 11/11/10 14:54:36 INFO mapred.JobClient: Map output records=165
- 11/11/10 14:54:36 INFO mapred.JobClient: Reduce input records=165
