php thrift for HBase

本文详细介绍了如何下载、安装Thrift,为HBase创建PHP API,并通过示例验证其功能。

1. Download thrift

wget -O thrift.tgz “http://gitweb.thrift-rpc.org/?p=thrift.git;a=snapshot;h=HEAD;sf=tgz”
tar -xzf thrift.tgz
cd thrift2. Install thrift

./boostrap.sh
./configure
make
sudo make install3. Make php API for HBase

You have to instll HBase in advance.

cp -r /usr/local/hbase/src/java/org/apache/hadoop/hbase/thrift ~/thrift_src
cd ~/thrift_src

thrift -php Hbase.thrift

cp -r ~/thrift_src/lib/php/src /opt/lampp/htdocs/thrift
mkdir /opt/lampp/htdocs/thrift/packages
cp -r ~/thrift_src/gen_php /opt/lampp/htdocs/thrift/packages/Hbase
4. Start HBase thrift server

/usr/local/hbase/bin/hbase thrift start5. Test to access HBase

cp /usr/local/hbase/src/examples/thrift/DemoClient.php /opt/lampp/htdocs/DemoClient.phpYou have to change the THRIFT_ROOT variable in DemoClient.php to the match your thrift root.

eg:

$GLOBALS['THRIFT_ROOT'] = ‘/root/thrift-0.6.1/lib/php/src’;php DemoClient.php

6. Attention

Lf you use clouder CDH to install thrift. You can just:

yum install hadoop-hbase-thrift -yBut you still have to do the above thing in order to get the thrift php API for HBase.

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值