原因 之前使用的一直都是minio 已经不更新补丁了,最近看到Rustfs大家都在推荐,就想试一下,好像是1.0版本构建成功了现在在生产环境使用也是可以的。
迁移过程 我是用了一个中转的机器先使用docker部署了测试环境
注意事项 需要因为Rustfs的数据目录使用的是10001用户,需要提前将权限设置好。
sudo chown -R 10001:10001 ./data
rustfs部署 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 services: rustfs: image: rustfs/rustfs:latest container_name: rustfs-server security_opt: - "no-new-privileges:true" ports: - "9000:9000" - "9001:9001" environment: - RUSTFS_VOLUMES=/data/rustfs0 - RUSTFS_ADDRESS=0.0 .0.0 :9000 - RUSTFS_CONSOLE_ADDRESS=0.0 .0.0 :9001 - RUSTFS_CONSOLE_ENABLE=true - RUSTFS_CORS_ALLOWED_ORIGINS=* - RUSTFS_CONSOLE_CORS_ALLOWED_ORIGINS=* - RUSTFS_ACCESS_KEY=rustfsadmin - RUSTFS_SECRET_KEY=rustfsadmin - RUSTFS_OBS_LOGGER_LEVEL=info volumes: - ./data/:/data - ./logs/:/app/logs networks: - rustfs-network restart: unless-stopped healthcheck : test: ["CMD" , "sh" , "-c" , "curl -f http://localhost:9000/health && curl -f http://localhost:9001/health" ] interval: 30 s timeout: 10 s retries: 3 start_period: 40 s networks: rustfs-network: driver: bridge
访问登录界面,输入RUSTFS_ACCESS_KEY的密钥登录API管理界面查看是否配置成功。
注意:如果你要重置密码 需要先将data/.rustfs.sys/ 进行删除 该文件夹为隐藏文件夹。若不删除直接修改访问密钥重构镜像仍然使用的原来的密码
安装mc进行迁移 然后在测试机器安装了mc来进行迁移,ubuntu自带的mc好像是个文件管理工具,需要注意一下
1 2 3 4 5 6 7 8 9 10 11 sudo curl -sL https://dl.min.io/client/mc/release/linux-amd64/mc -o /usr/local/bin/mc sudo chmod +x /usr/local/bin/mc mc --version /usr/local/bin# mc --version mc version RELEASE.2025-08-13T08-35-41Z (commit-id=7394ce0dd2a80935aded936b09fa12cbb3cb8096) Runtime: go1.24.6 linux/amd64 Copyright (c) 2015-2025 MinIO, Inc. License GNU AGPLv3 <https://www.gnu.org/licenses/agpl-3.0.html>
然后执行同步。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 mc alias set minio http://10.0.0.1:9000 aaaaaaaa bbbbbbbb mc alias set rustfs http://127.0.0.1:9002 rustfsadmin rustfsadmin mc mirror --overwrite minio/ rustfs/ /usr/local/bin# mc alias set rustfs http://127.0.0.1:9002 rustfsadmin rustfsadmin Added `rustfs` successfully. /usr/local/bin# mc mirror --overwrite minio/ rustfs/ ...o/refs/latest: 394.11 MiB / 394.11 MiB ┃▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓┃ 8.38 MiB/s 47s
API访问密钥的权限参考 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 { "Version": "2012-10-17" , "Statement": [ { "Effect": "Allow" , "Action": [ "s3:ListBucket" , "s3:GetBucketLocation" ], "Resource": [ "arn:aws:s3:::siyuan" ] }, { "Effect": "Allow" , "Action": [ "s3:GetObject" , "s3:PutObject" , "s3:DeleteObject" ], "Resource": [ "arn:aws:s3:::siyuan/*" ] } ] }