更改 Google Cloud Storage 中(现有)对象的存储类别 [英] Change storage class of (existing) objects in Google Cloud Storage

查看:32
本文介绍了更改 Google Cloud Storage 中(现有)对象的存储类别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近了解到 Google Cloud Storage 平台/服务上宣布了新的存储层级和降价.

I recently learnt of the new storage tiers and reduced prices announced on the Google Cloud Storage platform/service.

所以我想将我的一个存储桶的默认存储类从 Durable Reduced Availability 更改为 Coldline,因为这适合我在该存储桶中归档的文件.

So I wanted to change the default storage class for one of my buckets from Durable Reduced Availability to Coldline, as that is what is appropriate for the files that I'm archiving in that bucket.

不过我收到了这张纸条:

I got this note though:

更改默认存储类只会影响您以后添加到此存储分区的对象.它不会更改已在您的存储桶中的对象的存储类别.

Changing the default storage class only affects objects you add to this bucket going forward. It does not change the storage class of objects that are already in your bucket.

关于如何更改存储桶中所有现有对象的类的任何建议/提示(使用 Google Cloud Console 或 gsutil)?

Any advice/tips on how I can change class of all existing objects in the bucket (using Google Cloud Console or gsutil)?

推荐答案

将对象同步移动到同一存储桶中的不同存储类的最简单方法是使用 重写.例如,要使用 gsutil 执行此操作,您可以运行:

The easiest way to synchronously move the objects to a different storage class in the same bucket is to use rewrite. For example, to do this with gsutil, you can run:

gsutil -m rewrite -s coldline gs://your-bucket/**

注意:确保 gsutil 是最新的(4.22 及更高版本支持 -s 标志和 rewrite).

Note: make sure gsutil is up to date (version 4.22 and above support the -s flag with rewrite).

或者,您可以使用 生命周期管理的新 SetStorageClass 操作 功能以异步方式(通常需要大约 1 天)就地修改对象的存储类(例如,通过使用 CreatedBefore 条件设置为更改存储桶的默认存储类后的某个时间).

Alternatively, you can use the new SetStorageClass action of the Lifecycle Management feature to asynchronously (usually takes about 1 day) modify storage classes of objects in place (e.g. by using a CreatedBefore condition set to some time after you change the bucket's default storage class).

这篇关于更改 Google Cloud Storage 中(现有)对象的存储类别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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