Hadoop Streaming with SequenceFile (on AWS)

I have a large number of Hadoop SequenceFiles which I would like to process using Hadoop on AWS. Most of my existing code is written in Ruby, and so I would like to use Hadoop Streaming along with my custom Ruby Mapper and Reducer scripts on Amazon EMR.

I cannot find any documentation on how to integrate Sequence Files with Hadoop Streaming, and how the input will be provided to my Ruby scripts. I'd appreciate some instructions on how to launch jobs (either directly on EMR, or just a normal Hadoop command line) to make use of SequenceFiles and some information on how to expect the data to be provided to my script.

--Edit: I had previously referred to StreamFiles rather than SequenceFiles by mistake. I think the documentation for my data was incorrect, but apologies. The answer is easy with the change.

Answers


The answer to this is to specify the input format as a command line argument to Hadoop.

-inputformat SequenceFileAsTextInputFormat

The chances are that you want the SequenceFile as text, but there is also SequenceFileAsBinaryInputFormat if thats more appropriate.


Not sure if this is what you're asking for, but the command to use ruby map reduce scripts with the hadoop command line would look something like this:

% hadoop jar $HADOOP_INSTALL/contrib/streaming/hadoop-*-streaming.jar \
  -input input/ncdc/sample.txt \
  -output output \
  -mapper ch02/src/main/ruby/max_temperature_map.rb \
  -reducer ch02/src/main/ruby/max_temperature_reduce.rb

You can (and should) use a combiner with big data sets. Add it with the -combiner option. The combiner output will feed directly into your mapper (but no guarantee how many times this will be called, if at all). Otherwise your input is split (according to the standard hadoop protocal) and feeds directly into your mapper. The example is from O'Reily's Hadoop: The Definitive Guide 3rd Edition. It has some very good information on streaming, and a section dedicated to streaming with ruby.


Need Your Help

using public/private keys in javascript

javascript security rsa public-key

I need to send an ajax POST request to my server.

Separate iOS apps and icons for Testflight and production builds

ios xcode testflight bundle-identifier

I'd like to be able to have a debug/testflight version of my app on my phone as well as the app currently in production, but I'm not sure how to do that. I know it has something to do with the bund...