將 Dataproc Metastore 中繼資料遷移至 BigLake Metastore
本文說明如何使用 BigLake metastore 遷移工具,將資料庫、資料表和分區中繼資料從 Dataproc Metastore 服務移至 BigLake metastore。
事前準備
- 為 Trusted Cloud 專案啟用計費功能。瞭解如何檢查專案是否已啟用計費功能。
啟用 BigQuery 和 Dataflow API。
選用:進一步瞭解下列主題:
- 瞭解 BigLake 中繼資料存放區的運作方式,以及使用這項功能的好處。
- 瞭解 Dataflow 的運作方式,以及如何監控進行中的工作。
必要的角色
如要取得執行遷移工具所需的權限,請要求管理員授予下列 IAM 角色:
-
在 BigQuery 中建立資料庫、資料表和分割區:
在執行遷移作業的 Dataflow 服務帳戶上,BigQuery 資料編輯者 (
roles/bigQuery.dataEditor
) 。 -
在 gRPC 端點上授予 Dataproc Metastore 中繼資料的讀取權限:
在執行遷移作業的 Dataflow 服務帳戶上,中繼資料檢視者角色 (
roles/metastore.metadataViewer
)。
如要進一步瞭解如何授予角色,請參閱「管理專案、資料夾和機構的存取權」。
遷移工具的運作方式
遷移工具會啟動 Dataflow 工作,從 Dataproc Metastore 擷取中繼資料,並將其擷取到 BigLake Metastore。
您無法直接從 BigLake Metastore 存取 Dataproc Metastore 資料。如要在現有中繼資料上執行工作負載或工作,就必須進行這項遷移程序。如未使用這項工具,則必須從 Dataproc Metastore 手動擷取中繼資料,並將其擷取至 BigLake metastore。
注意事項
- 遷移工具支援使用 gRPC 或 Thrift 端點通訊協定的 Dataproc Metastore 執行個體。
- 每次執行遷移工具時,Dataflow 工作都會將 Dataproc Metastore 的中繼資料完整複製到 BigLake Metastore。
限制
遷移工具不會遷移與資料庫和資料表分割區無關的中繼資料。如果工具無法遷移資料庫或資料表,會在包含 Dataflow 工作的專案 Cloud Logging 執行個體中記錄訊息。
記錄錯誤後,Dataflow 工作會繼續處理管道中的其他資料表和資料庫。
使用該工具執行遷移作業
如要使用這項工具執行遷移作業,請執行下列 gcloud dataflow
flex-template
指令,建立 Dataflow 彈性範本工作。
gcloud dataflow flex-template run JOB_NAME" \ --template-file-gcs-location "gs://bigquery-metastore-migration/dpms_to_bqms_migration.json" \ --parameters bigQueryMetastoreProjectId="DESTINATION_BIGQUERY_PROJECT_ID" \ --parameters endpointUri="METASTORE_URI" \ --parameters bigQueryMetastoreDatabaseLocation=DATABASE_LOCATION \ [--network=NETWORK] \ [--subnetwork=SUBNETWORK]
更改下列內容:
JOB_NAME
:要執行遷移作業的 Dataflow 工作名稱。DESTINATION_BIGQUERY_PROJECT_ID
:BigQuery 專案的 ID,Dataflow 工作會將資料寫入該專案。METASTORE_URI
:Dataproc Metastore 服務的 URI。DATABASE_LOCATION
:BigLake Metastore 寫入資料的位置。舉例來說,如果您將這個值設為US
,工具建立的所有 BigQuery 資源都會儲存在這個位置。NETWORK
:選用:執行 Dataflow 工作的網路。僅在使用 Thrift 端點的 Dataproc Metastore 服務中需要。SUBNETWORK
:(選填) 執行 Dataflow 工作的子網路。僅適用於使用 Thrift 端點的 Dataproc Metastore 服務。