Using Pig with HBase

To allow Pig scripts to use HBase, add the following statement to the top of each script. Replace the <component_version> strings with the current HBase, ZooKeeper and CDH version numbers.

register /usr/lib/zookeeper/zookeeper-<ZooKeeper_version>-cdh<CDH_version>.jar
register /usr/lib/hbase/hbase-<HBase_version>-cdh<CDH_version>-security.jar

For example,

register /usr/lib/zookeeper/zookeeper-3.4.5-cdh5.0.0.jar
register /usr/lib/hbase/hbase-0.95.2-cdh5.0.0-security.jar

In addition, Pig needs to be able to access the hbase-site.xml file on the Hadoop client. Pig searches for the file within the /etc/hbase/conf directory on the client, or in Pig's CLASSPATH variable.

For more information about using Pig with HBase, see Importing Data Into HBase.