Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Integrate Hbase with PHP [closed]

Tags:

php

thrift

hbase

I have installed the Hbase and now I am looking for some PHP library to integrate hbase with PHP I have tried 2 libraries one is I tried to connect with thrift but was unable to do so 2nd is I tried to connect it with popHbase but was unable to do so can somebody provide me if there is any other library available or if there is any working library available that uses thrift? please suggest me what should I do in order PHP to communicate with hbase.

Regards,

like image 663
user711372 Avatar asked Apr 16 '11 17:04

user711372


2 Answers

You cannot access HBase directly from PHP, but you can workaround it by taking a closer look at the Thrift interface.

There's multiple parts to setting it up:

First:

Thrift is a system for inter-language communication and is not specific to HBase. The interface specification that HBase has looks like this.

To use the Thrift interface, you need to compile the specification for the language you are using, in this case, PHP. To do this, you need the Thrift compiler (you can get it at thrift.apache.org).

Complile it:

thrift --gen php [hbase-root]/src/java/org/apache/hadoop/hbase/thrift/Hbase.thrift

This will generate a few PHP interface file. Drop that into your project along with the Thrift library files (that came with the compiler).

An example of using Thrift and PHP can be found here: http:// svn.apache.org/viewvc/thrift/trunk/tutorial/php/PhpServer.php?view=markup - the functions and methods you call will be the ones you see in the interface file.

Second:

You need to have a Thrift server running that will do the actual connection to HBase. Instructions are on the HBase site, but for the most part you should just need to:

[hbase-root]/bin/hbase thrift start

like image 67
sirbrialliance Avatar answered Sep 19 '22 02:09

sirbrialliance


Try this hbase and hive thrift php client package:

http://nousefor.net/55/2011/12/php/hbase-and-hive-thrift-php-client/

like image 30
Spoom Avatar answered Sep 20 '22 02:09

Spoom