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).
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:
发布评论
评论(3)
您无法直接从 PHP 访问 HBase,但您可以通过仔细查看 Thrift 接口来解决此问题。
设置它有多个部分:
第一:
Thrift 是一个用于跨语言通信的系统,并不特定于 HBase。 HBase 的接口规范看起来 像这样。
要使用 Thrift 接口,您需要编译您所使用的语言的规范,在本例中为 PHP。为此,您需要 Thrift 编译器(可以从 thrift.apache.org 获取)。
编译它:
这将生成一些 PHP 接口文件。将其与 Thrift 库文件(随编译器一起提供)一起放入您的项目中。
使用 Thrift 和 PHP 的示例可以在这里找到:http://svn.apache.org/viewvc/thrift/trunk/tutorial/php/PhpServer.php?view=markup - 您调用的函数和方法将是你在接口文件中看到。
第二:
您需要运行一个 Thrift 服务器来实际连接到 HBase。
说明HBase 站点,但大多数情况下您只需要:
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:
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 和 hive thrift php 客户端包:
http://nousefor.net/55/2011/12/php/hbase-and-hive-thrift-php-client/
Try this hbase and hive thrift php client package:
http://nousefor.net/55/2011/12/php/hbase-and-hive-thrift-php-client/
这是正确的,但是在 Hadoop 0.90.3 中,编译的命令是
This is right, but in Hadoop 0.90.3, the command to compile is