thrift教程


Apache Thrift 采用接口描述语言定义并创建服务,支持可扩展的跨语言服务开发,所包含的代码生成引擎可以在多种语言中,如 C++, Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, Smalltalk 等创建高效的、无缝的服务,其传输数据采用二进制格式,相对 XML 和 JSON 体积更小,对于高并发、大数据量和多语言的环境更有优势

                                      ———摘自《thrift.apache.org》



### 介绍 Thrift通过IDL(Interface Definition Language,接口定义语言)来定义RPC(Remote Procedure Call,远程过程调用)的接口和数据类型,然后通过thrift编译器生成不同语言的代码,并由生成的代码负责RPC协议层和传输层的实现。

thrift-layers


### 安装 现下载:https://thrift.apache.org/download 官网安装:https://thrift.apache.org/docs/install/
#### 快速安装
# 安装命令
brew install thrift
# 卸载命令
brew uninstall thrift

#### 源安装

** 1、Install Boost ** Boost 下载地址:https://www.boost.org/

./bootstrap.sh
sudo ./b2 threading=multi address-model=64 variant=release stage install

** 2、Install libevent ** libevent 下载地址:http://libevent.org/

./configure --prefix=/usr/local
make
sudo make install

** 3、Building Apache Thrift **

./configure --prefix=/usr/local/ --with-boost=/usr/local --with-libevent=/usr/local

### 使用

1、pom文件导入thrift依赖

<!-- https://mvnrepository.com/artifact/org.apache.thrift/libthrift -->
<dependency>
    <groupId>org.apache.thrift</groupId>
    <artifactId>libthrift</artifactId>
    <version>0.11.0</version>
    <type>pom</type>
</dependency>


### 源码分析

参考 thrift官网 thrift-Github https://www.kancloud.cn/digest/thrift/


文章作者: Gumihoy
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 Gumihoy !
评论
 上一篇
python教程 python教程
Python(英国发音:/ˈpaɪθən/ 美国发音:/ˈpaɪθɑːn/),是一种动态的、面向对象的脚本语言。 目前,Python有两个版本,一个是2.x版,一个是3.x版,这两个版本是不兼容的,因为现在Python正在朝着3.x版本进化
2018-11-24
下一篇 
PyTorch教程 PyTorch教程
PyTorch是一个开源的Python机器学习库,基于Torch,应用于人工智能领域,如自然语言处理。 它最初由Facebook的人工智能研究团队开发,并且被用于Uber的概率编程软件”Pyro”。                     
2018-11-23
  目录