使用模板创建集群

本页面介绍了如何使用内嵌 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 角色:

服务账号角色

如需确保 Compute Engine 默认服务账号具有创建 Managed Service for Apache Spark 集群所需的权限,请让您的管理员为 Compute Engine 默认服务账号授予项目的 Dataproc Worker (roles/dataproc.worker) IAM 角色。

创建集群

在运行 Managed Service for Apache Spark 作业之前,您需要创建一个虚拟机集群来运行它们。如需在项目中创建 Managed Service for Apache Spark 集群,请填写并执行此页面上的 Google APIs Explorer 试用此方法 模板(滚动或点击试用!即可前往该模板)。

  1. 请求参数

    1. 插入您的 projectId
    2. 指定您的集群将位于的区域(接受或替换“us-central1”)。由于您未在本快速入门中指定区域内的可用区,因此 Managed Service for Apache Spark 自动选择可用区功能将在要创建集群的区域内选择一个可用区。
  2. 请求正文:

    1. 指定 clusterName(接受或替换“example-cluster”)。您将使用此名称与集群进行交互,例如提交作业更新集群
  3. 点击执行。首次运行 API 模板时,系统可能会要求您选择并登录您的 Google 账号,然后授权 Google API Explorer 访问您的账号。如果请求成功,JSON 响应会显示集群正在等待创建。

  4. 如需确认集群创建,请打开 Google Cloud 控制台中的 Managed Service for Apache Spark 集群页面。集群预配完成后,集群的状态将显示为“正在运行”。

清理

为避免因本页中使用的资源导致您的 Google Cloud 账号产生费用,请按照以下步骤操作。

  1. 如果您不需要使用集群来探索其他快速入门或运行其他作业,请使用 APIs ExplorerGoogle Cloud 控制台、gcloud CLI gcloud 命令行工具或 Cloud 客户端库删除集群。

后续步骤