快速入門導覽課程:建立湖泊

本文將逐步說明如何使用Google Cloud 控制台,在 Dataplex Universal Catalog 中建立湖泊、新增區域,以及附加資產,協助您開始使用這項服務。

事前準備

  1. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  3. Make sure that billing is enabled for your Google Cloud project.

  4. Enable the Dataplex Universal Catalog, Dataproc, Dataproc Metastore, BigQuery, and Cloud Storage APIs.

    Enable the APIs

  5. Make sure that you have the following role or roles on the project: roles/dataplex.admin, roles/dataplex.editor

    Check for the roles

    1. In the Google Cloud console, go to the IAM page.

      Go to IAM
    2. Select the project.
    3. In the Principal column, find all rows that identify you or a group that you're included in. To learn which groups you're included in, contact your administrator.

    4. For all rows that specify or include you, check the Role column to see whether the list of roles includes the required roles.

    Grant the roles

    1. In the Google Cloud console, go to the IAM page.

      前往「IAM」頁面
    2. 選取專案。
    3. 按一下「授予存取權」
    4. 在「New principals」(新增主體) 欄位中,輸入您的使用者 ID。 這通常是 Google 帳戶的電子郵件地址。

    5. 在「Select a role」(選取角色) 清單中,選取角色。
    6. 如要授予其他角色,請按一下 「新增其他角色」,然後新增每個其他角色。
    7. 按一下 [Save]
  6. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  7. Make sure that billing is enabled for your Google Cloud project.

  8. Enable the Dataplex Universal Catalog, Dataproc, Dataproc Metastore, BigQuery, and Cloud Storage APIs.

    Enable the APIs

  9. Make sure that you have the following role or roles on the project: roles/dataplex.admin, roles/dataplex.editor

    Check for the roles

    1. In the Google Cloud console, go to the IAM page.

      Go to IAM
    2. Select the project.
    3. In the Principal column, find all rows that identify you or a group that you're included in. To learn which groups you're included in, contact your administrator.

    4. For all rows that specify or include you, check the Role column to see whether the list of roles includes the required roles.

    Grant the roles

    1. In the Google Cloud console, go to the IAM page.

      前往「IAM」頁面
    2. 選取專案。
    3. 按一下「授予存取權」
    4. 在「New principals」(新增主體) 欄位中,輸入您的使用者 ID。 這通常是 Google 帳戶的電子郵件地址。

    5. 在「Select a role」(選取角色) 清單中,選取角色。
    6. 如要授予其他角色,請按一下 「新增其他角色」,然後新增每個其他角色。
    7. 按一下 [Save]
  10. 建立 Cloud Storage bucket:
    1. In the Google Cloud console, go to the Cloud Storage Buckets page.

      Go to Buckets

    2. Click Create.
    3. On the Create a bucket page, enter your bucket information. To go to the next step, click Continue.
      1. For Name your bucket, enter a unique bucket name. Don't include sensitive information in the bucket name, because the bucket namespace is global and publicly visible.
      2. In the Choose where to store your data section, do the following:
        1. Select a Location type.
        2. Choose a location where your bucket's data is permanently stored from the Location type drop-down menu.
        3. To set up cross-bucket replication, select Add cross-bucket replication via Storage Transfer Service and follow these steps:

          Set up cross-bucket replication

          1. In the Bucket menu, select a bucket.
          2. In the Replication settings section, click Configure to configure settings for the replication job.

            The Configure cross-bucket replication pane appears.

            • To filter objects to replicate by object name prefix, enter a prefix that you want to include or exclude objects from, then click Add a prefix.
            • To set a storage class for the replicated objects, select a storage class from the Storage class menu. If you skip this step, the replicated objects will use the destination bucket's storage class by default.
            • Click Done.
      3. In the Choose how to store your data section, do the following:
        1. In the Set a default class section, select the following: Standard.
        2. To enable hierarchical namespace, in the Optimize storage for data-intensive workloads section, select Enable hierarchical namespace on this bucket.
      4. In the Choose how to control access to objects section, select whether or not your bucket enforces public access prevention, and select an access control method for your bucket's objects.
      5. In the Choose how to protect object data section, do the following:
        • Select any of the options under Data protection that you want to set for your bucket.
          • To enable soft delete, click the Soft delete policy (For data recovery) checkbox, and specify the number of days you want to retain objects after deletion.
          • To set Object Versioning, click the Object versioning (For version control) checkbox, and specify the maximum number of versions per object and the number of days after which the noncurrent versions expire.
          • To enable the retention policy on objects and buckets, click the Retention (For compliance) checkbox, and then do the following:
            • To enable Object Retention Lock, click the Enable object retention checkbox.
            • To enable Bucket Lock, click the Set bucket retention policy checkbox, and choose a unit of time and a length of time for your retention period.
        • To choose how your object data will be encrypted, expand the Data encryption section (), and select a Data encryption method.
    4. Click Create.

建立湖泊

湖泊是代表資料網域或業務單位的邏輯建構體。舉例來說,如要依群組用量整理資料,請為每個部門 (例如零售、銷售和財務) 建立 lake。

下列步驟說明如何使用 Google Cloud 控制台建立資料湖。

  1. 前往 Google Cloud 控制台的 Dataplex Universal Catalog。

    前往 Dataplex Universal Catalog

  2. 前往「管理」檢視畫面。

  3. 按一下「 Create」(建立)

  4. 輸入顯示名稱

  5. 系統會自動產生湖泊 ID。

  6. 指定要建立資料湖泊的「Region」(區域)

    如果是在特定區域 (例如 us-central1) 建立的湖泊,可以根據可用區設定來附加單一區域 (us-central1) 資料和多區域 (us multi-region) 資料。

  7. 點選「建立」

在 lake 中新增儲存區

建立 lake 後,就能在 lake 中新增儲存區。儲存區是 lake 中的邏輯分組,有助於分類結構化和非結構化資料。

  1. 在「管理」檢視畫面中,按一下要新增可用區的湖泊名稱。

  2. 按一下 「新增區域」

  3. 輸入區域的顯示名稱

  4. 按一下「類型」下拉式選單。選擇「Raw Zone」(原始可用區) 或「Curated Zone」(收錄的可用區)。進一步瞭解區域類型

  5. 在「資料位置」下方,選取「區域性」或「多區域」。 選定後即無法變更。在同一個可用區中,單一區域和多區域的資料不得混用。

  6. 點選「建立」

可用區應該會在幾分鐘內建立。

附加資產

資料可以儲存在 Cloud Storage bucket 或 BigQuery 資料集中,並可做為資產,附加至 Dataplex Universal Catalog lake 中的資料區域。

如要將 Cloud Storage bucket 附加為資產,請按照下列步驟操作:

  1. 在「管理」檢視畫面中,按一下要附加 Cloud Storage bucket 的湖泊名稱。

  2. 在「區域」分頁中,按一下要新增資產的區域。

  3. 在「資產」分頁中,按一下「新增資產」

  4. 點選「Add an asset」

  5. 在「Type」(類型) 下方,選取「Storage bucket」(儲存空間 bucket)

  6. 在「顯示名稱」下方輸入資產名稱。

  7. 在「Bucket」欄位中,按一下「Browse」(瀏覽)。如果您有 Cloud Storage 值區,請找出該值區並按一下「選取」。如果沒有 Cloud Storage bucket,可以點選 按鈕建立一個。

    1. 輸入 bucket 的專屬名稱。按一下「繼續」

    2. 選擇「位置類型」。按一下「繼續」

    3. 為資料選擇預設儲存空間級別。按一下「繼續」

    4. 選擇存取權控管層級。按一下「繼續」

    5. 選擇資料保護選項或「無」。按一下「繼續」

    6. 點選「建立」

    7. 按一下「Select」(選取)

  8. 按一下 [完成]

  9. 按一下「繼續」

  10. 在「探索功能設定」部分,選取「繼承」來繼承儲存區層級的「探索功能設定」

  11. 按一下「繼續」

  12. 在「新增資產」下方,按一下「提交」

等待資產建立完成。

如要使用資料湖,請參閱「後續步驟」一節。否則,請按照清除步驟刪除您建立的資源。

清除所用資源

如要避免系統向您的 Google Cloud 帳戶收取本頁所用資源的費用,請按照下列步驟操作。

  1. In the Google Cloud console, go to the Manage resources page.

    Go to Manage resources

  2. If the project that you plan to delete is attached to an organization, expand the Organization list in the Name column.
  3. In the project list, select the project that you want to delete, and then click Delete.
  4. In the dialog, type the project ID, and then click Shut down to delete the project.

或者,您也可以刪除本教學課程中使用的資源。您必須刪除所有資料區域資源,才能刪除湖泊。同樣地,除非刪除資料區域的所有資產資源,否則資料區域不會遭到刪除。

卸離儲存空間值區

如要取消連結您建立的 Dataplex Universal Catalog 資產,請按照下列步驟操作:

  1. 前往 Google Cloud 控制台的 Dataplex Universal Catalog。

    前往 Dataplex Universal Catalog

  2. 在「管理」檢視畫面中,按一下您建立的湖泊名稱。

  3. 在「可用區」分頁中,點選您建立的可用區名稱。

  4. 在「資產」分頁中,勾選值區名稱左側的方塊,選取要卸離的資產。

  5. 按一下「刪除資產」

  6. 按一下「刪除」確認解除連結。

刪除區域

如要刪除您建立的 Dataplex Universal Catalog 區域,請按照下列步驟操作:

  1. 前往 Google Cloud 控制台的 Dataplex Universal Catalog。

    前往 Dataplex Universal Catalog

  2. 在「管理」檢視畫面中,按一下您建立的 lake。

  3. 在「可用區」分頁中,勾選資料可用區名稱左側的方塊,選取要刪除的可用區。

  4. 按一下「刪除區域」

  5. 點選「刪除」即可確認刪除。

刪除 lake

下列步驟說明如何刪除您建立的 Dataplex Universal Catalog 湖泊。

  1. 前往 Google Cloud 控制台的 Dataplex Universal Catalog。

    前往 Dataplex Universal Catalog

  2. 在「管理」檢視畫面中,按一下您建立的 lake。

  3. 按一下頁面頂端的「刪除」

  4. 在欄位中輸入「delete」,確認刪除。

  5. 按一下「刪除 Lake」確認刪除。

後續步驟