更新目錄 (例如 Apache Iceberg REST 目錄) 可修改其屬性,例如憑證模式、預設倉儲位置或基礎目錄類型。
舉例來說,您可以將單一 bucket (gs://) 目錄升級為多個 bucket (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 管理員 (
roles/biglake.admin) - 專案的儲存空間管理員 (
roles/storage.admin)
- 專案的 BigLake 管理員 (
如要進一步瞭解如何授予角色,請參閱「管理專案、資料夾和組織的存取權」。
更新目錄
你可以使用 Google Cloud 控制台、gcloud或 REST API 更新目錄。
控制台
在 Google Cloud 控制台中開啟「Lakehouse」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:將單一 bucket (gs://) 目錄升級為多個 bucket (bl://) 目錄 (建議做法)
如要將現有的單一 bucket (gs://) 目錄升級為多個 bucket (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:將單一 bucket (gs://) 目錄升級為多個 bucket (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。