@@ -13,9 +13,9 @@ description: "使用 Linux 操作系统安装 RustFS 的快速指导"
1313
14141 . 请明确您的三种安装启用模式:
1515
16- 1 . [ 单机单盘模式(SNSD)] ( ./single-node-single-disk.md )
17- 2 . [ 单机多盘模式(SNMD)] ( ./single-node-multiple-disk.md )
18- 3 . [ 多机多盘模式(MNMD)] ( ./multiple-node-multiple-disk.md )
16+ 1 . 单机单盘模式(SNSD)
17+ 2 . 单机多盘模式(SNMD)
18+ 3 . 多机多盘模式(MNMD)
1919
20202 . [ 安装前检查] ( ../checklists/index.md ) ,确保各项指标符合生产指导特征,若不需要生产标准可不阅读此指导;
2121
@@ -25,7 +25,7 @@ description: "使用 Linux 操作系统安装 RustFS 的快速指导"
2525
26262 . 防火墙;
2727
28- 3 . 主机名 ;
28+ 3 . 主机别名或者域名解析 ;
2929
30304 . 内存条件;
3131
@@ -41,7 +41,7 @@ description: "使用 Linux 操作系统安装 RustFS 的快速指导"
4141
4242### 2.1. 操作系统版本
4343
44- 我们推荐 Linux 内核为 4.x 及以上的版本,但是 5.x 及以上的版本可以获得更好的 IO 吞吐和网络性能。
44+ 我们推荐 Linux 内核为 4.x 及以上的版本。因为, 5.x / 6.x 的版本可以获得更好的 IO 吞吐和网络性能。
4545
4646您可以使用 Ubuntu 22.04 和 RHEL8.x 来安装 RustFS。
4747
@@ -68,13 +68,21 @@ firewall-cmd --reload
6868```
6969部署中的所有 RustFS 服务器 ** 必须** 使用相同的监听端口。如果您使用的是 9000 端口,其他服务器的所有端口均需要为 9000 端口。
7070
71- ### 2.3 主机名
71+
72+
73+
74+
75+ ### 2.3 主机名(单机单盘和单机多盘可跳过此步骤)
7276
7377创建 RustFS 集群必须要使用 ** 相同的、具备连续性** 的主机名。有两种方式实现连续性的主机名:
7478
75- 1 . DNS 配置;
79+ ** 1. DNS 配置:**
80+
81+ 请配置你的DNS解析服务器,保障名字的连续性。
82+
83+ 2 . ** HOSTS 配置:**
7684
77- 2 . HOSTS 配置。
85+ 修改 /etc/hosts中的本地别名设置,具体操作如下:
7886
7987
8088``` bash
@@ -90,7 +98,8 @@ vim /etc/hosts
9098
9199### 2.4 内存条件
92100
93- RustFS 需要至少 2 GB 的内存来运行测试环境,生产的环境最低需要 64 GB 的内存。
101+ RustFS 需要至少 2 GB 的内存来运行测试环境,生产的环境最低需要 128 GB 的内存。
102+
94103
95104### 2.5 时间同步
96105
@@ -109,88 +118,97 @@ timedatectl status
109118
110119## 三、配置用户名
111120
112- RustFS 启动,我们建议您配置一个专门的无登录权限的用户进行启动 RustFS 的服务。在 rustfs.service 启动控制脚本中,默认的用户和用户组是 ` rustfs-user ` 和 ` rustfs-user ` 。
121+ RustFS 启动,我们建议您配置一个专门的无登录权限的用户进行启动 RustFS 的服务。在 rustfs.service 启动控制脚本中。
122+
123+ 1 . ** 不修改默认启动账户** :默认的用户和用户组是 ` root ` 和 ` root ` ,若您想使用默认的` root ` 和 ` root ` ,则不需要进行任何修改。
124+ 2 . ** 不修改默认启动账户** :您可以使用 groupadd 和 useradd 命令创建用户和组,添加后修改 systemctl 启动配置文件的用户名和密码。
125+
126+
127+ 以下示例是修改创建用户、组并设置权限以访问 RustFS 指定的数据目录(可选):
128+
129+ ~~~
130+ groupadd -r rustfs-user
131+ useradd -M -r -g rustfs-user rustfs-user
132+ chown rustfs-user:rustfs-user /data/rustfs*
133+ ~~~
134+
135+ 注意:
136+ - 如果创建了rustfs-user用户和组需要将 ` /etc/systemd/system/rustfs.service ` 中的User 和Group改为 ` rustfs-user ` ;
137+ - 将 ` /data/rustfs* ` 调整为指定的挂载目录。
138+
139+
113140
114- 您可以使用 groupadd 和 useradd 命令创建用户和组。以下示例创建用户、组并设置权限以访问 RustFS 指定的数据目录。
115141
116142## 四、下载安装包
117143
118144请先安装 wge 或者 curl 下载 rustfs 安装包。
119145
120146``` bash
121147# 下载地址
122- wget https://dl.rustfs.com/artifacts/rustfs/release/rustfs-linux-x86_64-latest.zip
123- unzip rustfs-linux-x86_64-latest.zip
148+ wget https://dl.rustfs.com/artifacts/rustfs/release/rustfs-linux-x86_64-musl- latest.zip
149+ unzip rustfs-linux-x86_64-musl- latest.zip
124150chmod +x rustfs
125151mv rustfs /usr/local/bin/
126152```
127153
128154
129155
130156### 五、配置环境变量
157+
158+
159+
1311601 . 创建配置文件
132161
133162
134163``` bash
164+ # 单机单盘模式
165+ sudo tee /etc/default/rustfs << EOF
166+ RUSTFS_ACCESS_KEY=rustfsadmin
167+ RUSTFS_SECRET_KEY=rustfsadmin
168+ RUSTFS_VOLUMES="/data/rustfs0"
169+ RUSTFS_ADDRESS=":9000"
170+ RUSTFS_CONSOLE_ENABLE=true
171+ RUST_LOG=error
172+ RUSTFS_OBS_LOG_DIRECTORY="/var/logs/rustfs/"
173+ EOF
174+ ```
175+
176+
177+ ``` bash
178+ # 单机多盘模式
135179sudo tee /etc/default/rustfs << EOF
136180RUSTFS_ACCESS_KEY=rustfsadmin
137181RUSTFS_SECRET_KEY=rustfsadmin
138182RUSTFS_VOLUMES="/data/rustfs{0...3}"
139183RUSTFS_ADDRESS=":9000"
140- #RUSTFS_SERVER_DOMAINS="play.rustfs.com:9000"
141184RUSTFS_CONSOLE_ENABLE=true
142- RUSTFS_OBS_ENDPOINT=""
143- RUSTFS_TLS_PATH ="/opt/tls "
185+ RUST_LOG=error
186+ RUSTFS_OBS_LOG_DIRECTORY ="/var/logs/rustfs/ "
144187EOF
145188```
146189
190+ ``` bash
191+ # 多机多盘模式
192+ sudo tee /etc/default/rustfs << EOF
193+ RUSTFS_ACCESS_KEY=rustfsadmin
194+ RUSTFS_SECRET_KEY=rustfsadmin
195+ RUSTFS_VOLUMES="http://node{1...4}:9000/data/rustfs{0...3}"
196+ RUSTFS_ADDRESS=":9000"
197+ RUSTFS_CONSOLE_ENABLE=true
198+ RUST_LOG=error
199+ RUSTFS_OBS_LOG_DIRECTORY="/var/logs/rustfs/"
200+ EOF
201+ ```
202+
203+
204+
1472052 . 创建存储目录
148206``` bash
149207sudo mkdir -p /data/rustfs{0..3} /var/logs/rustfs /opt/tls
150208sudo chmod -R 750 /data/rustfs* /var/logs/rustfs
151209```
152210
153- ### 六、配置可观测性系统
154- 1 . 创建观测配置文件
155- ```
156- export RUSTFS_OBS_ENDPOINT=http://localhost:4317 # OpenTelemetry Collector 的地址
157- export RUSTFS_OBS_USE_STDOUT=false # 是否使用标准输出
158- export RUSTFS_OBS_SAMPLE_RATIO=2.0 # 采样率,0.0-1.0之间,0.0表示不采样,1.0表示全部采样
159- export RUSTFS_OBS_METER_INTERVAL=1 # 采样间隔,单位为秒
160- export RUSTFS_OBS_SERVICE_NAME=rustfs # 服务名称
161- export RUSTFS_OBS_SERVICE_VERSION=0.1.0 # 服务版本
162- export RUSTFS_OBS_ENVIRONMENT=develop # 环境名称
163- export RUSTFS_OBS_LOGGER_LEVEL=debug # 日志级别,支持 trace, debug, info, warn, error
164- export RUSTFS_OBS_LOCAL_LOGGING_ENABLED=true # 是否启用本地日志记录
165- # 日志目录 当 `RUSTFS_OBS_ENDPOINT` 值为空时,默认执行下面的日志处理规则
166- export RUSTFS_OBS_LOG_DIRECTORY="$current_dir/deploy/logs" # Log directory
167- export RUSTFS_OBS_LOG_ROTATION_TIME="minute" # Log rotation time unit, can be "second", "minute", "hour", "day"
168- export RUSTFS_OBS_LOG_ROTATION_SIZE_MB=1 # Log rotation size in MB
169-
170- # 配置日志记录
171- export RUSTFS_SINKS_FILE_PATH="$current_dir/deploy/logs/rustfs.log"
172- export RUSTFS_SINKS_FILE_BUFFER_SIZE=12
173- export RUSTFS_SINKS_FILE_FLUSH_INTERVAL_MS=1000
174- export RUSTFS_SINKS_FILE_FLUSH_THRESHOLD=100
175- ```
176211
177- 2 . 设置日志轮转
178- ``` bash
179- sudo tee /etc/logrotate.d/rustfs << EOF
180- /var/logs/rustfs/*.log {
181- daily
182- rotate 7
183- missingok
184- notifempty
185- compress
186- delaycompress
187- sharedscripts
188- postrotate
189- systemctl restart rustfs >/dev/null 2>&1 || true
190- endscript
191- }
192- EOF
193- ```
194212
195213### 七、配置系统服务
1962141 . 创建 systemd 服务文件
@@ -273,15 +291,7 @@ curl -u rustfsadmin:rustfsadmin http://localhost:9000/
273291
2742925 . 查看日志文件
275293``` bash
276- tail -f /var/logs/rustfs/app.log
277- ```
278-
279- 6 . 测试存储接口(示例)
280- ``` bash
281- curl -X PUT -u rustfsadmin:rustfsadmin \
282- -H " Content-Type: application/octet-stream" \
283- --data-binary @testfile \
284- http://localhost:9000/bucket1/object1
294+ tail -f /var/logs/rustfs/rustfs* .log
285295```
286296
287297
0 commit comments