将Hbase与PHP集成 [英] Integrate Hbase with PHP

查看:162
本文介绍了将Hbase与PHP集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了Hbase,现在我正在寻找一些PHP库来将hbase与PHP集成在一起我已经尝试了两个库,一个是我试图与节俭连接,但无法这样做第二是我试图将它与popHbase但无法做到这一点,如果有任何其他库可用或有任何工作库可用,使用节俭可以有人提供我吗?请给我建议我应该怎么做才能使PHP与hbase进行通信。



问候,

解决方案

您无法直接从PHP访问HBase,但可以通过仔细查看Thrift界面来解决此问题。



有多个部分可供设置它起来:

第一:



Thrift是一个跨语言系统沟通并不特定于HBase。 HBase具有的接口规范像这样



要使用Thrift接口,您需要编译您正在使用的语言的规范,这种情况下,PHP。要做到这一点,你需要Thrift编译器(你可以在thrift.apache.org上找到它)。



Complile it:


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


blockquote>

这会生成一些PHP接口文件。将它与Thrift库文件(随编译器一起提供)一起放入您的项目中。



使用Thrift和PHP的示例可以在此处找到:http:// svn.apache.org/viewvc/thrift/trunk/tutorial/php/PhpServer.php?view=markup - 你调用的函数和方法将是你在界面文件中看到的。



第二:您需要运行一个Thrift服务器才能连接到HBase。
说明在HBase网站上 ,但大多数情况下,您应该只是需要:


/ bin / hbase thrift start


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

这篇关于将Hbase与PHP集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆