Integrate Hbase with PHP [closed]

﹥>﹥吖頭↗ 提交于 2019-12-03 03:37:07

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
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!