✨
RPC服务框架
  • RPC服务框架
  • Dubbo
    • Dubbo简介
    • Dubbo技术原理
    • Dubbo配置使用
    • Dubbo控制台
    • 测验
  • gRPC
    • gRPC简介
    • gRPC配置及使用
    • grpc架构及原理
    • 测验
  • Protocol Buffers
    • Protocol Buffers简介
  • Thrift
    • Thrift简介
    • Thrift环境搭建
    • Thrift项目实现
    • Thrift架构及原理
    • Thrift类型系统
    • 待整理
    • 测验
  • spring cloud
    • Spring Cloud简介
Powered by GitBook
On this page
  • 步骤
  • 下载thfift
  • 安装编译器
  • 编写.thrift 文件

Was this helpful?

  1. Thrift

Thrift环境搭建

PreviousThrift简介NextThrift项目实现

Last updated 4 years ago

Was this helpful?

步骤

下载thfift

https://thrift.apache.org/download

安装编译器

根据不同系统选择安装脚本

注意事项

本机测试使用mac os

按照上面脚本分别下载安装 boost 、 libevent 编译thrift

可能会遇到的问题

需要提前安装 gcc

brew install gcc

提示 bison版本过低

brew install bison
export PATH="$(brew --prefix bison)/bin:$PATH"

最后编译thrift成功 但没有编译出java库?

所以最后 实际上 使用homebrew几秒钟安装完成?

brew install thrift
export PATH="$(brew --prefix thrift)/bin:$PATH"

编写.thrift 文件

通过IDL编写thrift types 和 service 这个service是需要被服务端实现 并且被客户端调用的

通过下面命令生成你所使用的语言代码

thrift --gen <language> <Thrift filename>

hello.thrift

namespace java top.lilixin.thrift.service

service  GreetingService {
  string sayHello(1:string name)
}
thrift -gen java hello.thrift

执行上面指令 得到 GreetingService.java文件

https://thrift.apache.org/docs/install/