Home Forums HBase Hbase + Thrift + php

This topic contains 2 replies, has 2 voices, and was last updated by  petri koski 1 year, 4 months ago.

  • Creator
    Topic
  • #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

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

You must be logged in to reply to this topic.

  • Author
    Replies
  • #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

    Collapse
    #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

    Collapse
Viewing 2 replies - 1 through 2 (of 2 total)