批量过期
MinIO 版本新增功能: RELEASE.2023-12-02T10-51-33Z
MinIO 批处理框架允许您使用 YAML 格式的作业定义文件(“批处理文件”)创建、管理、监控和执行作业。批处理作业直接在 MinIO 部署上运行,以利用服务器端处理能力,而无需受运行 MinIO 客户端 的本地计算机的限制。
expire
批处理作业将 自动对象过期 行为应用于单个 Bucket。该作业根据提供的配置确定过期资格,独立于任何配置的过期规则。
行为
对象的立即过期
批量过期作为批处理作业的一部分立即发生,这与 基于被动扫描程序的过期规则应用 形成对比。具体来说,批量过期不会屈服于应用程序 I/O,并且可能会影响部署上常规读/写操作的性能。
在批处理运行时确定过期资格
批量过期按 Bucket 工作,并运行一次直到完成。该作业在作业运行时确定过期资格,并且不会定期重新扫描或重新检查新对象。
要捕获任何新的符合过期条件的对象,请重新运行批处理作业。
过期规则仅检查最新的对象
批量过期作业仅针对每个批量过期规则检查每个对象的最新或“当前”版本。
过期批处理作业参考
expire
作业类型的示例 YAML 描述
使用 mc batch generate
创建一个基本的 expire
批处理作业以进行进一步自定义。
expire:
apiVersion: v1
bucket: mybucket # Bucket where this job will expire matching objects from
prefix: myprefix # (Optional) Prefix under which this job will expire objects matching the rules below.
rules:
- type: object # objects with zero ore more older versions
name: NAME # match object names that satisfy the wildcard expression.
olderThan: 70h # match objects older than this value
createdBefore: "2006-01-02T15:04:05.00Z" # match objects created before "date"
tags:
- key: name
value: pick* # match objects with tag 'name', all values starting with 'pick'
metadata:
- key: content-type
value: image/* # match objects with 'content-type', all values starting with 'image/'
size:
lessThan: 10MiB # match objects with size less than this value (e.g. 10MiB)
greaterThan: 1MiB # match objects with size greater than this value (e.g. 1MiB)
purge:
# retainVersions: 0 # (default) delete all versions of the object. This option is the fastest.
# retainVersions: 5 # keep the latest 5 versions of the object.
- type: deleted # objects with delete marker as their latest version
name: NAME # match object names that satisfy the wildcard expression.
olderThan: 10h # match objects older than this value (e.g. 7d10h31s)
createdBefore: "2006-01-02T15:04:05.00Z" # match objects created before "date"
purge:
# retainVersions: 0 # (default) delete all versions of the object. This option is the fastest.
# retainVersions: 5 # keep the latest 5 versions of the object including delete markers.
notify:
endpoint: https://notify.endpoint # notification endpoint to receive job completion status
token: Bearer xxxxx # optional authentication token for the notification endpoint
retry:
attempts: 10 # number of retries for the job before giving up
delay: 500ms # least amount of delay between each retry