0
一つは次のようにjobconfに入力/出力の圧縮を追加することができ0.20.2版:のHadoop 0.20.205ジョブ(としないJobConf)bzip2圧縮
jobConf.setBoolean("mapred.output.compress", true);
jobConf.setClass("mapred.output.compression.codec", BZip2Codec.class, CompressionCodec.class);
jobConfが廃止され、ジョブがなければなりません代わりに使用されます。圧縮/伸張を追加するにはどうしたらいいですか?具体的には、どのように私は入力のbzip2ファイルへの語数の例を変更することができます。
public class WordCount {
public static void main(String[] args) throws Exception {
Configuration conf = new Configuration();
String[] otherArgs = new GenericOptionsParser(conf, args).getRemainingArgs();
Job job = new Job(conf, "Example Hadoop 0.20.1 WordCount");
job.setJarByClass(WordCount.class);
job.setMapperClass(TokenCounterMapper.class);
job.setReducerClass(TokenCounterReducer.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(IntWritable.class);
FileInputFormat.addInputPath(job, new Path(otherArgs[0]));
FileOutputFormat.setOutputPath(job, new Path(otherArgs[1]));
System.exit(job.waitForCompletion(true) ? 0 : 1);
}