集群区域

创建 Dataproc 集群时,您需要指定一个 Compute Engine 区域,例如“us-east1”或“europe-west1”。Dataproc 会在指定区域内的某个可用区内隔离集群资源,例如虚拟机实例、Cloud Storage 和元数据存储。

您可以在创建集群时酌情指定集群区域(例如“us-east1-a”或“europe-west1-b”)内的某个可用区。如果您未指定可用区,Dataproc 自动选择可用区将在指定的集群区域内选择一个可用区来定位集群资源。

区域命名空间与 Dataproc 资源 URI 中的 /regions/REGION 部分相对应(例如,请参阅集群 networkUri)。

地区名称

区域名称遵循基于 Compute Engine 区域的标准命名约定。例如,美国中部区域的名称为 us-central1,西欧区域的名称为 europe-west1。运行 gcloud compute regions list 命令以查看可用区域的列表。

位置和区域级端点

Google Cloud API 可以为位置区域端点提供支持:

  • 位置端点可确保通过专用连接访问传输中的数据时,这些数据保留在指定位置。

    格式:{location}-{service}.googleapis.com

    示例:us-central-1-dataproc.googleapis.com

  • 区域端点可确保通过专用连接或公共互联网访问数据时,传输中的数据始终保留在指定位置。

    格式:{service}.{location}.rep.googleapis.com

    示例:dataproc.us-central1.rep.googleapis.com

默认 Dataproc 端点为位置端点。 如需了解 Dataproc 对区域端点的支持情况,请参阅 Dataproc 版本说明

创建集群

gcloud CLI

创建集群时,请使用必需的 --region 标志指定区域。

gcloud dataproc clusters create CLUSTER_NAME \
    --region=REGION \
    other args ...

REST API

clusters.create 请求中使用 REGION 网址参数指定集群区域。

gRPC

使用以下模式将客户端传输地址设置为位置端点:

REGION-dataproc.googleapis.com

Python (google-cloud-python) 示例

from google.cloud import dataproc_v1
from google.cloud.dataproc_v1.gapic.transports import cluster_controller_grpc_transport

transport = cluster_controller_grpc_transport.ClusterControllerGrpcTransport(
    address='us-central1-dataproc.googleapis.com:443')
client = dataproc_v1.ClusterControllerClient(transport)

project_id = 'my-project'
region = 'us-central1'
cluster = {...}

Java (google-cloud-java) 示例

ClusterControllerSettings settings =
     ClusterControllerSettings.newBuilder()
        .setEndpoint("us-central1-dataproc.googleapis.com:443")
        .build();
 try (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create(settings)) {
   String projectId = "my-project";
   String region = "us-central1";
   Cluster cluster = Cluster.newBuilder().build();
   Cluster response =
       clusterControllerClient.createClusterAsync(projectId, region, cluster).get();
 }

控制台

在 Google Cloud 控制台的 Dataproc 创建集群页面上的设置集群面板的“位置”部分中,指定 Dataproc 区域。

后续步骤