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
Modifier and TypeClassDescriptionstatic class
Internal Mapper to be run by Hadoop. -
Field Summary
Modifier and TypeFieldDescriptionstatic final byte[]
the column family containing the indexed row keystatic final byte[]
the qualifier containing the indexed row key -
Constructor Summary
-
Method Summary
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
the column family containing the indexed row key -
INDEX_QUALIFIER
the qualifier containing the indexed row key
-
-
Constructor Details
-
IndexBuilder
public IndexBuilder()
-
-
Method Details
-
configureJob
public static org.apache.hadoop.mapreduce.Job configureJob(org.apache.hadoop.conf.Configuration conf, String[] args) throws IOException Job configuration.- Throws:
IOException
-
run
- Specified by:
run
in interfaceorg.apache.hadoop.util.Tool
- Throws:
Exception
-
main
- Throws:
Exception
-