XiaodaBlogSource/source/_posts/对象存储.md
2025-07-23 17:28:36 +08:00

88 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: 对象存储
date: 2025-07-23 14:27:11
tags:
---
# RustFS
## 安装
### Docker
新建rustfs目录
```shell
mkdir ~/rustfs
cd ~/rustfs
```
编辑docker-compose.yml文件
```shell
vim docker-compose.yml
```
新增以下内容
```yaml
services:
rustfs:
image: 'rustfs/rustfs:latest'
container_name: 'rustfs'
restart: always
environment:
- 'TZ:Asia/Shanghai'
- 'RUSTFS_ACCESS_KEY=rustfsadmin'
- 'RUSTFS_SECRET_KEY=rustfsadmin'
- 'RUSTFS_CONSOLE_ENABLE=true'
- 'RUSTFS_TLS_PATH=/certs'
ports:
- '9000:9000'
volumes:
- /etc/localtime:/etc/localtime:ro
- /mnt/rustfs/data:/data
- /usr/ssl:/certs
command:
- "rustfs"
- "--console-enable"
- "--server-domains"
- "rustfs.wenyongdalucky.club"
```
:wq保存后退出
建立数据挂载目录
```shell
sudo mkdir -p /mnt/rustfs/data
```
`~/rustfs` 目录下使用Docker Compose启动容器
```shell
docker compose up -d
```
查看日志
```shell
docker logs rustfs -f
```
使用密钥登录的方式,输入账号、密钥
这里查看之前 docker-compose.yml文件中的 RUSTFS_ACCESS_KEY、RUSTFS_SECRET_KEY 进行登录即可。
这里就都输入 rustfsadmin登录
进入到控制台
创建存储桶 hexo
![image-20250723145626454](https://rustfs.wenyongdalucky.club:443/hexo/image-20250723145626454.png)
需将桶配置中的访问策略改为 公有防止无法通过Markdown访问
![image-20250723145728392](https://rustfs.wenyongdalucky.club:443/hexo/image-20250723145728392.png)