Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Php operates hbase through thrift

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Environment configuration

Operating system centos 5.8 hadoop version cloudera cdh4u3 hbase version hbase-0.90.4-cdh4u3 php version 5.2

1. Download and compile thrift

# wget http://ftp.tc.edu.tw/pub/Apache/thrift/0.8.0/thrift-0.8.0.tar.gz

Install the required dependency packages

# yum install automake libtool flex bison pkgconfig gcc-c++ boost-devel libevent-devel zlib-devel python-devel ruby-devel php php-devel

# tar zxvf thrift-0.8.0.tar.gz

# cd thrift-0.8.0

#. / configure-prefix=/home/thrift-with-php-config=/usr/bin/php-config

# make & & make install

2 generate the interface files for php and hbase:

# cd / home/thrift/

# bin/thrift-- gen php $HBASE_HOME/src/main/resources/org/apache/hadoop/hbase/thrift/Hbase.thrift

# cd gen-php/Hbase

# ls

Hbase.php Hbase_types.php

3. Copy the package needed by the PHP client and the interface file just generated for the php program to call:

# mkdir-p / var/www/html/hbasethrift/libs (/ var/www/html is the web home directory of apache)

# cp-a / home/soft/thrift-0.8.0/lib/php/src / var/www/html/hbasethrift/libs

# mkdir-p / var/www/html/hbasethrift/libs/packages

# cp-a / home/thrift/gen-php/Hbase / var/www/html/hbasethrift/libs/packages

4. Start hbase thrift server and test the php connection to hbase

#. / bin/hbase-daemon.sh start thrift

The default listening port for hbase thrift is 9090

Test the hbase code for php connection and operation

# vi hbasethrift.php

Access http://localhost/hbasethrift/hbasethrift.php, through a browser. If the table name in hbase and the newly created table table1 are displayed, the connection is successful.

Hbase thrift api reference http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/thrift/doc-files/index.html

Reference http://www.banping.com/2011/07/08/hbase-thrift-php/

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report