Skip to content

Commit df2fe24

Browse files
withchaoBloomingg
andauthored
feat: add s3 doc (#235)
* fix: remove the deleted method from the document * fix: doc * fix: doc en path * fix: doc en path * fix: link path update * feat: s3 doc --------- Co-authored-by: Bloomingg <1293499952@qq.com>
1 parent bb9c147 commit df2fe24

1 file changed

Lines changed: 119 additions & 0 deletions

File tree

docs/guides/solution/s3.mdx

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
---
2+
title: '如何接入S3存储'
3+
sidebar_position: 8
4+
5+
---
6+
7+
# S3存储接入
8+
9+
- OpenIM支持接入多种S3存储服务,包括:MINIO、阿里云OSS、腾讯云COS、七牛云KODO以及AWS,为开发者提供了广泛的选择。
10+
- 文件通过SDK直接上传至S3存储,避免经过API服务器,从而显著提升服务端性能。
11+
- 如果需要接入其他S3存储类型,也完全支持扩展。只需在服务端实现对应接口,无需对SDK进行任何修改。[接口地址](https://github.com/openimsdk/tools/blob/main/s3/s3.go)
12+
- 访问时调用的API地址仅用于将请求重定向至真实的S3存储地址,同时可在此阶段加入与业务相关的权限校验,确保数据安全性和业务灵活性。
13+
14+
-`config/openim-rpc-third.yml` 文件中的 `object.enable: <name>` 修改为 `minio``oss``cos``kodo``aws`
15+
```yaml
16+
object:
17+
enable: minio
18+
```
19+
20+
# MINIO
21+
22+
1. 修改 config/minio.yml 文件中的 externalAddress 为你的应用访问地址,服务器无需能访问此地址。
23+
```yaml
24+
# 中的存储桶名称
25+
bucket: openim
26+
# 身份验证的访问密钥ID
27+
accessKeyID: root
28+
# 身份验证的访问密钥
29+
secretAccessKey: openIM123
30+
# 身份验证的会话令牌(可选)
31+
sessionToken:
32+
# 服务器的内部地址
33+
internalAddress: localhost:10005
34+
# 服务器的外部地址,可从外部访问,支持使用域名的HTTP和HTTPS
35+
externalAddress: http://external_ip:10005
36+
# 是否启用存储桶的公共读权限
37+
publicRead: false
38+
```
39+
40+
41+
# 阿里云OSS
42+
1. OSS创建存储桶地址: https://oss.console.aliyun.com/bucket
43+
2. AccessKey生成地址: https://ram.console.aliyun.com/profile/access-keys
44+
3. 官方文档: https://help.aliyun.com/zh/oss/developer-reference/overview-25/?spm=a2c4g.11186623.0.i3
45+
4. 修改`config/openim-rpc-third.yml`文件`object.oss`。
46+
```yaml
47+
# OSS数据中心端点,例如 http://oss-cn-hangzhou.aliyuncs.com .
48+
endpoint:
49+
# 存储桶名称
50+
bucket:
51+
# 存储桶URL
52+
bucketURL:
53+
# 访问密钥ID
54+
accessKeyID:
55+
# 访问密钥Secret
56+
accessKeySecret:
57+
# 公共读取模式,建议设置为false,否则无法设置下载的Content-Type和文件名
58+
publicRead: false
59+
```
60+
61+
# 腾讯云COS
62+
1. COS创建存储桶地址: https://console.cloud.tencent.com/cos5/bucket
63+
2. AccessKey生成地址: https://console.cloud.tencent.com/cam/capi
64+
3. 官方文档: https://cloud.tencent.com/document/product/436/7751
65+
4. 修改`config/openim-rpc-third.yml`文件`object.cos`
66+
```yaml
67+
# 存储桶URL
68+
bucketURL:
69+
# 访问密钥ID
70+
secretID:
71+
# 访问密钥Secret
72+
secretKey:
73+
# 公共读取模式,建议设置为false,否则无法设置下载的Content-Type和文件名
74+
publicRead: false
75+
```
76+
77+
# 七牛云KODO
78+
1. KODO创建存储桶地址: https://portal.qiniu.com/kodo/bucket
79+
2. AccessKey生成地址: https://portal.qiniu.com/developer/user/key
80+
3. 官方文档: https://developer.qiniu.com/kodo/1644/security
81+
4. 修改`config/openim-rpc-third.yml`文件`object.kodo`
82+
```yaml
83+
# 七牛云KODO的Endpoint地址,例如:http://s3.cn-south-1.qiniucs.com
84+
endpoint:
85+
# 存储桶名称
86+
bucket: kodo-bucket-test
87+
# 存储桶URL
88+
bucketURL: http://kodo-bucket-test-oetobfb.qiniudns.com
89+
# 访问密钥ID
90+
accessKeyID:
91+
# 访问密钥Secret
92+
accessKeySecret:
93+
# 会话令牌(可选)
94+
sessionToken:
95+
# 公共读取模式,建议设置为false,否则无法设置下载的Content-Type和文件名
96+
publicRead: false
97+
```
98+
99+
100+
# AWS
101+
1. 区域文档: http://docs.aws.amazon.com/general/latest/gr/rande.html
102+
2. AWS创建存储桶地址: https://s3.console.aws.amazon.com/s3/home
103+
3. AccessKey生成地址: https://console.aws.amazon.com/iam/home?#/security_credentials
104+
4. 官方文档: https://docs.aws.amazon.com/zh_cn/AmazonS3/latest/userguide/Welcome.html
105+
修改`config/openim-rpc-third.yml`文件`object.aws`
106+
```yaml
107+
# 发送请求的区域,参考:http://docs.aws.amazon.com/general/latest/gr/rande.html
108+
region:
109+
# 存储桶名称
110+
bucket:
111+
# AWS访问密钥ID
112+
accessKeyID:
113+
# AWS访问密钥Secret
114+
secretAccessKey:
115+
# AWS会话令牌
116+
sessionToken:
117+
# 公共读取模式,建议设置为false,否则无法设置下载的Content-Type和文件名
118+
publicRead: false
119+
```

0 commit comments

Comments
 (0)