資料庫類型

建立 Dataproc Metastore 服務時,您必須選擇使用 MySQL 或 Spanner 資料庫類型。

這項選擇會影響您可與 Dataproc Metastore 服務整合及使用的功能。請務必注意,建立 Dataproc Metastore 服務後,就無法更新資料庫類型。請務必根據自身需求選擇合適的資料庫類型。

本頁面說明這些資料庫類型的差異,以及如何為服務選取資料庫。

MySQL 和 Spanner 的差異

MySQL

Dataproc Metastore MySQL 資料庫類型是 Cloud SQL 的實作項目。 使用 MySQL 資料庫時,請注意下列事項:

  • 建立 Dataproc Metastore 時,MySQL 是預設的資料庫類型。
  • 所有 Hive 版本都支援 MySQL。
  • MySQL 支援所有 Dataproc Metastore 功能。
  • MySQL 支援 Dataproc Metastore 加密,例如使用客戶管理的加密金鑰 (CMEK)。

Spanner

Dataproc Metastore Spanner 資料庫類型是 Spanner 的實作項目。使用 Spanner 資料庫時,請注意下列事項:

  • Spanner 僅支援 Hive 2.3.6 和 3.1.2 版。
  • Spanner 只支援匯入 Avro 檔案。

其他詳細資料

下表提供這些差異的詳細資訊。

MySQL Spanner
可靠性 (運作時間) Cloud SQL 服務等級目標 99.95%* Spanner 服務等級目標 99.99%*
維護期間 必填 非必要

注意:

  • *Cloud SQL 和 Spanner 的 SLO 不會直接轉換為 Dataproc Metastore 的 SLO。Dataproc Metastore 您選取的資料庫類型不會影響 Dataproc Metastore 服務等級目標。
  • 這兩種資料庫的定價相同。

事前準備

必要的角色

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

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

這個預先定義的角色具備 metastore.services.create 權限,這是建立 Dataproc Metastore 的必要權限。

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

如要進一步瞭解特定 Dataproc Metastore 角色和權限,請參閱「使用 IAM 管理 Dataproc 存取權」。

選擇資料庫類型

首次建立 Dataproc Metastore 服務時,您會選擇資料庫類型。

以下範例顯示選擇資料庫類型時的簡短步驟。如需完整逐步操作說明,請參閱「建立 Dataproc Metastore 服務」。

控制台

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

    開啟 Dataproc Metastore

  2. 點按導覽列中的「建立」

    「建立服務」頁面隨即開啟。

  3. 在「資料庫類型」中,選取「MySQL」或「Spanner」

    MySQL 是預設資料庫類型。

  4. 視需要選擇服務的其餘設定

  5. 按一下「提交」

gcloud CLI

  1. 執行下列 gcloud metastore services create 指令:

    gcloud metastore services create SERVICE_ID \
       --location=LOCATION \
       --database-type=DATABASE_TYPE; default="mysql"
    

    更改下列內容:

    • SERVICE_ID:Dataproc Metastore 服務的名稱或 ID。
    • LOCATION:Dataproc Metastore 服務所在的區域。
    • DATABASE_TYPE:要為 Dataproc Metastore 服務設定的資料庫類型。可接受的值包括 mysqlspanner。預設值為 mysql

後續步驟