刪除 Dataproc Metastore 服務

本頁說明如何刪除 Dataproc Metastore 服務。

如果您選擇的設定無法變更 (例如服務名稱或 Hive 中繼存放區版本),可能就需要刪除 Dataproc Metastore 服務。

事前準備

必要的角色

如要取得刪除 Dataproc Metastore 服務所需的權限,請要求管理員根據最低權限原則,授予您專案的下列 IAM 角色:

如要進一步瞭解如何授予角色,請參閱「管理專案、資料夾和機構的存取權」。

這個預先定義的角色包含 metastore.services.delete權限,這是刪除 Dataproc Metastore 服務的必要權限。

您或許還可透過自訂角色或其他預先定義的角色取得這項權限。

如要進一步瞭解特定 Dataproc Metastore 角色和權限,請參閱 Dataproc Metastore 身分與存取權管理總覽

刪除服務

以下操作說明示範如何刪除 Dataproc Metastore 服務。

注意事項

  • 刪除 Dataproc Metastore 時,系統不會自動刪除 Cloud Storage 值區。如要刪除值區,請參閱刪除值區

  • 刪除 Dataproc Metastore 後,服務使用的自動建立 VPC 網路對等互連路徑最多會保留 3 小時。請注意,如果其他 Dataproc Metastore 服務繼續使用這些虛擬私有雲網路對等互連路徑,系統就不會刪除這些路徑。

控制台

  1. 在 Google Cloud 控制台中,開啟「Dataproc Metastore」頁面:

    前往 Dataproc Metastore

  2. 選取要刪除的服務。

  3. 按一下導覽列中的「刪除」

    系統會開啟對話方塊。

  4. 在對話方塊中,按一下「刪除」

    返回「Dataproc Metastore」頁面,確認已刪除的服務不再顯示於清單中。

您也可以在「服務詳細資料」頁面刪除服務。

  1. 在「Dataproc Metastore」頁面中,按一下要刪除的服務。

    該服務的「服務詳細資料」頁面隨即開啟。

    服務詳細資料頁面
  2. 在導覽列中,按一下「刪除服務」

    系統會開啟對話方塊。

  3. 在對話方塊中,按一下「刪除」

    返回「Dataproc Metastore」頁面,確認已刪除的服務不再顯示於清單中。

gcloud CLI

  1. 如要刪除服務,請執行下列 gcloud metastore services delete 指令。

    gcloud metastore services delete SERVICE \
        --location=LOCATION
    

    更改下列內容:

    • SERVICE:要刪除的 Dataproc Metastore 服務名稱。
    • LOCATION:Dataproc Metastore 服務所在的 Google Cloud 區域。
  2. 確認刪除作業是否成功。

REST

按照 API 操作說明,使用 API Explorer 刪除服務

防刪除功能

Dataproc Metastore 刪除防護功能可協助您防止現有和新的 Dataproc Metastore 服務遭意外移除。使用防刪除功能,保護對應用程式和工作負載而言重要的服務。

注意事項

  • 根據預設,系統會停用防刪除選項。

  • 您只能在執行個體層級設定防刪除功能。您無法為中繼資料 (例如資料表、資料庫或分割區) 設定個別保護措施。您也無法對備份啟用保護措施。

  • 如果刪除含有受保護執行個體的專案,系統也會刪除執行個體,無論是否啟用防刪除功能。

啟用防刪除功能

您可以在建立執行個體時啟用防刪除功能,也可以對現有執行個體啟用這項功能。

新服務

主控台

  1. 在 Google Cloud 控制台中,前往「Dataproc Metastore」頁面。

    前往 Dataproc Metastore

  2. 在導覽列中,按一下「+ 建立」

    「建立 Metastore 服務」對話方塊隨即開啟

  3. 選取「Dataproc Metastore 2」

  4. 在「防刪除功能」下方,按一下切換按鈕即可啟用這項功能。

  5. 視需要設定其餘服務選項,或使用系統提供的預設值。

  6. 按一下「提交」

gcloud CLI

如要在新的 Dataproc Metastore 服務上啟用刪除防護功能,請執行下列 gcloud metastore services create 指令。

gcloud metastore services update SERVICE \
  --location=LOCATION \
  --instance-sizeINSTANCE_SIZE \
  --deletion-protection

更改下列內容:

  • SERVICE:要刪除的 Dataproc Metastore 服務名稱。
  • LOCATION:Dataproc Metastore 服務所在的 Google Cloud 區域。
  • INSTANCE:服務的執行個體大小

現有服務

主控台

  1. 在 Google Cloud 控制台中,開啟「Dataproc Metastore」頁面:

    前往 Dataproc Metastore

  2. 在「Dataproc Metastore」頁面中,按一下要更新的服務名稱。

    「服務詳細資料」頁面隨即開啟。

  3. 在「Configuration」分頁中,按一下「Edit」

    「編輯服務」頁面隨即開啟。

  4. 在「防刪除功能」下方,按一下切換按鈕即可啟用這項功能。

  5. 按一下「提交」

gcloud CLI

如要在現有的 Dataproc Metastore 服務上啟用刪除防護功能,請執行下列 gcloud metastore services update 指令。

gcloud metastore services update SERVICE \
  --location=LOCATION \
  --deletion-protection

更改下列內容:

  • SERVICE:要刪除的 Dataproc Metastore 服務名稱。
  • LOCATION:Dataproc Metastore 服務所在的 Google Cloud 區域。

停用防刪除功能

如要停用 Dataproc Metastore 服務的刪除防護功能,請使用 --no=deletion-protection 選項執行下列 gcloud metastore services update 指令。

gcloud metastore services update SERVICE \
   --location=LOCATION \
   --no-deletion-protection

後續步驟