libhbase is a JNI-based, thread-safe C library that implements a native HBase client. You can use libhbase to build applications that access HBase.
This page contains the following topics:
For examples that show how to use the APIs, see the sample source file.
Install libhbase on the nodes from which you will build and run the application.
Complete the following steps to install libhbase from a repository:
yum install mapr-libhbase
zypper install mapr-libhbase
apt-get install mapr-libhbase
Once the installation completes, the libhbase installation includes the following
directories under /opt/mapr/libhbase/libhbase-<version>:
/
+---bin/
+---conf/
+---include/
| +--hbase/
+---lib/
| +---native/
+---src
+---examples/
| +---async/
+---test/
+---native/
+---common/
include folder contains the headers required to build
applications. The lib/native directory contains shared libraries. To upgrade to a more recent version of libhbase:
libhbase should be installed on each node that builds the application.
Note the following items when you build applications with libhbase:
/opt/mapr/libhbase/libhbase-<version>/include./opt/mapr/libhbase/libhbase-<version>/lib/native.For example, the following command builds the hello_hbase application
with the hello_hbase.c source code:
gcc -o hello_hbase hello_hbase.c -I/opt/mapr/libhbase/libhbase-0.98.7/include -L/opt/mapr/libhbase/libhbase-0.98.7/lib/native -lhbase -L/usr/lib/jvm/java-7-sun/jre/lib/amd64/server -ljvm
Complete the following steps to configure the node from which you run the application:
Verify that libhbase is installed on the node.
Verify that both the libhbase and libjvm shared libraries are in the application’s
library search path. The libhbase shared library is located under
/opt/mapr/libhbase/libhbase-<version>/lib/native. In
general, the libjvm library is located within the JDK/JRE installation
directory.
Specify any JARs required by the application with one of the following environment
variables: CLASSPATH or HBASE_LIB_DIR.
-Xmx, using the environment
variable LIBHBASE_OPTS.libhbase 0.98.7 includes a performance test that supports sequential/random gets and puts. In libhbase 0.98.9, the performance test utility also includes support for Zipfian, support for uniform random key generation, and it test for scans. You can run the test using this shell script.