mapreduce 读写Lzo
来源:互联网 发布:淘宝孕妇装店铺排行 编辑:程序博客网 时间:2024/06/05 20:05
1.读lzo文件
需要添加以下代码,并导入lzo相关的jar包
job.setInputFormatClass(LzoTextInputFormat.class);
2.写lzo文件
lzo格式默认是不支持splitable的,需要为其添加索引文件,才能支持多个map并行对lzo文件进行处理
如果希望reduce输出的是lzo格式的文件,添加下面的语句
FileOutputFormat.setCompressOutput(job, true);
FileOutputFormat.setOutputCompressorClass(job, LzopCodec.class);
int result = job.waitForCompletion(true) ? 0 : 1;
//上面的语句执行完成后,会生成最后的输出文件,需要在此基础上添加lzo的索引
LzoIndexer lzoIndexer = new LzoIndexer(conf);
lzoIndexer.index(new Path(args[1]));
如果已经存在lzo文件,但没有添加索引,可以采用下面的方法,在输入路径的文件上上添加lzo索引
hadoop jar $HADOOP_HOME/lib/hadoop-lzo-0.4.17.jar com.hadoop.compression.lzo.LzoIndexer hdf://inputpath
需要添加以下代码,并导入lzo相关的jar包
job.setInputFormatClass(LzoTextInputFormat.class);
2.写lzo文件
lzo格式默认是不支持splitable的,需要为其添加索引文件,才能支持多个map并行对lzo文件进行处理
如果希望reduce输出的是lzo格式的文件,添加下面的语句
FileOutputFormat.setCompressOutput(job, true);
FileOutputFormat.setOutputCompressorClass(job, LzopCodec.class);
int result = job.waitForCompletion(true) ? 0 : 1;
//上面的语句执行完成后,会生成最后的输出文件,需要在此基础上添加lzo的索引
LzoIndexer lzoIndexer = new LzoIndexer(conf);
lzoIndexer.index(new Path(args[1]));
如果已经存在lzo文件,但没有添加索引,可以采用下面的方法,在输入路径的文件上上添加lzo索引
hadoop jar $HADOOP_HOME/lib/hadoop-lzo-0.4.17.jar com.hadoop.compression.lzo.LzoIndexer hdf://inputpath
0 0
- mapreduce 读写lzo文件
- mapreduce 读写Lzo
- 读写lzo
- pyspark 读写lzo 文件例子
- spark下读写lzo文件(java)
- lzo
- LZO
- Mapreduce读写DB数据
- Hadoop MapReduce 读写Elasticsearch
- MapReduce读写HBASE
- MapReduce读写hbase
- MapReduce读写orc文件
- Hadoop 中利用 mapreduce 读写 mysql 数据
- 利用mapreduce批量读写hbase数据
- Hadoop 中利用 mapreduce 读写 mysql 数据
- Hadoop 中利用 mapreduce 读写 mysql 数据
- MapReduce从HBase读写数据简单示例
- Hadoop/MapReduce(单词统计--读写数据库)
- java程序员必知的8大排序
- 常见算法笔试或面试题
- 【scrapy】使用方法概要(四)(转)
- Eclipse安装SVN插件
- JQuery file upload Access is denied in IE 7, 8, 9
- mapreduce 读写Lzo
- C++虚函数
- 数据结构----dijkstra算法,单源最短路径
- Fckeditor上传图片出现“因为安全原因,文件不可浏览. 请联系系统管理员并检查CKFinder配置文件。”
- uboot启动wince命令-bootwince
- C++模板实例化
- selector背景以及android的透明色
- SD卡加载程序
- 用node.js搭建web聊天室