更新目录(例如 Apache Iceberg REST 目录)可让您修改其属性,例如凭据模式、默认仓库位置或底层目录类型。
例如,您可以将单分桶 (gs://) 目录升级为多分桶 (bl://) 目录类型(推荐)。升级目录可带来显著优势,例如允许目录跨多个存储分区。
准备工作
- 请参阅关于 Lakehouse 运行时目录,了解 Lakehouse 运行时目录的运作方式以及该服务的限制。
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles. - Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
Verify that billing is enabled for your Google Cloud project.
Enable the BigLake API.
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM
role (roles/serviceusage.serviceUsageAdmin), which
contains the serviceusage.services.enable permission. Learn how to grant
roles.
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
Verify that billing is enabled for your Google Cloud project.
Enable the BigLake API.
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM
role (roles/serviceusage.serviceUsageAdmin), which
contains the serviceusage.services.enable permission. Learn how to grant
roles.
所需的角色
如需获得更新目录所需的权限,请让您的管理员为您授予以下 IAM 角色:
- 全部:
- 针对项目的 BigLake Admin (
roles/biglake.admin) 角色 - 您项目的 Storage Admin (
roles/storage.admin)
- 针对项目的 BigLake Admin (
如需详细了解如何授予角色,请参阅管理对项目、文件夹和组织的访问权限。
更新目录
您可以使用 Google Cloud 控制台、gcloud 或 REST API 更新目录。
控制台
在 Google Cloud 控制台中,打开 Lakehouse 页面。
在要更新的目录所在的行中,依次点击 更多目录操作 > 修改。
在目录配置下,修改要更新的设置。
选择保存。
gcloud
方法 1:更新目录属性
如需更新目录属性(例如说明或受限位置),请运行 gcloud beta biglake iceberg catalogs update 命令:
gcloud beta biglake iceberg catalogs update CATALOG_ID \ --project="PROJECT_ID" \ [--description="DESCRIPTION"] \ [--credential-mode="CREDENTIAL_MODE"] \ [--restricted-locations="RESTRICTED_LOCATIONS"]
替换以下内容:
CATALOG_ID:Lakehouse 运行时目录的 ID。PROJECT_ID:您的 Google Cloud 项目 ID。DESCRIPTION:(可选)目录的说明。CREDENTIAL_MODE:(可选)身份验证方法。使用end-user表示最终用户凭证,使用vended-credentials表示凭证分发模式。RESTRICTED_LOCATIONS:(可选)其他允许的存储分区或路径的逗号分隔列表。注意:如果您指定多个重叠的路径或存储分区,可能会导致元数据冲突、意外的数据覆盖或权限泄露等安全问题。
方法 2:将单存储桶 (gs://) 目录升级为多存储桶 (bl://) 目录(推荐)
如需将现有的单存储桶 (gs://) 目录升级为多存储桶 (bl://) 目录(推荐),请运行 gcloud beta biglake iceberg catalogs update 命令并将 --catalog-type 参数设置为 biglake:
gcloud beta biglake iceberg catalogs update CATALOG_ID \ --project="PROJECT_ID" \ --catalog-type="biglake"
REST
方法 1:更新目录属性
如需使用 REST API 修改目录的属性(例如说明),请向 UpdateIcebergCatalog 端点发出 PATCH 请求,并提供适当的 updateMask:
PATCH /iceberg/v1/restcatalog/extensions/projects/PROJECT_ID/catalogs/CATALOG_ID?updateMask=icebergCatalog.description
请求正文必须包含一个 IcebergCatalog JSON 载荷,其中包含要更新的字段:
{
"description": "Updated catalog description"
}
方法 2:将单存储桶 (gs://) 目录升级为多存储桶 (bl://) 目录(推荐)
如需使用 REST API 升级其类型,请向 UpdateIcebergCatalog 端点发出 PATCH 请求,并在 updateMask 中包含 catalogType:
PATCH /iceberg/v1/restcatalog/extensions/projects/PROJECT_ID/catalogs/CATALOG_ID?updateMask=icebergCatalog.catalogType
请求正文必须包含一个 IcebergCatalog JSON 载荷,其中包含新的目录类型:
{
"catalogType": "BIGLAKE"
}
替换以下内容:
PROJECT_ID:您的 Google Cloud 项目 ID。CATALOG_ID:Lakehouse 运行时目录的 ID。