Class IndexBuilder

java.lang.Object
org.apache.hadoop.conf.Configured
org.apache.hadoop.hbase.mapreduce.IndexBuilder
All Implemented Interfaces:
org.apache.hadoop.conf.Configurable, org.apache.hadoop.util.Tool

@Private public class IndexBuilder extends org.apache.hadoop.conf.Configured implements org.apache.hadoop.util.Tool
Example map/reduce job to construct index tables that can be used to quickly find a row based on the value of a column. It demonstrates:
  • Using TableInputFormat and TableMapReduceUtil to use an HTable as input to a map/reduce job.
  • Passing values from main method to children via the configuration.
  • Using MultiTableOutputFormat to output to multiple tables from a map/reduce job.
  • A real use case of building a secondary index over a table.

Usage

Modify ${HADOOP_HOME}/conf/hadoop-env.sh to include the hbase jar, the zookeeper jar (can be found in lib/ directory under HBase root, the examples output directory, and the hbase conf directory in HADOOP_CLASSPATH, and then run bin/hadoop org.apache.hadoop.hbase.mapreduce.IndexBuilder TABLE_NAME COLUMN_FAMILY ATTR [ATTR ...]

To run with the sample data provided in index-builder-setup.rb, use the arguments people attributes name email phone.

This code was written against HBase 0.21 trunk.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Internal Mapper to be run by Hadoop.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final byte[]
    the column family containing the indexed row key
    static final byte[]
    the qualifier containing the indexed row key
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.apache.hadoop.mapreduce.Job
    configureJob(org.apache.hadoop.conf.Configuration conf, String[] args)
    Job configuration.
    static void
    main(String[] args)
     
    int
    run(String[] args)
     

    Methods inherited from class org.apache.hadoop.conf.Configured

    getConf, setConf

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.apache.hadoop.conf.Configurable

    getConf, setConf
  • Field Details

    • INDEX_COLUMN

      public static final byte[] INDEX_COLUMN
      the column family containing the indexed row key
    • INDEX_QUALIFIER

      public static final byte[] INDEX_QUALIFIER
      the qualifier containing the indexed row key
  • Constructor Details

  • Method Details