[转]thrift 轻松实现多语言跨服务器通信

作者:ys250

来源:http://www.ys250.com/2010/07/03/thrift_py_php/

 

thrift是由facebook开发的轻量级跨语言的服务框架,现在已经移交到apache基金会下。和他类似的是google出的protocol buffer和ice。 thrift的一大优势就是支持的语言很丰富,它使用自己的IDL语言来描述服务接口和数据交换的格式。

 

官方网站:http://incubator.apache.org/thrift/

 

一、安装:

yum -y install gcc-c++ autoconf automake sysconftool boost /
    boost-devel libtool perl-ExtUtils-MakeMaker gettext-base /
    gettext gettext-devel liblocale-gettext-perl zlib-devel /
    byacc bison flex pkgconfig python-devel 
 
wget http://apache.freelamp.com/incubator/thrift/0.2.0-incubating/thrift-0.2.0-incubating.tar.gz
 
./bootstrap.sh 
./configure --prefix=/usr/local/thrift --with-ruby=no --with-erlang=no --with-java=no --with-csharp=no --enable-gen-java=no --enable-gen-csharp=no --enable-gen-rb=no --enable-gen-erl=no
make
make install

二、IDL描述:

  
 

三、编译 helloworld:

 

 

 
四、编写服务器端:
 
 
 
五、编写客户端:

按上面的流程就可以写自己的thrift了,我使用py做服务端,用php做客户端,当然也可以使用c++来做服务端。

 

 

 

相关文章:

thrift 安装 http://wiki.apache.org/thrift/ThriftInstallation
redis + thrift + mongodb 数据测试 http://www.ys250.com/2010/09/02/redis-thrift-mongodb-test/
Thrift基本使用 http://hi.baidu.com/infant/blog/item/01fa53436adc79189313c69e.html

 

评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值