File tree Expand file tree Collapse file tree 2 files changed +85
-1
lines changed Expand file tree Collapse file tree 2 files changed +85
-1
lines changed Original file line number Diff line number Diff line change 74
74
- [ Docker 安装和使用] ( Docker-Install-And-Usage.md )
75
75
- [ LDAP 安装和使用] ( LDAP-Install-And-Settings.md )
76
76
- [ Alfresco 安装和使用] ( Alfresco-Install-And-Usage.md )
77
+ - [ Apache Thrift 安装和使用] ( Thrift-Install-And-Usage.md )
77
78
78
79
79
80
## 下一步(Next)
84
85
- ActiveMQ 服务安装和配置
85
86
- Zabbix 安装和配置
86
87
- Nagios 安装和配置
87
- - Docker 安装和配置
88
88
- sed 学习
89
89
- 常用脚本
90
90
Original file line number Diff line number Diff line change
1
+ ## Apache Thrift 安装和配置
2
+
3
+ - 官网下载:< https://thrift.apache.org/download >
4
+ - Apache 综合下载地(可以下载到旧版本):< http://archive.apache.org/dist/thrift/ >
5
+ - 一般我们建议下载 tar.gz 自己编译安装
6
+ - 安装所需的依赖等条件说明:< https://thrift.apache.org/docs/install/ >
7
+ - 源码安装方式说明:< https://thrift.apache.org/docs/BuildingFromSource >
8
+ - 现在最新的版本是:0.10.0,而我选的版本是:0.9.3,因为我目前各个语言大家用的最多的还是 0.9 系列的版本
9
+
10
+
11
+ ### 源码包安装方法
12
+
13
+ - 下载 0.9.3 的源码包:< http://archive.apache.org/dist/thrift/0.9.3/thrift-0.9.3.tar.gz >
14
+ - 安装依赖:` yum install -y autoconf automake libtool cmake ncurses-devel openssl-devel lzo-devel zlib-devel gcc gcc-c++ `
15
+ - 安装总流程:
16
+
17
+ ```
18
+ tar zxvf thrift-0.9.3.tar.gz
19
+
20
+ cd thrift-0.9.3
21
+
22
+ ./configure --without-tests
23
+
24
+ make
25
+
26
+ make install
27
+ ```
28
+
29
+ - 安装成功后,看下版本:` thrift --version `
30
+
31
+
32
+ ### Docker 方式直接使用
33
+
34
+ - 拉取镜像:` docker pull thrift:0.9.3 `
35
+ - 现在假设我们有一个 service.thrift 的配置文件,放在 /opt 目录下:/opt/service.thrift
36
+ - 现在我们要根据这个配置文件生成 java 类文件,把这些类 java 类生成到目录:/opt/thrift/data
37
+ - 这个需要可以使用下面命令:
38
+
39
+ ```
40
+ docker run -v "$PWD:/opt" thrift:0.9.3 thrift -o /opt/thrift/data --gen java /opt/service.thrift
41
+ ```
42
+
43
+ - 如果你没有 service.thrift 文件也无所谓,我们现在就来创建一个(里面的内容懂不懂都无所谓):
44
+
45
+ ```
46
+ namespace java com.gitnavi.service
47
+
48
+ struct User {
49
+ 1: i32 id
50
+ 2: string username
51
+ }
52
+
53
+ service UserService {
54
+ User getUser()
55
+ }
56
+ ```
57
+
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
+
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+
82
+
83
+
84
+
You can’t perform that action at this time.
0 commit comments