Minio过期分片上传文件清理引出的系统配置
上篇文章【SpringBoot通過Minio實現大文件分片上傳】中,很多問到了關于分片上傳,未使用過期的歷史分片如何清理的問題,其實官方默認有策略會定時清理歷史過期臨時文件,查了一下發現這方便資料非常少,而且官方文檔也沒有說明,于是帶著問題查詢了下Minio相關的配置才引出這篇文章。
查詢到的資料有限,本文章主要說明以下幾個方便:
1. 過期分片是否會自動清理
答案顯而易見,臨時上傳的分片,會被定時清理。否則隨著時間推移,垃圾定會越積越多。那么問題又來了,有些系統用戶量大,系統調用頻繁可能堆積速度快,那么是否可配置清理頻率呢?
2. 清理策略是否可配置
查詢到官方github已有優秀的用戶反饋并提交了部分清理策略修改的PR請求(感興趣的可查看:fix: allow configuring cleanup of stale multipart uploads),并已合并到主分支,如果使用可更新到該版本(RELEASE.2021-10-06T23-36-31Z)之后的新版本。
在此可查看此版本更新內容:
RELEASE.2021-10-06T23-36-31Z
其中包含一條即為:
- Allow configuring cleanup of stale multipart uploads. See (#13354) for more details.
此時,我們發現可通過配置部分清理策略,那么接下來看如果使用這些配置,以及一些其他配置,且Docker及原生部署是否有區別?Mc是否可設置?
3. 新增配置項解釋
首先看下清理策略的配置包含哪些(英文描述挺簡單,相信大家一定沒問題):
| stale_uploads_expiry | MINIO_API_STALE_UPLOADS_EXPIRY | set to expire stale multipart uploads older than this value, defaults to 24 hours |
| stale_uploads_cleanup_interval | MINIO_API_STALE_UPLOADS_CLEANUP_INTERVAL | set to change intervals when stale multipart uploads are expired, defaults to every 6 hours |
| delete_cleanup_interval | MINIO_API_DELETE_CLEANUP_INTERVAL | set to change intervals when deleted objects are permanently deleted from “.trash” folder, defaults to every 5 minutes |
| 其他配置 | ||
| requests_max | MINIO_API_REQUESTS_MAX | set the maximum number of concurrent requests, e.g. “1600” |
| requests_deadline | MINIO_API_REQUESTS_DEADLINE | set the deadline for API requests waiting to be processed e.g. “1m” |
| cluster_deadline | MINIO_API_CLUSTER_DEADLINE | set the deadline for cluster readiness check e.g. “10s” |
| cors_allow_origin | MINIO_API_CORS_ALLOW_ORIGIN | set comma separated list of origins allowed for CORS requests e.g. “https://example1.com,https://example2.com” |
| remote_transport_deadline | MINIO_API_REMOTE_TRANSPORT_DEADLINE | set the deadline for API requests on remote transports while proxying between federated instances e.g. “2h” |
| list_quorum | MINIO_API_LIST_QUORUM | set the acceptable quorum expected for list operations e.g. “optimal”, “reduced”, “disk”, “strict”, defaults to “strict” |
| replication_workers | MINIO_API_SECURE_CIPHERS | set the number of replication workers, defaults to 100 |
| replication_failed_workers | MINIO_API_REPLICATION_WORKERS | set the number of replication workers for recently failed replicas, defaults to 4 |
| transition_workers | MINIO_API_TRANSITION_WORKERS | set the number of transition workers, defaults to 100 |
由此新增的三個參數可看出,我們可配置過期分片清理的閾值及頻率,增加了靈活性。
4. 配置使用
官方也有說明部分參數的使用,可查閱:minio-server-configuration-guide。接下來看下在Docker及原生部署中如何使用:
-
Docker run直接運行,使用Env參數名
-
dockercompose.yml配置啟動,使用Env參數名
-
原生啟動,使用Env參數名
通過Mc設置,使用配置參數
mc admin config set myminio/ api requests_max=1600 stale_uploads_expiry=24 mc admin service restart myminio/配置完成后,啟動或者重啟即可生效。
如果文章對你有用,歡迎點贊收藏,謝謝!如有不正確或不理解的歡迎評論指出。
總結
以上是生活随笔為你收集整理的Minio过期分片上传文件清理引出的系统配置的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 浅析项目工作量估算方法
- 下一篇: spring 事务传播行为以及失效原因