使用範本建立 Dataproc 叢集

本頁說明如何使用內嵌 Google APIs Explorer 範本呼叫 Dataproc API,建立 Dataproc 叢集。

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

事前準備

  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.

    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 billing is enabled for your Google Cloud project.

  4. 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

  5. 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

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

  7. 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

  8. 建立叢集

    執行 Dataproc 工作前,必須先建立要用來執行工作的虛擬機器叢集。為了能順利在專案中建立 Dataproc 叢集,請填寫並執行 Google APIs Explorer「Try this API」(試用這個 API) 範本。

    1. 要求參數:

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

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

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

    清除所用資源

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

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

    後續步驟