Azure容器的保留策略? [英] Retention Policy for Azure Containers?

查看:54
本文介绍了Azure容器的保留策略?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我的一个容器设置一个策略,以便它删除或仅保留x天的数据.因此,如果x为30,则该容器应仅包含少于30天的文件.如果文件在容器中放置了30天以上,则应将其丢弃.有什么办法可以配置吗?

I'm looking to set up a policy for one of my containers so it deletes or only retains data for x days. So if x is 30, that container should only contain files that are less than 30 days old. If the files are sitting in the container for more than 30 days it should discard them. Is there any way I can configure that?

推荐答案

当前,Azure Blob存储不支持此类操作.您需要编写自己的某些内容,这些内容会定期运行以进行此检查并删除旧的Blob.

Currently such kind of thing is not supported by Azure Blob Storage. You would need to write something of your own that would run periodically to do this check and delete old blobs.

顺便提一句,此功能早已待定(自2011年起):

On a side note, this feature has been long pending (since 2011): https://feedback.azure.com/forums/217298-storage/suggestions/2474308-provide-time-to-live-feature-for-blobs.

更新

如果您需要自己做,则有两点要考虑:

If you need to do it yourself, there are two things to consider:

  1. 代码以获取Blob列表,找出需要删除的Blob,然后删除这些Blob.为此,可以使用Azure存储SDK. Azure存储SDK可用于多种编程语言,例如.Net,Java,Node,PHP等.您只需要使用一种自己喜欢的语言即可.
  2. 安排此代码每天运行一次:为此,可以使用Azure中提供的许多服务之一.您可以使用Azure WebJobs,Functions,Schedular,Azure Automation等.

如果您决定使用Azure自动化,则已经有可供您使用的Runbook(无需编写代码).您可以在此处找到有关此内容的更多详细信息: https://gallery. technet.microsoft.com/scriptcenter/删除存储-Blobs-that-aae4b761 .

If you decide to use Azure Automation, there's a Runbook already available for you that you can use (no need to write your code). You can find more details about this here: https://gallery.technet.microsoft.com/scriptcenter/Remove-Storage-Blobs-that-aae4b761.

这篇关于Azure容器的保留策略?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆