Hi St.Ack - I would be happy to try to collaborate on a doc patch. I tried to write a blog post that summarizes some of the issues. I also wrote a class that will take in sequence files and convert to bulk load files. I put the source on my blog along with showing how to use ant to run the bulk loader (I use ant because I have complex hadoop-job dependencies that I run with and "parallel" and "sequential" tasks):
http://notskateboarding.blogspot.com/2011/01/hbase-089-bulk-import-capability.html I find my BulkLoader class very convenient. I was writing this from memory, b/c I didn't keep tight notes on a couple things I had to do like re-jarring the 0.89 jar with a "lib" directory containing dependencies. Hopefully it's at least a list of gotchas if not step-by-step directions. -g -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Stack Sent: Tuesday, January 18, 2011 10:51 AM To: [email protected] Cc: [email protected] Subject: Re: bulk loaded value Any chance of a patch to the doc Geoff? If you ran into the issue, others will too. I'm glad you figured it. St.Ack On Tue, Jan 18, 2011 at 9:24 AM, Geoff Hendrey <[email protected]> wrote: > Thanks for your response. Her is what happened. I didn't realize that no > matter what reducer you specify, when you use configureIncrementalLoad, the > HFileOutputformat will ignore your reducer and use it's own. Here is code > from configureIncrementalLoad: > > // Based on the configured map output class, set the correct reducer to > properly > // sort the incoming values. > // TODO it would be nice to pick one or the other of these formats. > if (KeyValue.class.equals(job.getMapOutputValueClass())) { > job.setReducerClass(KeyValueSortReducer.class); > } else if (Put.class.equals(job.getMapOutputValueClass())) { > job.setReducerClass(PutSortReducer.class); > } else { > LOG.warn("Unknown map output value type:" + > job.getMapOutputValueClass()); > } > > That point wasn't clear to me from the doc's. So of course, now I understand > that no matter what I put in my reducer, the reducer never gets invoked. To > work around this, I just output my data to a sequence file, and then use the > HFileOutputFormat with configureIncrementalLoad to bulk load the sequence > file. > > By the way, so far the performance of the bulk loader is amazing compared to > trying to do batch inserts from a mapreduce job by doing Put from the > reducer. Thanks. > > -g > > -----Original Message----- > From: [email protected] [mailto:[email protected]] On Behalf Of Stack > Sent: Monday, January 17, 2011 9:55 PM > To: [email protected] > Cc: [email protected] > Subject: Re: bulk loaded value > > Whats 'key' in the below? Is it a key of yours? Its some > incrementing long? When you create the KeyValue below, you are > setting this long as your row value. > > The shell does best effort at Stringifying everything it sees. It > passes all bytes via this function on emission: > http://people.apache.org/~stack/hbase-0.90.0-candidate-3/docs/apidocs/index.html > (Doc could be a bit better but you get the idea). > > By what you print below, it looks like its a zero-padded long and > we're outputting it in HEX with each byte of the long escaped. > > St.Ack > > On Mon, Jan 17, 2011 at 9:30 AM, Geoff Hendrey <[email protected]> wrote: >> Hi - >> >> >> >> I am using 0.89 for bulk loading. In my reducer: >> >> >> >> ImmutableBytesWritable ibw = new >> ImmutableBytesWritable(key.copyBytes()); >> >> KeyValue kv = new KeyValue(key.copyBytes(), >> Bytes.toBytes(context.getConfiguration().get("fam", "count")), >> Bytes.toBytes("c"), 100L,"hello".getBytes()); >> >> context.write(ibw, kv); >> >> >> >> The keys and the timestamp seem to go into HBase fine when I use the >> 'completebulkload' bulk loader, but the hbase shell shows >> value=\x00\x00\x00\x01 for every value. The keys and timestamps are >> fine. I've read all the relevant doc's and posts that I can find on >> this, but I'm still scratching my head about what I am doing wrong to >> generate the value. >> >> >> >> -g >> >> >
