HBase Forum

Hbase + Thrift + php

  • #19165
    petri koski
    Member

    Hello, I am trying to use HBase using PHP. I know thrift and I got it running in my cluster (I just executed hbase thrift -threadpool start) However, where can I find files (.php files listed below .. ) needed in my webpage:

    $GLOBALS[‘THRIFT_ROOT’] = ‘/opt/thrift/lib/php/lib/Thrift';

    require_once( $GLOBALS[‘THRIFT_ROOT’].’/Thrift.php’ );
    require_once( $GLOBALS[‘THRIFT_ROOT’].’/Transport/TSocket.php’ );
    require_once( $GLOBALS[‘THRIFT_ROOT’].’/Transport/TBufferedTransport.php’ );
    require_once( $GLOBALS[‘THRIFT_ROOT’].’/Protocol/TBinaryProtocol.php’ );

    # According to the thrift documentation, compiled PHP thrift libraries should
    # reside under the THRIFT_ROOT/packages directory. If these compiled libraries
    # are not present in this directory, move them there from gen-php/.
    require_once( $GLOBALS[‘THRIFT_ROOT’].’/packages/Hbase/Hbase.php’ );

    Maybe I got something wrong but little guidance would be helpful ..

    Petri Kosk

to create new topics or reply. | New User Registration

  • Author
    Replies
  • #19172
    abdelrahman
    Moderator

    Hi Petri ,
    How is your day so far? To obtain the thrift interfaces you need to compile it using the the Thrift compiler Which can be used with Hbase API to obtain these files. Here is an example of Thrift & PHP& Hbase.
    thrift –gen php [hbase-root]/src/java/org/apache/hadoop/hbase/thrift/Hbase.thrift
    To download the thrift compiler go to this link.
    http://thrift.apache.org/
    The compiler will generate the PHP interfaces with the thrift lib you are ready to go and package it. Please validate that the thrift server is started first before trying to use the thrift server interfaces.

    Thanks
    -Abdelrhaman

    #19253
    petri koski
    Member

    Hello abdelrahman !

    Thanks for your reply! You gave me a link to Download Thrift -compiler. So HDP is not that complete it would contain it ?
    I can see Thrift server when I execute “hbase” -command and I am able to start it. Still Compiler is after all missing ?

    Thanks!
    Petri

    #69707
    xiaobo gu
    Participant

    Hi Abdelrhaman,

    My Hbase 0.98.4.2.2.0 was installed by Ambari, but I found the source code of Hbase including Hbase.thrift was not installed, so I use the sources downloaded form Apache web site. But I also found the thrift -gen php …. command only outputs THBaseService.php Types.php, which lacks a lot of files mentioned by many Thrift + Hbase integration examples. Do I miss anything?

You must be to reply to this topic. | Create Account

Support from the Experts

A HDP Support Subscription connects you experts with deep experience running Apache Hadoop in production, at-scale on the most demanding workloads.

Enterprise Support »

Become HDP Certified

Real world training designed by the core architects of Hadoop. Scenario-based training courses are available in-classroom or online from anywhere in the world

Training »

Hortonworks Data Platform
The Hortonworks Data Platform is a 100% open source distribution of Apache Hadoop that is truly enterprise grade having been built, tested and hardened with enterprise rigor.
Get started with Sandbox
Hortonworks Sandbox is a self-contained virtual machine with Apache Hadoop pre-configured alongside a set of hands-on, step-by-step Hadoop tutorials.
Modern Data Architecture
Tackle the challenges of big data. Hadoop integrates with existing EDW, RDBMS and MPP systems to deliver lower cost, higher capacity infrastructure.