MinIO 为主要网关部署提供缓存存储层,允许您缓存内容以加快读取速度,节省从云重复下载的成本。
KEY: cache add caching storage tier 添加缓存存储层 ARGS: drives* (csv) comma separated mountpoints e.g. "/optane1,/optane2" 逗号分隔的挂载点 expiry (number) cache expiry duration in days e.g. "90" 以天为单位的缓存到期持续时间 quota (number) limit cache drive usage in percentage e.g. "90" 以百分比限制缓存驱动器的使用 exclude (csv) comma separated wildcard exclusion patterns e.g. "bucket/*.tmp,*.exe" 逗号分隔的通配符排除模式 after (number) minimum number of access before caching an object 缓存对象前的最小访问次数 comment (sentence) optionally add a comment to this setting
通过修改 .minio.sys/config/config.json 文件来实现,如下:
{ //... "cache": { "_": [{ "key": "drives", "value": "" }, { "key": "exclude", "value": "" }, { "key": "expiry", "value": "90" }, { "key": "quota", "value": "80" }, { "key": "after", "value": "0" }, { "key": "watermark_low", "value": "70" }, { "key": "watermark_high", "value": "80" }, { "key": "range", "value": "on" }, { "key": "commit", "value": "writethrough" } ] }, //... }
当然,也可以通过环境变量进行控制。如下:
KEY: cache add caching storage tier 添加缓存存储层 ARGS: MINIO_CACHE_DRIVES* (csv) comma separated mountpoints e.g. "/optane1,/optane2" MINIO_CACHE_EXPIRY (number) cache expiry duration in days e.g. "90" MINIO_CACHE_QUOTA (number) limit cache drive usage in percentage e.g. "90" MINIO_CACHE_EXCLUDE (csv) comma separated wildcard exclusion patterns e.g. "bucket/*.tmp,*.exe" MINIO_CACHE_AFTER (number) minimum number of access before caching an object MINIO_CACHE_COMMENT (sentence) optionally add a comment to this setting
在 Windows 下,实例:
set MINIO_CACHE_DRIVES*=/optane1,/optane2 set MINIO_CACHE_EXPIRY=90 set MINIO_CACHE_QUOTA=90 set MINIO_CACHE_EXCLUDE=bucket/*.tmp,*.exe minio server ./data