开发者

Integrate Hbase with PHP [closed]

开发者 https://www.devze.com 2023-02-25 19:55 出处:网络
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Up开发者_Python百科date the question so it focuses on one problem only
Closed. This question needs to be more focused. It is not currently accepting answers.

Want to improve this question? Up开发者_Python百科date the question so it focuses on one problem only by editing this post.

Closed 8 years ago.

Improve this question

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,


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


Try this hbase and hive thrift php client package:

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


This is right, but in Hadoop 0.90.3, the command to compile is

thrift --gen php [hbase-root]/src/main/resources/org/apache/hadoop/hbase/thrift/Hbase.thrift
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号