注意:说明:
一、使用限制
请注意,元数据加速桶清单公测期间,有如下限制:
·单个 COS 元数据加速桶配置的清单规则数量上限为5条。
注意:说明:
注意:通常情况下建议配置存储桶根路径作为清单扫描路径,若你使用场景需要配置大于5条规则,请 联系我们。
·不支持跨桶投递清单报告,任务配置中目标路径需要与源桶一致。
·清单暂不支持自定义 ID,创建任务后会自动指定任务 ID。该 ID 可通过 List 接口查询。
·元数据加速桶暂不支持即时清单。
二、清单报告投递说明
用户配置一项清单任务后,COS 将根据配置定时扫描用户存储桶内指定路径下的文件,并输出一份 CSV 格式的清单报告。清单报告投递路径可在任务配置中指定,CSV 文件的具体路径如下:
destination-prefix/YYYY-MM-DD-HH/Data/8d1048acf48096d17502bd62efc9f8c1.csv
·destination-prefix:用户在清单投递任务中指定的投递路径。
·YYYY-MM-DD-HH:时间戳,清单任务执行的年、月、日、小时。
注意:说明:
注意:路径中的小时为任务开始执行的时间,与实际投递时间不一致。COS 元数据加速桶支持配置每天或者每周定时扫描任务,首次配置或投递后24小时内产出一份清单报告,无法指定固定时间执行清单任务,或固定时间投递清单报告。
·清单报告:以 CSV 格式投递,文件名称为 COS 生成的随机值。
清单任务按配置规则扫描路径下文件,产出的报告中不包含表头信息,报告中打印字段顺序及说明如下:
| 字段 | 描述 |
| FileName | 文件名称 |
| ATime | 文件的访问时间说明:为保证读写性能最优,元数据加速桶默认不开启 ATime 追踪。若你需要使用 ATime 功能,请 联系我们。 |
| MTime | 文件内容的变更时间 |
| CTime | 文件元数据的变更时间 |
| Size | 文件大小(单位 Byte) |
| FileType | 打印文件状态为目录或文件,输出格式为:DIR(目录)或 FILE(文件) |
| Permission | 以数字表示打印文件权限,例如:755 |
| UserName | 用户名称,例如:hadoop |
| GroupName | 用户组名称,例如:supergroup |
| StorageClass | 当前文件的存储类型。可能为以下值:STANDARD(标准存储)STANDARD_IA(低频存储)ARCHIVE(归档存储)DEEP_ARCHIVE(深度归档存储)ARCHIVE+STANDARD(归档存储已回热)DEEP_ARCHIVE+STANDARD(深度归档存储已回热) |
三、清单配置方法
当前 COS 元数据加速桶暂不支持通过控制台配置清单,仅支持使用 API 进行配置。具体步骤如下:
1. 创建 COS 角色。
2. COS 角色绑定权限。
3. 开启清单功能。
四、1. 创建 COS 角色
创建 COS 角色,具体接口信息请参见 CreateRole。
其中,roleName 必须为:COS_QcsRole。
policyDocument 为:
{ "version": "2.0", "statement": [{ "action": "name/sts:AssumeRole", "effect": "allow", "principal": { "service": "cos.cloud.tencent.com" } }]}
五、2. COS 角色绑定权限
角色绑定权限,具体接口信息参见 AttachRolePolicy。
其中,policyName 为:QcloudCOSFullAccess,roleName 为第1步中的 COS_QcsRole,也可以使用创建 roleName 时返回的 roleID。
六、3. 开启清单功能
调用接口,开启清单功能。元数据加速桶复用 COS 清单能力,支持使用 COS Inventory 接口开启清单配置。由于元数据加速桶特性,API 中部分字段与 COS 清单接口存在差异,具体调用方式请参照如下接口示例:
七、PUT Bucket Inventory
该接口用于在存储桶中创建清单任务,接口参数说明请参考 COS PUT Inventory 接口文档。由于元数据加速桶特性,API 中部分字段与 COS 清单接口存在差异,具体说明如下:
·元数据加速桶清单暂不支持指定 ID,创建任务时无需携带 ID 信息,ID 由 COS 自动生成。
·当前元数据加速桶仅支持将清单报告投递至源桶,COSBucketDestination需要配置为源桶。
·暂时不支持配置清单报告加密,创建任务时不支持配置Encryption字段。
·元数据加速桶暂不支持 版本控制 能力,因此配置中不支持IncludedObjectVersions字段。
·元数据加速桶不支持指定清单报告产出字段,OptionalFields 字段请按下方示例入参。
请求
PUT /?inventory HTTP/1.1Host: <BucketName-APPID>.cos.<Region>.myqcloud.comDate: GMT DateAuthorization: Auth StringContent-MD5: MD5<InventoryConfiguration> <IsEnabled>true</IsEnabled> <Destination> <COSBucketDestination> <Format>CSV</Format> <AccountId>1000000000</AccountId> <Bucket>qcs::cos:ap-beijing::bucketname-100000000</Bucket> <Prefix>/testprefix</Prefix> </COSBucketDestination> </Destination> <Schedule> <Frequency>Daily</Frequency> </Schedule> <Filter> <Prefix>/my-inventory</Prefix> </Filter> <OptionalFields> <Field>ATime</Field> <Field>Permission</Field> <Field>MTime</Field> <Field>CTime</Field> <Field>Size</Field> <Field>UserName</Field> <Field>GroupName</Field> <Field>StorageClass</Field> <Field>FileType</Field> </OptionalFields></InventoryConfiguration>
响应
HTTP/1.1 200 OKContent-Type: application/xmlContent-Length: 0Date: Mon, 28 Aug 2018 02:53:38 GMTServer: tencent-cosx-cos-request-id: NTlhMzg1ZWVfMjQ4OGY3MGFfMWE1NF8****
八、GET Bucket Inventory
该接口用于在存储桶中查询具体的清单任务信息,接口参数说明请参考 COS GET Inventory 接口文档。该接口需要携带清单 ID 参数,该参数在创建任务时由元数据加速桶自动生成,如需获取该 ID 请调用 List Bucket Inventory Configurations 接口。
请求
GET /?inventory&id=inventory-configuration-ID HTTP/1.1Host: <BucketName-APPID>.cos.<Region>.myqcloud.comDate: GMT DateAuthorization: Auth String
响应
HTTP/1.1 200 OKContent-Type: application/xmlContent-Length: 331Date: Mon, 28 Aug 2018 02:53:39 GMTServer: tencent-cosx-cos-request-id: NTlhMzg1ZWVfMjQ4OGY3MGFfMWE1NF84Y2M<?xml version = "1.0" encoding = "UTF-8"?><InventoryConfiguration xmlns = "http://…."> <Id>12761</Id> <IsEnabled>true</IsEnabled> <Destination> <COSBucketDestination> <Format>CSV</Format> <AccountId>1000000000</AccountId> <Bucket>qcs::cos:ap-beijing::bucketname-100000000</Bucket> <Prefix>/testprefix</Prefix> </COSBucketDestination> </Destination> <Schedule> <Frequency>Daily</Frequency> </Schedule> <Filter> <Prefix>/my-inventory</Prefix> </Filter> <OptionalFields> <Field>ATime</Field> <Field>Permission</Field> <Field>MTime</Field> <Field>CTime</Field> <Field>Size</Field> <Field>UserName</Field> <Field>GroupName</Field> <Field>StorageClass</Field> <Field>FileType</Field> </OptionalFields> </InventoryConfiguration>
九、List Bucket Inventory Configurations
该接口用于请求返回一个存储桶中的所有清单任务,接口参数说明请参考 COS List Bucket Inventory Configurations 接口文档。
请求
GET /?inventory HTTP/1.1Host: <BucketName-APPID>.cos.<Region>.myqcloud.comDate: GMT DateAuthorization: Auth String
响应
HTTP/1.1 200 OKContent-Type: application/xmlContent-Length: 331Date: Mon, 28 Aug 2018 02:53:39 GMTServer: tencent-cosx-cos-request-id: NTlhMzg1ZWVfMjQ4OGY3MGFfMWE1NF8****<?xml version = "1.0" encoding = "UTF-8"?><ListInventoryConfigurationResult xmlns = "http://…."><InventoryConfiguration> <Id>12761</Id> <IsEnabled>true</IsEnabled> <Destination> <COSBucketDestination> <Format>CSV</Format> <AccountId>1000000000</AccountId> <Bucket>qcs::cos:ap-beijing::bucketname-100000000</Bucket> <Prefix>/testprefix</Prefix> </COSBucketDestination> </Destination> <Schedule> <Frequency>Daily</Frequency> </Schedule> <Filter> <Prefix>/my-inventory</Prefix> </Filter> <OptionalFields> <Field>ATime</Field> <Field>Permission</Field> <Field>MTime</Field> <Field>CTime</Field> <Field>Size</Field> <Field>UserName</Field> <Field>GroupName</Field> <Field>StorageClass</Field> <Field>FileType</Field> </OptionalFields> </InventoryConfiguration><InventoryConfiguration> <Id>12762</Id> <IsEnabled>true</IsEnabled> <Destination> <COSBucketDestination> <Format>CSV</Format> <AccountId>1000000000</AccountId> <Bucket>qcs::cos:ap-beijing::bucketname-100000000</Bucket> <Prefix>/testprefix</Prefix> </COSBucketDestination> </Destination> <Schedule> <Frequency>Daily</Frequency> </Schedule> <Filter> <Prefix>/my-inventory2</Prefix> </Filter> <OptionalFields> <Field>ATime</Field> <Field>Permission</Field> <Field>MTime</Field> <Field>CTime</Field> <Field>Size</Field> <Field>UserName</Field> <Field>GroupName</Field> <Field>StorageClass</Field> <Field>FileType</Field> </OptionalFields> </InventoryConfiguration> <IsTruncated>false</IsTruncated> </ListInventoryConfigurationResult>
十、DELETE Bucket Inventory
注意:清单任务被删除后无法恢复,请谨慎操作。
该接口用于删除存储桶中指定的清单任务,接口参数说明请参考 COS DELETE Bucket Inventory 接口文档。该接口需要携带清单 ID 参数,该参数在创建任务时由元数据加速桶自动生成,如需获取该 ID 请调用 List Bucket Inventory Configurations 接口。
请求
DELETE /?inventory&id=inventory-configuration-id HTTP/1.1Host: <BucketName-APPID>.cos.<Region>.myqcloud.comDate: GMT DateAuthorization: Auth String
响应
HTTP/1.1 204 No Content Server: tencent-cosDate: Mon, 28 Aug 2018 02:53:40 GMTx-cos-id-2:0dfafa/DAPDIFdafdsfDdfSFFfdfKKJdafasiuKJK2x-cos-request-id: NTlhM2I3M2JfMjQ4OGY3MGFfMWE1NF84****