如何将Hadoop Streaming与LZO压缩序列文件一起使用?

gra*_*tur 5 hadoop mapreduce amazon-emr

我正在尝试使用亚马逊的Elastic Map Reduce来使用Google ngrams数据集.http://aws.amazon.com/datasets/8172056142375670上有一个公共数据集,我想使用Hadoop流媒体.

对于输入文件,它说"我们将数据集存储在Amazon S3中的单个对象中.文件是序列文件格式,块级LZO压缩.序列文件键是存储为LongWritable的数据集的行号, value是存储为TextWritable的原始数据."

为了使用Hadoop Streaming处理这些输入文件,我需要做什么?

我尝试在我的参数中添加一个额外的"-inputformat SequenceFileAsTextInputFormat",但这似乎不起作用 - 我的工作因某些未指明的原因而一直失败.我还缺少其他论据吗?

我尝试使用一个非常简单的身份作为我的mapper和reducer

#!/usr/bin/env ruby

STDIN.each do |line|
  puts line
end
Run Code Online (Sandbox Code Playgroud)

但这不起作用.

mat*_*cey 6

lzo被打包为弹性mapreduce的一部分,所以不需要安装任何东西.

我刚试过这个,它有效......

 hadoop jar ~hadoop/contrib/streaming/hadoop-streaming.jar \
  -D mapred.reduce.tasks=0 \
  -input s3n://datasets.elasticmapreduce/ngrams/books/20090715/eng-all/1gram/ \
  -inputformat SequenceFileAsTextInputFormat \
  -output test_output \
  -mapper org.apache.hadoop.mapred.lib.IdentityMapper