简体   繁体   English

自动将 Azure blob 存储层更改为冷却?

[英]Automatically changing Azure blob storage tier to cool?

We are considering moving archived data after some retention period to the newer cool tier of Azure Storage ( https://azure.microsoft.com/en-us/blog/introducing-azure-cool-storage/ ).我们正在考虑在保留一段时间后将存档数据移动到更新的cool存储层 ( https://azure.microsoft.com/en-us/blog/introducing-azure-cool-storage/ )。

Can I programatically set up something that will automatically change the tier or move content to a cool tier storage after some period of time?我能否以编程方式设置在一段时间后自动更改层或将内容移动到凉爽层存储的东西?

In additional, we can change the Blob Storage characteristic at any point. 此外,我们可以随时更改Blob存储特性。 But when change from cool to hot, you have to pay for a lot of I/O for converting the blob type. 但是当从酷变为热时,你必须为转换blob类型付出大量的I / O. Converting from hot to cool is free. 从热到冷转换是免费的。 We could find more details at this document . 我们可以在本文档中找到更多详细信息。

Can I programmatically set up something that will automatically change the tier or move content to a cool tier storage after some period of time?我能否以编程方式设置在一段时间后自动更改层或将内容移动到凉爽层存储的东西?

Yes , ( since August 2021 ) it's now possible to have Azure automatically move blobs between Hot, Cool, and Archive tiers - this is done using a Lifecycle management policy which you can configure.的,( 自 2021 年 8 月起现在可以让 Azure 在热、冷和存档层之间自动移动 blob - 这是使用您可以配置的生命周期管理策略完成的。

This is documented in this page: https://docs.microsoft.com/en-us/azure/storage/blobs/lifecycle-management-overview这记录在此页面中: https://docs.microsoft.com/en-us/azure/storage/blobs/lifecycle-management-overview

Some caveats:一些警告:

  • You can't force-run a policy: once you've set-up the policy you'll simply have to wait... up to 48 hours or even longer.您不能强制执行策略:一旦您设置了策略,您只需等待……最多 48 小时甚至更长时间。

    • So if you want to quickly archive or cool your blobs immediately then you should use another approach.因此,如果您想立即快速存档或冷却您的 blob,那么您应该使用另一种方法。 Unfortunately I can't make any recommendations right at the time of me writing this.不幸的是,在我写这篇文章的时候,我无法提出任何建议。
  • Your blobs need to be readable by Azure itself, so this won't work with super secure or inaccessible storage accounts.您的 blob 需要 Azure 本身可以读取,因此这不适用于超级安全或无法访问的存储帐户。

  • You need to enable blob access-tracking first (I describe how to do this in the section below).您需要首先启用 blob 访问跟踪(我将在下面的部分中描述如何执行此操作)。

    • Note that blob access tracking costs extra money, but I can't find any pricing information available on access-tracking.请注意,blob 访问跟踪需要额外的费用,但我找不到任何有关访问跟踪的定价信息。
  • The policy rules you can create are somewhat restrictive as you can only filter the set of blobs to auto-archive or automatically move to the Cool tier based on only these parameters:您可以创建的策略规则有些限制,因为您只能根据以下参数过滤要自动存档的 blob 集或自动移动到 Cool 层:

    • The Blob's Last-Modified time and Last-Accessed time - but only in relative days-ago (so you can't use absolute dates or complex interval/date-range expressions). Blob 的 Last-Modified 时间和 Last-Accessed 时间 - 但仅限于相对几天前(因此您不能使用绝对日期或复杂的间隔/日期范围表达式)。
    • The blob type (only Block blobs can be auto-moved between tiers; Append blobs can only be auto-deleted (not auto-moved); while Page blobs aren't supported at all) blob 类型(只有块 blob 可以在层之间自动移动;Append blob 只能自动删除(不能自动移动);而根本不支持页面 blob)
    • The blob container name, and optionally a blob name prefix match. Blob 容器名称和可选的 Blob 名称前缀匹配。
      • But you can't filter by blob-name prefix match without specifying a container name.但是您不能在不指定容器名称的情况下按 blob 名称前缀匹配进行过滤。
    • And by exact-matching Blob Tags already indexed by a Blob Index.并且通过精确匹配已经被 Blob 索引索引的 Blob 标签。
  • The only possible rule actions are to move blobs between tiers or to delete blobs.唯一可能的规则操作是在层之间移动 blob 或删除 blob。 You can't move blobs between containers or accounts or edit any blob metadata or change a blob's access-policy and so on...您不能在容器或帐户之间移动 blob,也不能编辑任何 blob 元数据或更改 blob 的访问策略等等......

    • While there is an action that will move a Cool blob back to the Hot tier on the first access/request (which is nice), I'd have personally liked to see an option to promote the blob back to hot only after 2 or 3 (or more) requests in a given time-window, instead of always moving it on the first request, which means spurious requests (eg web spiders, your own blob scanner tools, etc) might incur the more expensive Cool-tier data transfer/read fees.虽然有一个操作会在第一次访问/请求时将 Cool blob 移回 Hot 层(这很好),但我个人希望看到一个选项仅在 2 或 3 之后将 blob 提升回热层(或更多)请求在给定的时间窗口中,而不是总是在第一个请求上移动它,这意味着虚假请求(例如 web 蜘蛛,您自己的 blob 扫描仪工具等)可能会导致更昂贵的冷却层数据传输/阅读费用。

To set up a blob lifecycle policy to automatically move Hot blobs to the Cool tier if not accessed for 90 days (as an example), do this:要设置 blob 生命周期策略以在 90 天未访问时自动将热 blob 移动到冷层(例如),请执行以下操作:

(Azure Portal screenshots taken as I wrote this, in August 2022 - if the screenshots or instructions are outdated leave a comment and I'll update them) (我在 2022 年 8 月撰写本文时截取的 Azure 门户屏幕截图 - 如果屏幕截图或说明已过时,请发表评论,我会更新它们)

  1. Open the Azure Portal ( https://portal.azure.com ) and navigate to your Storage Account's "blade".打开Azure门户( Z5E056C500A1C4B6A7110B507BADE5Z:// PORTAL.ZCF04ASTORDAL.ZCF04A04AA02E37B774FC311A48FC592ARENFC59.48FC59.48FC59NDCRADENDCRADENDCRADENDCRADENDCRADENDCRADENDCRADENDCENDCRAD不是

    • BTW, if your storage account is older than a few years then ensure your Storage account is upgraded to GeneralPurposeV2 or Blob-only.顺便说一句,如果您的存储帐户超过几年,请确保您的存储帐户升级到 GeneralPurposeV2 或 Blob-only。
  2. Look for "Lifecycle Management" in the sidebar:在侧边栏中查找“生命周期管理”:

    • 在此处输入图像描述
  3. Ensure "Enable access tracking" is enabled . 确保启用“启用访问跟踪”

    • The tooltip says access tracking has additional charges, but I can't find any information about what those charges are.工具提示说访问跟踪有额外费用,但我找不到任何关于这些费用的信息。

      • NOTE: The access tracking feature is distinct from Azure Blob Inventory, but lots of pages and Google results incorrectly report Blob Inventory pricing注意:访问跟踪功能与 Azure Blob Inventory 不同,但许多页面和 Google 结果错误地报告了 Blob Inventory 定价
    • 在此处输入图像描述

  4. Click "Add a rule" and complete the wizard:单击“添加规则”并完成向导:

    1. Enter a Rule name like move-blobs-not-accessed-for-90-days-to-cool-tier输入规则名称,例如move-blobs-not-accessed-for-90-days-to-cool-tier
    2. If you only want to auto-move blobs in specific containers (instead of the entire account) then check the "Limit blobs with filters".如果您只想在特定容器(而不是整个帐户)中自动移动 blob,请选中“使用过滤器限制 blob”。
    3. On the "Base blobs" tab of the wizard you can specify the Last-Modified and Last-Accessed rules and actions as described above.在向导的“基本 blob”选项卡上,您可以指定 Last-Modified 和 Last-Accessed 规则和操作,如上所述。
      1. Note that you can have up to 3 conditions in a single policy, for the 3 possible actions: move-to-cool ( tierToCool ), move-to-archive ( tierToArchive ), and delete-blob ( delete ).请注意,一个策略中最多可以有 3 个条件,用于 3 个可能的操作:移动到冷却 ( tierToCool )、移动到存档 ( tierToArchive ) 和删除 blob ( delete )。
  5. And that's it - so now you have to wait up to 48 hours for the policy to start to take effect, and maybe wait even longer for Azure to actually finish moving the blobs between tiers.就是这样- 所以现在您必须等待长达 48 小时才能让策略开始生效,并且可能等待更长时间 Azure 才能真正完成在层之间移动 blob。

    • As I write this, I've had my policy set-up for about 2 hours now and there's still no-sign that it's even started yet.在我写这篇文章时,我已经设置了大约 2 个小时的策略,但仍然没有任何迹象表明它已经开始了。 YMMV. YMMV。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM