hadoop mapreduce lzo

import com.hadoop.compression.lzo.LzoIndexer;
import com.hadoop.compression.lzo.LzopCodec;

FileOutputFormat. setCompressOutput( job, true); // 设置压缩
FileOutputFormat. setOutputCompressorClass( job, LzopCodec.class ); // 选择压缩类型

result = job .waitForCompletion( true) ? 0 : -1;

// 输出路径 生成索引
LzoIndexer lzoIndexer = new LzoIndexer(getConf());
lzoIndexer.index( new Path( args[1]));

生成lzo文件 并生成索引

job.setInputFormatClass(LzoTextInputFormat.class);

读取lzo类型的文件

原文地址:https://www.cnblogs.com/feelgood/p/5110886.html