Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
140 changes: 122 additions & 18 deletions docs/zh/installation/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ RustFS 是一款高性能、100% 兼容 S3 的开源分布式对象存储系统
* 本地路径 `/mnt/rustfs/data`(或自定义路径)用于挂载对象数据
2. **网络与防火墙**

* 确保宿主机 7000 端口对外开放(或自定义端口一致)
* 确保宿主机 9000 端口对外开放(或自定义端口一致)
3. **配置文件准备**

* 在宿主机 `/etc/rustfs/config.toml` 中,定义监听端口、管理员账号、数据路径等(详见第四节)
Expand All @@ -34,12 +34,12 @@ RustFS 是一款高性能、100% 兼容 S3 的开源分布式对象存储系统
使用官方 Ubuntu 基础镜像,快束拉取 RustFS 官方镜像:

```bash
podman pull quay.io/rustfs/rustfs
docker pull quay.io/rustfs/rustfs
```

或者使用 docker 拉取:
```bash
podman pull docker://rustfs/rustfs
docker pull docker://rustfs/rustfs

Comment on lines +42 to 43
Copy link

Copilot AI Jul 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Using docker:// syntax is non-standard for Docker CLI. Recommend simplifying to docker pull rustfs/rustfs or docker pull quay.io/rustfs/rustfs.

Suggested change
docker pull docker://rustfs/rustfs
docker pull rustfs/rustfs

Copilot uses AI. Check for mistakes.
```

Expand All @@ -53,11 +53,11 @@ podman pull docker://rustfs/rustfs
RUSTFS_ROOT_USER=rustfsadmin
RUSTFS_ROOT_PASSWORD=rustfsadmin
RUSTFS_VOLUMES="/data/rustfs{0...3}"
RUSTFS_ADDRESS=":7000"
RUSTFS_ADDRESS=":9000"
#RUSTFS_SERVER_DOMAINS="play.rustfs.com:7000"
RUSTFS_CONSOLE_ENABLE=true
RUSTFS_CONSOLE_ADDRESS=":7001"
RUSTFS_OBS_CONFIG="/etc/default/obs.toml"
RUSTFS_CONSOLE_ADDRESS=":9001"
RUSTFS_OBS_ENDPOINT=""
RUSTFS_TLS_PATH="/opt/tls"
```

Expand All @@ -70,24 +70,128 @@ RUSTFS_TLS_PATH="/opt/tls"
RustFS SNSD Docker 运行方式,结合上述镜像与配置,执行:

```bash
podman run -d \
--name rustfs_local \
-p 7000:7000 \
-v /mnt/rustfs/data:/data \
-v /etc/rustfs/rustfs:/config/rustfs:ro \
rustfs/rustfs:latest
docker run -d \
--name rustfs_local \
-p 9000:9000 \
-p 9001:9001 \
-v /mnt/rustfs/data:/data \
rustfs/rustfs:latest \
/data
```

各参数说明:

* `-p 7000:7000`:映射宿主机 7000 端口到容器
* `-p 9000:9000`:映射宿主机 9000 端口到容器
* `-p 9001:9001`:映射宿主机 9001 端口到容器,用于 console 端访问
* `-v /mnt/rustfs/data:/data`:挂载数据卷
* `-v /etc/rustfs/rustfs:/config/rustfs:ro`:挂载配置文件
* `--name rustfs_local`:容器自定义名称
* `-d`: 后台运行
* `-d`:后台运行

---

### 完整参数配置示例

```bash
docker run -d \
--name rustfs_container \
-p 9000:9000 \
-p 9001:9001 \
-v /mnt/rustfs/data:/data \
-e RUSTFS_ACCESS_KEY=myaccesskey \
-e RUSTFS_SECRET_KEY=mysecretkey \
-e RUSTFS_CONSOLE_ENABLE=true \
-e RUSTFS_SERVER_DOMAINS=example.com \
rustfs/rustfs:latest \
./target/debug/rustfs \
Copy link

Copilot AI Jul 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specifying ./target/debug/rustfs inside the container assumes a locally built binary that may not exist. Use the container’s default entrypoint or ensure the path is valid inside the image.

Suggested change
./target/debug/rustfs \

Copilot uses AI. Check for mistakes.
--address :9000 \
--console-address :9001 \
--console-enable \
--server-domains example.com \
--access-key myaccesskey \
--secret-key mysecretkey \
/data
```

### 参数说明与对应方法

1. **环境变量方式** (推荐):
```bash
-e RUSTFS_ADDRESS=:9000 \
-e RUSTFS_SERVER_DOMAINS=example.com \
-e RUSTFS_ACCESS_KEY=myaccesskey \
-e RUSTFS_SECRET_KEY=mysecretkey \
-e RUSTFS_CONSOLE_ENABLE=true \
-e RUSTFS_CONSOLE_ADDRESS=:9001 \
```

2. **命令行参数方式**:
```
--address :9000 \
--server-domains example.com \
--access-key myaccesskey \
--secret-key mysecretkey \
--console-enable \
--console-address :9001 \
```

3. **必需参数**:
- `<VOLUMES>`: 在命令最后指定,如 `/data`

### 常用配置组合

1. **基础配置**:
```bash
docker run -d \
-p 9000:9000 \
-v /mnt/data:/data \
rustfs/rustfs:latest \
/data
```

2. **启用控制台**:
```bash
docker run -d \
-p 9000:9000 \
-p 9001:9001 \
-v /mnt/data:/data \
-e RUSTFS_CONSOLE_ENABLE=true \
rustfs/rustfs:latest \
./target/debug/rustfs \
--console-enable \
/data
```

3. **自定义认证密钥**:
```bash
docker run -d \
-p 9000:9000 \
-v /mnt/data:/data \
-e RUSTFS_ACCESS_KEY=admin123 \
-e RUSTFS_SECRET_KEY=secret123 \
rustfs/rustfs:latest \
./target/debug/rustfs \
--access-key admin123 \
--secret-key secret123 \
/data
```

### 注意事项

1. 端口映射要对应:
- 服务端口默认 9000 (`-p 9000:9000`)
- 控制台端口默认 9001 (`-p 9001:9001`)

2. 数据卷要持久化:
- `-v /host/path:/container/path`

3. 环境变量和命令行参数可以混合使用,但命令行参数优先级更高

4. 如果使用 TLS,需要额外挂载证书路径:
```bash
-v /path/to/certs:/certs \
-e RUSTFS_TLS_PATH=/certs \
```

## 五、验证与访问

1. **查看容器状态与日志:**
Expand All @@ -96,14 +200,14 @@ podman run -d \
docker logs rustfs_local
```

日志应显示服务启动成功,并监听 7000 端口。
日志应显示服务启动成功,并监听 9000 端口。

2. **测试 S3 API:**

使用 `mc` 或其他 S3 客户端:

```bash
mc alias set rustfs http://localhost:7000 rustfsadmin ChangeMe123!
mc alias set rustfs http://localhost:9000 rustfsadmin ChangeMe123!
mc mb rustfs/mybucket
mc ls rustfs
```
Expand All @@ -121,7 +225,7 @@ podman run -d \

2. 存储建议:
- 使用本地 SSD/NVMe 存储
- 避免使用网络文件系统(NFS)
- 避免使用网络文件系统 (NFS)
- 保证存储目录独占访问

---
Expand Down
87 changes: 37 additions & 50 deletions docs/zh/installation/linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ description: "使用 Linux 操作系统安装 RustFS 的快速指导"
# Linux 安装 RustFS


## 一、 安装前必读
## 一、安装前必读

本页面包含了 RustFS 的三种安装模式的全部文档和说明。其中,多机多盘的模式包含了企业级可用的性能、安全性和扩展性。并且,提供了生产工作负载需要的架构图。
请装前请阅读,我们的启动模式与检查清单,如下:

1. 启动模式, 前明确您的 Linux 启动模式;
1. 启动模式,前明确您的 Linux 启动模式;

2. 检查清单, 检查各项指标是否符合生产指导特征,若不需要生产标准可不阅读此指导;
2. 检查清单,检查各项指标是否符合生产指导特征,若不需要生产标准可不阅读此指导;


## 二、 先决条件
## 二、先决条件

1. 操作系统版本;

Expand Down Expand Up @@ -113,7 +113,7 @@ timedatectl status

RustFS 启动,我们建议您配置一个专门的无登录权限的用户进行启动 RustFS 的服务。在 rustfs.service 启动控制脚本中,默认的用户和用户组是 `rustfs-user` 和 `rustfs-user` 。

您可以使用 groupadd 和 useradd 命令创建用户和组. 以下示例创建用户、组并设置权限以访问 RustFS 指定的数据目录。
您可以使用 groupadd 和 useradd 命令创建用户和组以下示例创建用户、组并设置权限以访问 RustFS 指定的数据目录。

## 四、下载安装包

Expand All @@ -137,11 +137,11 @@ sudo tee /etc/default/rustfs <<EOF
RUSTFS_ROOT_USER=rustfsadmin
RUSTFS_ROOT_PASSWORD=rustfsadmin
RUSTFS_VOLUMES="/data/rustfs{0...3}"
RUSTFS_ADDRESS=":7000"
#RUSTFS_SERVER_DOMAINS="play.rustfs.com:7000"
RUSTFS_ADDRESS=":9000"
#RUSTFS_SERVER_DOMAINS="play.rustfs.com:9000"
RUSTFS_CONSOLE_ENABLE=true
RUSTFS_CONSOLE_ADDRESS=":7001"
RUSTFS_OBS_CONFIG="/etc/default/obs.toml"
RUSTFS_CONSOLE_ADDRESS=":9001"
RUSTFS_OBS_ENDPOINT=""
RUSTFS_TLS_PATH="/opt/tls"
EOF
```
Expand All @@ -154,43 +154,26 @@ sudo chmod -R 750 /data/rustfs* /var/logs/rustfs

### 六、配置可观测性系统
1. 创建观测配置文件
```bash
sudo tee /etc/default/obs.toml <<EOF
[observability]
endpoint = "http://localhost:4317"
use_stdout = false
sample_ratio = 2.0
meter_interval = 30
service_name = "rustfs"
service_version = "0.1.0"
environments = "production"
logger_level = "debug"
local_logging_enabled = true

[sinks]
[sinks.kafka]
enabled = false
bootstrap_servers = "localhost:9092"
topic = "logs"
batch_size = 100
batch_timeout_ms = 1000

[sinks.webhook]
enabled = false
endpoint = "http://localhost:8080/webhook"
auth_token = ""
batch_size = 100
batch_timeout_ms = 1000

[sinks.file]
enabled = true
path = "/var/logs/rustfs/app.log"
batch_size = 10
batch_timeout_ms = 1000

[logger]
queue_capacity = 10
EOF
```
export RUSTFS_OBS_ENDPOINT=http://localhost:4317 # OpenTelemetry Collector 的地址
export RUSTFS_OBS_USE_STDOUT=false # 是否使用标准输出
export RUSTFS_OBS_SAMPLE_RATIO=2.0 # 采样率,0.0-1.0之间,0.0表示不采样,1.0表示全部采样
export RUSTFS_OBS_METER_INTERVAL=1 # 采样间隔,单位为秒
export RUSTFS_OBS_SERVICE_NAME=rustfs # 服务名称
export RUSTFS_OBS_SERVICE_VERSION=0.1.0 # 服务版本
export RUSTFS_OBS_ENVIRONMENT=develop # 环境名称
export RUSTFS_OBS_LOGGER_LEVEL=debug # 日志级别,支持 trace, debug, info, warn, error
export RUSTFS_OBS_LOCAL_LOGGING_ENABLED=true # 是否启用本地日志记录
# 日志目录 当 `RUSTFS_OBS_ENDPOINT` 值为空时,默认执行下面的日志处理规则
export RUSTFS_OBS_LOG_DIRECTORY="$current_dir/deploy/logs" # Log directory
export RUSTFS_OBS_LOG_ROTATION_TIME="minute" # Log rotation time unit, can be "second", "minute", "hour", "day"
export RUSTFS_OBS_LOG_ROTATION_SIZE_MB=1 # Log rotation size in MB

# 配置日志记录
export RUSTFS_SINKS_FILE_PATH="$current_dir/deploy/logs/rustfs.log"
export RUSTFS_SINKS_FILE_BUFFER_SIZE=12
export RUSTFS_SINKS_FILE_FLUSH_INTERVAL_MS=1000
export RUSTFS_SINKS_FILE_FLUSH_THRESHOLD=100
```

2. 设置日志轮转
Expand Down Expand Up @@ -229,7 +212,7 @@ Group=root

WorkingDirectory=/usr/local
EnvironmentFile=-/etc/default/rustfs
ExecStart=/usr/local/bin/rustfs \$RUSTFS_VOLUMES \$RUSTFS_OPTS
ExecStart=/usr/local/bin/rustfs \$RUSTFS_VOLUMES

LimitNOFILE=1048576
LimitNPROC=32768
Expand All @@ -256,6 +239,10 @@ ProtectControlGroups=true
RestrictSUIDSGID=true
RestrictRealtime=true

# service log configuration
StandardOutput=append:/var/logs/rustfs/rustfs.log
StandardError=append:/var/logs/rustfs/rustfs-err.log

[Install]
WantedBy=multi-user.target
EOF
Expand All @@ -279,12 +266,12 @@ systemctl status rustfs

3. 检查服务端口
```bash
ss -tunlp | grep -E '7000|7001'
ss -tunlp | grep -E '9000|9001'
```

4. 验证控制台访问
```bash
curl -u rustfsadmin:rustfsadmin http://localhost:7001/metrics
curl -u rustfsadmin:rustfsadmin http://localhost:9001/metrics
```

5. 查看日志文件
Expand All @@ -297,7 +284,7 @@ tail -f /var/logs/rustfs/app.log
curl -X PUT -u rustfsadmin:rustfsadmin \
-H "Content-Type: application/octet-stream" \
--data-binary @testfile \
http://localhost:7000/bucket1/object1
http://localhost:9000/bucket1/object1
```