Friday, June 17, 2016

Configuring Thrift for HBase IO

Configuring php Thrift for HBase IO

There are few ways to read and write data to HBase in php. There is hard programmatic Socket connection IO; shell script system calls; HBase stargate restful calls; and Thrift connection calls.
Thrift php is a library with Socket connection calls to HBase. Works well with a php applications being migrated from mysql.

The setup

Assuming you already have php/php5 installed and running on ubuntu.

Install git
sudo apt-get install build-essential automake libtool flex bison libboost*

Get latest Thrift
git clone https://git-wip-us.apache.org/repos/asf/thrift.git

Make Thrift 
change dir into ~thrift/ and execute bootstrap
cd ~/thrift
./bootstrap.sh

Run environment configuration 
./configure
make - an install will be found in /usr/lib/php
make install
The final product is installed in /usr/lib/php

HBase IO

Setting up Thrift php modules
The basic requirements:
-set globals
-set required files
-set use HBase and Thrift classes

Import dependencies


Initialize classes

Write to Hbase Example

Read from Hbase Example