使用範本建立叢集

本頁說明如何使用內嵌 Google APIs Explorer 範本建立 Managed Service for Apache Spark 叢集。

如要瞭解其他叢集建立方式,請參閱:

事前準備

  1. 登入 Google Cloud 帳戶。如果您是 Google Cloud新手,歡迎 建立帳戶,親自評估產品在實際工作環境中的成效。新客戶還能獲得價值 $300 美元的免費抵免額,可用於執行、測試及部署工作負載。
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  3. Verify that you have the permissions required to complete this guide.

  4. Verify that billing is enabled for your Google Cloud project.

  5. Enable the Dataproc API.

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains the serviceusage.services.enable permission. Learn how to grant roles.

    Enable the API

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

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  7. Verify that you have the permissions required to complete this guide.

  8. Verify that billing is enabled for your Google Cloud project.

  9. Enable the Dataproc API.

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains the serviceusage.services.enable permission. Learn how to grant roles.

    Enable the API

必要的角色

如要執行本頁的範例,您必須具備特定 IAM 角色。視組織政策而定,系統可能已授予這些角色。如要檢查角色授予情形,請參閱「是否需要授予角色?」一節。

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

使用者角色

如要取得建立 Managed Service for Apache Spark 叢集所需的權限,請要求管理員授予您下列 IAM 角色:

  • 專案的 Dataproc 編輯者 (roles/dataproc.editor)
  • Compute Engine 預設服務帳戶的「服務帳戶使用者」 (roles/iam.serviceAccountUser)

服務帳戶角色

為確保 Compute Engine 預設服務帳戶具備建立 Managed Service for Apache Spark 叢集的必要權限,請要求管理員在專案中,將 Dataproc Worker (roles/dataproc.worker) IAM 角色授予 Compute Engine 預設服務帳戶。

建立叢集

執行 Managed Service for Apache Spark 工作前,必須先建立要用來執行工作的虛擬機器叢集。如要在專案中建立 Managed Service for Apache Spark 叢集,請填寫並執行這個頁面上的 Google APIs Explorer「Try this Method」(試用這個方法) 範本 (捲動或按一下「Try it!」(試用!) 即可前往範本)。

  1. 要求參數:

    1. 插入 projectId
    2. 指定叢集所在的區域 (使用或更改「us-central1」)。由於您在本快速入門導覽課程中未指定區域內的可用區,「Managed Service for Apache Spark 自動選擇可用區位置」功能會從區域內自動選擇要建立叢集的可用區。
  2. 要求主體:

    1. 指定 clusterName (使用或更改「example-cluster」)。您將使用此名稱與叢集互動,例如提交工作更新叢集
  3. 點選「Execute」(執行)。首次執行 API 範本時,系統可能會要求您選擇並登入 Google 帳戶,然後授權 Google APIs Explorer 存取您的帳戶。如果要求成功,JSON 回應會顯示叢集建立作業尚待處理。

  4. 如要確認叢集是否建立完成,請在 Google Cloud 控制台中開啟「Managed Service for Apache Spark Clusters」(Apache Spark 叢集代管服務) 頁面。叢集佈建完成後,狀態會顯示為「Running」(執行中)。

清除所用資源

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

  1. 如果您不需要叢集來探索其他快速入門導覽課程或執行其他工作,請使用 APIs ExplorerGoogle Cloud 主控台、gcloud CLI gcloud 指令列工具或 Cloud 用戶端程式庫刪除叢集。

後續步驟