diff --git a/docs/4.0/docs/guides/objectstorage/images/1.png b/docs/4.0/docs/guides/objectstorage/images/1.png new file mode 100644 index 00000000000..703fe96200f Binary files /dev/null and b/docs/4.0/docs/guides/objectstorage/images/1.png differ diff --git a/docs/4.0/docs/guides/objectstorage/images/10.png b/docs/4.0/docs/guides/objectstorage/images/10.png new file mode 100644 index 00000000000..e636144a8ee Binary files /dev/null and b/docs/4.0/docs/guides/objectstorage/images/10.png differ diff --git a/docs/4.0/docs/guides/objectstorage/images/11.png b/docs/4.0/docs/guides/objectstorage/images/11.png new file mode 100644 index 00000000000..771f415a78f Binary files /dev/null and b/docs/4.0/docs/guides/objectstorage/images/11.png differ diff --git a/docs/4.0/docs/guides/objectstorage/images/12.png b/docs/4.0/docs/guides/objectstorage/images/12.png new file mode 100644 index 00000000000..76c1487cf46 Binary files /dev/null and b/docs/4.0/docs/guides/objectstorage/images/12.png differ diff --git a/docs/4.0/docs/guides/objectstorage/images/13.png b/docs/4.0/docs/guides/objectstorage/images/13.png new file mode 100644 index 00000000000..5abeca82fce Binary files /dev/null and b/docs/4.0/docs/guides/objectstorage/images/13.png differ diff --git a/docs/4.0/docs/guides/objectstorage/images/2.png b/docs/4.0/docs/guides/objectstorage/images/2.png new file mode 100644 index 00000000000..25d649f88c7 Binary files /dev/null and b/docs/4.0/docs/guides/objectstorage/images/2.png differ diff --git a/docs/4.0/docs/guides/objectstorage/images/3.png b/docs/4.0/docs/guides/objectstorage/images/3.png new file mode 100644 index 00000000000..176138f21cc Binary files /dev/null and b/docs/4.0/docs/guides/objectstorage/images/3.png differ diff --git a/docs/4.0/docs/guides/objectstorage/images/4.png b/docs/4.0/docs/guides/objectstorage/images/4.png new file mode 100644 index 00000000000..acbf8f0358b Binary files /dev/null and b/docs/4.0/docs/guides/objectstorage/images/4.png differ diff --git a/docs/4.0/docs/guides/objectstorage/images/5.png b/docs/4.0/docs/guides/objectstorage/images/5.png new file mode 100644 index 00000000000..52bb97ac553 Binary files /dev/null and b/docs/4.0/docs/guides/objectstorage/images/5.png differ diff --git a/docs/4.0/docs/guides/objectstorage/images/6.png b/docs/4.0/docs/guides/objectstorage/images/6.png new file mode 100644 index 00000000000..d9f63a24dd9 Binary files /dev/null and b/docs/4.0/docs/guides/objectstorage/images/6.png differ diff --git a/docs/4.0/docs/guides/objectstorage/images/7.png b/docs/4.0/docs/guides/objectstorage/images/7.png new file mode 100644 index 00000000000..b5a7d5ea362 Binary files /dev/null and b/docs/4.0/docs/guides/objectstorage/images/7.png differ diff --git a/docs/4.0/docs/guides/objectstorage/images/8.png b/docs/4.0/docs/guides/objectstorage/images/8.png new file mode 100644 index 00000000000..e0bb62a7b74 Binary files /dev/null and b/docs/4.0/docs/guides/objectstorage/images/8.png differ diff --git a/docs/4.0/docs/guides/objectstorage/images/9.png b/docs/4.0/docs/guides/objectstorage/images/9.png new file mode 100644 index 00000000000..f2284d0f79b Binary files /dev/null and b/docs/4.0/docs/guides/objectstorage/images/9.png differ diff --git a/docs/4.0/docs/guides/objectstorage/objectstorage.md b/docs/4.0/docs/guides/objectstorage/objectstorage.md new file mode 100644 index 00000000000..f778f59b262 --- /dev/null +++ b/docs/4.0/docs/guides/objectstorage/objectstorage.md @@ -0,0 +1,176 @@ +--- +sidebar_position: 0 +--- + +# Object Storage + +**Object Storage** is Sealos' built-in object storage service, which is primarily used to store and manage unstructured +data. + +Currently, **Object Storage** has the following features: + +- Upload files to bucket +- Download files from bucket +- Expose the access permission of the bucket +- Use SDK to access bucket +- Monitors bucket resource metrics + +## Quick start + +### Upload files to bucket + +Go to Object Storage +![](./images/1.png) + +Create a bucket +![](./images/2.png) + +Set bucket name to test and permission to private +![](./images/3.png) + +Bucket is created successfully +![](./images/4.png) + +Upload file +![](./images/5.png) + +File uploaded successfully +![](./images/6.png) + +### Expose the access permission of the bucket + +Click the Edit button +![](./images/7.png) + +Set Bucket Permission to publicRead and click the Application button +![](./images/8.png) + +Copy file link +![](./images/9.png) + +Paste to browser address bar to access files +![](./images/10.png) + +### View the access key configuration + +An Object Storage user consists of a unique access key (username) and corresponding secret key (password). Internal is +the internal access address of Object Storage, and External is the external access address of Object Storage. +![](./images/11.png) + +### Use SDK to access bucket + +The SDK requires three parameters to access bucket: AccessKey, SecretKey, and Endpoint (Internal or External). If the +Region parameter is required, us-east-1 is used by default. + +#### Go Client SDK + +Detailed documentation reference: https://min.io/docs/minio/linux/developers/go/API.html + +Example: Use the Go Client SDK to upload the style.css file to the sv3dd7u4-test bucket, and set the endpoint to the +external address. If the service is deployed in the K8s cluster, you can change the endpoint to the internal address. + +```go +package main + +import ( + "context" + "fmt" + "log" + "os" +) +import "github.com/minio/minio-go/v7" +import "github.com/minio/minio-go/v7/pkg/credentials" + +func main() { + endpoint := "objectstorageapi.xxx.xxx.xxx" + accessKey := "xxxxxxxx" + secretKey := "xxxxxxxxxxxxxxxx" + // init minio client + minioClient, err := minio.New(endpoint, &minio.Options{ + Creds: credentials.NewStaticV4(accessKey, secretKey, ""), + }) + if err != nil { + log.Fatalln(err) + } + // get local file + file, err := os.Open("./style.css") + if err != nil { + fmt.Println(err) + return + } + defer file.Close() + + fileStat, err := file.Stat() + if err != nil { + fmt.Println(err) + return + } + // put object + uploadInfo, err := minioClient.PutObject(context.Background(), "sv3dd7u4-test", "style.css", file, fileStat.Size(), minio.PutObjectOptions{ContentType: "text/css"}) + if err != nil { + fmt.Println(err) + return + } + fmt.Println("Successfully uploaded bytes: ", uploadInfo) +} +``` + +File uploaded successfully +![](./images/12.png) + +#### Java Client SDK + +Detailed documentation reference: https://min.io/docs/minio/linux/developers/java/API.html + +Example: Use the Java Client SDK to upload the style1.css file to the sv3dd7u4-test bucket, and set the endpoint to the +external address. If the service is deployed in the K8s cluster, you can change the endpoint to the internal address. + +```xml + + + io.minio + minio + 8.5.9 + +``` + +```javascript +package org.example; + +import io.minio.MinioClient; +import io.minio.UploadObjectArgs; + +public class FileUploader { + public static void main(String[] args) throws Exception { + + MinioClient minioClient = + MinioClient.builder() + .endpoint("https://objectstorageapi.xxx.xxx.xxx") + .credentials("xxxxxxxx", "xxxxxxxxxxxxxxxx") + .build(); + + + minioClient.uploadObject( + UploadObjectArgs.builder() + .bucket("sv3dd7u4-test") + .object("style1.css") + .filename("src/main/java/org/example/style1.css") + .build()); + + System.out.println("Successfully uploaded bytes."); + } +} +``` + +File uploaded successfully +![](./images/13.png) + +#### Omit other language SDK + +Detailed documentation reference: https://min.io/docs/minio/linux/developers/minio-drivers.html + + + + + + diff --git a/docs/4.0/i18n/zh-Hans/guides/objectstorage/images/1.png b/docs/4.0/i18n/zh-Hans/guides/objectstorage/images/1.png new file mode 100644 index 00000000000..3ff6dfa9b02 Binary files /dev/null and b/docs/4.0/i18n/zh-Hans/guides/objectstorage/images/1.png differ diff --git a/docs/4.0/i18n/zh-Hans/guides/objectstorage/images/10.png b/docs/4.0/i18n/zh-Hans/guides/objectstorage/images/10.png new file mode 100644 index 00000000000..e636144a8ee Binary files /dev/null and b/docs/4.0/i18n/zh-Hans/guides/objectstorage/images/10.png differ diff --git a/docs/4.0/i18n/zh-Hans/guides/objectstorage/images/11.png b/docs/4.0/i18n/zh-Hans/guides/objectstorage/images/11.png new file mode 100644 index 00000000000..12624610f67 Binary files /dev/null and b/docs/4.0/i18n/zh-Hans/guides/objectstorage/images/11.png differ diff --git a/docs/4.0/i18n/zh-Hans/guides/objectstorage/images/12.png b/docs/4.0/i18n/zh-Hans/guides/objectstorage/images/12.png new file mode 100644 index 00000000000..4ae45dedc78 Binary files /dev/null and b/docs/4.0/i18n/zh-Hans/guides/objectstorage/images/12.png differ diff --git a/docs/4.0/i18n/zh-Hans/guides/objectstorage/images/13.png b/docs/4.0/i18n/zh-Hans/guides/objectstorage/images/13.png new file mode 100644 index 00000000000..e3cc905cd04 Binary files /dev/null and b/docs/4.0/i18n/zh-Hans/guides/objectstorage/images/13.png differ diff --git a/docs/4.0/i18n/zh-Hans/guides/objectstorage/images/2.png b/docs/4.0/i18n/zh-Hans/guides/objectstorage/images/2.png new file mode 100644 index 00000000000..386fb07680d Binary files /dev/null and b/docs/4.0/i18n/zh-Hans/guides/objectstorage/images/2.png differ diff --git a/docs/4.0/i18n/zh-Hans/guides/objectstorage/images/3.png b/docs/4.0/i18n/zh-Hans/guides/objectstorage/images/3.png new file mode 100644 index 00000000000..3e17d0f6863 Binary files /dev/null and b/docs/4.0/i18n/zh-Hans/guides/objectstorage/images/3.png differ diff --git a/docs/4.0/i18n/zh-Hans/guides/objectstorage/images/4.png b/docs/4.0/i18n/zh-Hans/guides/objectstorage/images/4.png new file mode 100644 index 00000000000..17ffbdd8d58 Binary files /dev/null and b/docs/4.0/i18n/zh-Hans/guides/objectstorage/images/4.png differ diff --git a/docs/4.0/i18n/zh-Hans/guides/objectstorage/images/5.png b/docs/4.0/i18n/zh-Hans/guides/objectstorage/images/5.png new file mode 100644 index 00000000000..61c1098e18a Binary files /dev/null and b/docs/4.0/i18n/zh-Hans/guides/objectstorage/images/5.png differ diff --git a/docs/4.0/i18n/zh-Hans/guides/objectstorage/images/6.png b/docs/4.0/i18n/zh-Hans/guides/objectstorage/images/6.png new file mode 100644 index 00000000000..4f8e59ec725 Binary files /dev/null and b/docs/4.0/i18n/zh-Hans/guides/objectstorage/images/6.png differ diff --git a/docs/4.0/i18n/zh-Hans/guides/objectstorage/images/7.png b/docs/4.0/i18n/zh-Hans/guides/objectstorage/images/7.png new file mode 100644 index 00000000000..65a4e96dbca Binary files /dev/null and b/docs/4.0/i18n/zh-Hans/guides/objectstorage/images/7.png differ diff --git a/docs/4.0/i18n/zh-Hans/guides/objectstorage/images/8.png b/docs/4.0/i18n/zh-Hans/guides/objectstorage/images/8.png new file mode 100644 index 00000000000..827eb00383d Binary files /dev/null and b/docs/4.0/i18n/zh-Hans/guides/objectstorage/images/8.png differ diff --git a/docs/4.0/i18n/zh-Hans/guides/objectstorage/images/9.png b/docs/4.0/i18n/zh-Hans/guides/objectstorage/images/9.png new file mode 100644 index 00000000000..6ba91e30a63 Binary files /dev/null and b/docs/4.0/i18n/zh-Hans/guides/objectstorage/images/9.png differ diff --git a/docs/4.0/i18n/zh-Hans/guides/objectstorage/objectstorage.md b/docs/4.0/i18n/zh-Hans/guides/objectstorage/objectstorage.md new file mode 100644 index 00000000000..8cedb7b04ec --- /dev/null +++ b/docs/4.0/i18n/zh-Hans/guides/objectstorage/objectstorage.md @@ -0,0 +1,175 @@ +--- +sidebar_position: 0 +--- + +# 对象存储 + +「对象存储」是 Sealos 内置的对象存储服务,主要用于存储和管理非结构化数据。 + +目前「对象存储」具备以下功能: + +- 上传文件到「存储桶」 +- 从「存储桶」下载文件 +- 公开「存储桶」的访问权限 +- 使用 SDK 访问「存储桶」 +- 监控「存储桶」资源指标 + +## 快速开始 + +### 上传文件 + +进入「对象存储」 +![](./images/1.png) + +创建「存储桶」 +![](./images/2.png) + +设置「存储桶」名字为 test,权限为 private +![](./images/3.png) + +「存储桶」创建成功 +![](./images/4.png) + +上传文件 +![](./images/5.png) + +上传文件成功 +![](./images/6.png) + +### 公开「存储桶」的访问权限 + +点击「编辑」 +![](./images/7.png) + +设置「存储桶权限」为 publicRead,点击「应用」 +![](./images/8.png) + +复制文件链接 +![](./images/9.png) + +粘贴到浏览器地址栏访问文件 +![](./images/10.png) + +### 查看访问密钥配置 + +对象存储用户由唯一的 Access Key(用户名)和对应的 Secret Key(密码)组成。Internal 为对象存储的内部访问地址,External +为对象存储的外部访问地址。 +![](./images/11.png) + +### 使用 SDK 访问「存储桶」 + +SDK 访问「存储桶」需要三个参数:AccessKey、SecretKey、Endpoint。参数都在访问密钥中,Internal 是内网地址 Endpoint,External 是外网地址 +Endpoint。如果需要使用 Region 参数,默认使用 us-east-1。 + +#### Go Client SDK + +详细文档参考:https://min.io/docs/minio/linux/developers/go/API.html + +例子:使用 Go Client SDK 上传 style.css 文件到 sv3dd7u4-test 存储桶,将 Endpoint 设置为外网地址 External。如果服务部署在当前 +K8s 集群内,可以将 Endpoint 改为内网地址 Internal。 + +```go +package main + +import ( + "context" + "fmt" + "log" + "os" +) +import "github.com/minio/minio-go/v7" +import "github.com/minio/minio-go/v7/pkg/credentials" + +func main() { + endpoint := "objectstorageapi.xxx.xxx.xxx" + accessKey := "xxxxxxxx" + secretKey := "xxxxxxxxxxxxxxxx" + // init minio client + minioClient, err := minio.New(endpoint, &minio.Options{ + Creds: credentials.NewStaticV4(accessKey, secretKey, ""), + }) + if err != nil { + log.Fatalln(err) + } + // get local file + file, err := os.Open("./style.css") + if err != nil { + fmt.Println(err) + return + } + defer file.Close() + + fileStat, err := file.Stat() + if err != nil { + fmt.Println(err) + return + } + // put object + uploadInfo, err := minioClient.PutObject(context.Background(), "sv3dd7u4-test", "style.css", file, fileStat.Size(), minio.PutObjectOptions{ContentType: "text/css"}) + if err != nil { + fmt.Println(err) + return + } + fmt.Println("Successfully uploaded bytes: ", uploadInfo) +} +``` + +文件上传成功 +![](./images/12.png) + +#### Java Client SDK + +详细文档参考:https://min.io/docs/minio/linux/developers/java/API.html + +例子:使用 Java Client SDK 上传 style1.css 文件到 sv3dd7u4-test 存储桶,将 Endpoint 设置为外网地址 External。如果服务部署在当前 +K8s 集群内,可以将 Endpoint 改为内网地址 Internal。 + +```xml + + + io.minio + minio + 8.5.9 + +``` + +```javascript +package org.example; + +import io.minio.MinioClient; +import io.minio.UploadObjectArgs; + +public class FileUploader { + public static void main(String[] args) throws Exception { + + MinioClient minioClient = + MinioClient.builder() + .endpoint("https://objectstorageapi.xxx.xxx.xxx") + .credentials("xxxxxxxx", "xxxxxxxxxxxxxxxx") + .build(); + + + minioClient.uploadObject( + UploadObjectArgs.builder() + .bucket("sv3dd7u4-test") + .object("style1.css") + .filename("src/main/java/org/example/style1.css") + .build()); + + System.out.println("Successfully uploaded bytes."); + } +} +``` + +文件上传成功 +![](./images/13.png) + +#### 其他语言 SDK 略 + +详细文档参考:https://min.io/docs/minio/linux/developers/minio-drivers.html + + + + + +