Hbase + Thrift + php

to create new topics or reply. | New User Registration

This topic contains 3 replies, has 3 voices, and was last updated by  xiaobo gu 4 months ago.

  • Creator
  • #19165

    petri koski

    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

Viewing 3 replies - 1 through 3 (of 3 total)

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

  • Author
  • #69707

    xiaobo gu

    Hi Abdelrhaman,

    My Hbase 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?


    petri koski

    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 ?




    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.
    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.


Viewing 3 replies - 1 through 3 (of 3 total)
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.