建立資料 pipeline

本快速入門導覽課程會說明如何執行下列操作:

  1. 建立 Cloud Data Fusion 執行個體。
  2. 部署 Cloud Data Fusion 執行個體隨附的範例管道。管道會執行下列動作:
    1. 讀取 Cloud Storage 中含有 NYT 暢銷書資料的 JSON 檔案。
    2. 執行檔案轉換,以剖析及清除資料。
    3. 將上週低於 $25 美元的最佳評選書籍載入 BigQuery 中。

事前準備

  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. Enable the Cloud Data Fusion API.

    Enable the API

  4. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  5. Enable the Cloud Data Fusion API.

    Enable the API

建立 Cloud Data Fusion 執行個體

  1. 按一下「建立執行個體」

    前往「Instances」(執行個體) 頁面

  2. 輸入「Instance name」(執行個體名稱)
  3. 輸入執行個體的說明
  4. 輸入要建立執行個體的「Region」(區域)
  5. 選擇要使用的 Cloud Data Fusion 版本
  6. 選擇 Cloud Data Fusion 版本
  7. 如果是 Cloud Data Fusion 6.2.3 以上版本,請在「授權」欄位中,選擇要用於在 Dataproc 中執行 Cloud Data Fusion 管道的 Dataproc 服務帳戶。系統會預先選取預設值「Compute Engine 帳戶」。
  8. 按一下 [Create] (建立)。執行個體建立程序最多需要 30 分鐘才會完成。 Cloud Data Fusion 建立執行個體時,「Instances」(執行個體) 頁面上的執行個體名稱旁會顯示進度輪。完成後,這個圖示會變成綠色的勾號圖案,代表您可以開始使用這個執行個體。

使用 Cloud Data Fusion 時,您會同時使用 Google Cloud 主控台 和獨立的 Cloud Data Fusion 網頁介面。

  • 在 Google Cloud 控制台中,您可以執行下列操作:

    • 建立 Google Cloud 控制台專案
    • 建立及刪除 Cloud Data Fusion 執行個體
    • 查看 Cloud Data Fusion 執行個體詳細資料
  • 在 Cloud Data Fusion 網頁介面中,您可以使用各種頁面 (例如「Studio」或「Wrangler」),運用 Cloud Data Fusion 功能。

如要瀏覽 Cloud Data Fusion 介面,請按照下列步驟操作:

  1. 在 Google Cloud 控制台中,開啟「Instances」(執行個體) 頁面。

    前往「Instances」(執行個體) 頁面

  2. 在執行個體的「動作」欄中,按一下「查看執行個體」連結。
  3. 在 Cloud Data Fusion 網頁介面中,使用左側導覽面板前往所需頁面。

部署樣本管道

透過 Cloud Data Fusion Hub 可取得範例管道,您可以在這裡分享可重複使用的 Cloud Data Fusion 管道、外掛程式和解決方案。

  1. 在 Cloud Data Fusion 網頁介面中,按一下「Hub」
  2. 按一下左側面板中的「管道」
  3. 按一下「Cloud Data Fusion Quickstart」(Cloud Data Fusion 快速入門) 管道。
  4. 點選「建立」
  5. 在 Cloud Data Fusion 快速入門設定面板中,按一下「完成」
  6. 按一下「自訂管道」

    管道的視覺化表示方式會顯示在「Studio」頁面上,這個頁面是開發資料整合管道的圖形介面。左側會列出可用的管道外掛程式,管道則會顯示在主畫布區域。將游標懸停在每個管道節點上,然後按一下「Properties」(屬性),即可探索管道。每個節點的「屬性」選單可讓您查看與節點相關聯的物件和作業。

  7. 按一下右上選單中的「Deploy」。這個步驟會將管道提交至 Cloud Data Fusion。在本快速入門導覽課程的下一節中,您將執行管道。

部署管道

檢視您的管道

部署的管道會顯示在管道詳細資料檢視畫面中,您可以在這裡執行下列操作:

  • 查看管道的結構和設定。
  • 手動執行管道或設定時間表或觸發條件。
  • 查看管道的執行歷史摘要,包括執行次數、記錄檔和指標。

複製服務帳戶

執行管道

在管道詳細資料檢視畫面中,按一下「執行」即可執行管道。

執行管道

執行管道時,Cloud Data Fusion 會執行下列動作:

  1. 佈建暫時性 Dataproc 叢集
  2. 使用 Apache Spark 在叢集上執行管道
  3. 刪除叢集

查看結果

管道會在幾分鐘後完成。管道狀態會變更為「Succeeded」(已完成),並顯示每個節點處理的記錄筆數。

管道執行作業完成

  1. 前往 BigQuery 網頁介面
  2. 如要查看結果範例,請前往專案中的 DataFusionQuickstart 資料集,點選 top_rated_inexpensive 資料表,然後執行簡單的查詢。例如:

    SELECT * FROM PROJECT_ID.GCPQuickStart.top_rated_inexpensive LIMIT 10
    

    PROJECT_ID 替換為您的專案 ID。

查看結果

清除所用資源

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

  1. 刪除 BigQuery 資料集,該資料集是您在此快速入門的管道所寫入的標的。
  2. 刪除 Cloud Data Fusion 執行個體

  3. 選用:刪除專案。

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

    Go to Manage resources

  2. In the project list, select the project that you want to delete, and then click Delete.
  3. In the dialog, type the project ID, and then click Shut down to delete the project.

後續步驟