Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Crea un cluster Dataproc
Requisiti:
Nome:il nome del cluster deve iniziare con una lettera minuscola seguita da un massimo di 51 lettere minuscole, numeri e trattini e non può terminare con un trattino.
Regione del cluster:devi specificare una regione Compute Engine per
il cluster, ad esempio us-east1 o europe-west1, per
isolare le risorse del cluster, come le istanze VM e i metadati del cluster archiviati in
Cloud Storage, all'interno della regione.
Per ulteriori informazioni sugli endpoint regionali, consulta la sezione Endpoint regionali.
Per informazioni sulla selezione di una regione, consulta Regioni e zone disponibili. Puoi anche eseguire il comando
gcloud compute regions list per visualizzare un elenco delle regioni disponibili.
Il comando crea un cluster con le impostazioni predefinite del servizio Dataproc
per le istanze di macchine virtuali master e worker, le dimensioni e i tipi di disco,
il tipo di rete, la regione e la zona in cui viene eseguito il deployment del cluster e altre impostazioni
del cluster. Consulta il
comando gcloud dataproc clusters create
per informazioni sull'utilizzo dei flag della riga di comando per personalizzare le impostazioni del cluster.
Crea un cluster con un file YAML
Esegui il seguente comando gcloud per esportare la configurazione
di un cluster Dataproc esistente in un file cluster.yaml.
Nota:durante l'operazione di esportazione, i campi specifici del cluster,
come il nome del cluster, i campi di sola visualizzazione e le etichette applicate automaticamente vengono
filtrati. Questi campi non sono consentiti nel file YAML importato utilizzato per creare un cluster.
REST
Questa sezione mostra come creare un cluster con i valori richiesti e
la configurazione predefinita (1 master, 2 worker).
Prima di utilizzare i dati della richiesta,
apporta le seguenti sostituzioni:
CLUSTER_NAME: nome del cluster
PROJECT: Google Cloud ID progetto
REGION: una regione di Compute Engine disponibile in cui verrà creato il cluster.
ZONE: una zona facoltativa
all'interno della regione selezionata in cui verrà creato il cluster.
Metodo HTTP e URL:
POST https://dataproc.googleapis.com/v1/projects/PROJECT/regions/REGION/clusters
Apri la pagina Dataproc
Crea un cluster
nella console Google Cloud nel browser, quindi
fai clic su Crea nella riga del cluster su Compute Engine
nella pagina Crea un cluster Dataproc su Compute Engine. Il riquadro
Configura cluster è selezionato con i campi compilati con i valori predefiniti. Puoi
selezionare ogni pannello e confermare o modificare i valori predefiniti per personalizzare il cluster.
Fai clic su Crea per creare il cluster. Il nome del cluster viene visualizzato nella pagina
Cluster e il suo stato viene aggiornato a In esecuzione dopo
il provisioning del cluster. Fai clic sul nome del cluster per aprire la pagina dei dettagli del cluster, dove puoi esaminare job, istanze e impostazioni di configurazione per il cluster e connetterti alle interfacce web in esecuzione sul cluster.
importcom.google.api.gax.longrunning.OperationFuture;importcom.google.cloud.dataproc.v1.Cluster;importcom.google.cloud.dataproc.v1.ClusterConfig;importcom.google.cloud.dataproc.v1.ClusterControllerClient;importcom.google.cloud.dataproc.v1.ClusterControllerSettings;importcom.google.cloud.dataproc.v1.ClusterOperationMetadata;importcom.google.cloud.dataproc.v1.InstanceGroupConfig;importjava.io.IOException;importjava.util.concurrent.ExecutionException;publicclassCreateCluster{publicstaticvoidcreateCluster()throwsIOException,InterruptedException{// TODO(developer): Replace these variables before running the sample.StringprojectId="your-project-id";Stringregion="your-project-region";StringclusterName="your-cluster-name";createCluster(projectId,region,clusterName);}publicstaticvoidcreateCluster(StringprojectId,Stringregion,StringclusterName)throwsIOException,InterruptedException{StringmyEndpoint=String.format("%s-dataproc.googleapis.com:443",region);// Configure the settings for the cluster controller client.ClusterControllerSettingsclusterControllerSettings=ClusterControllerSettings.newBuilder().setEndpoint(myEndpoint).build();// Create a cluster controller client with the configured settings. The client only needs to be// created once and can be reused for multiple requests. Using a try-with-resources// closes the client, but this can also be done manually with the .close() method.try(ClusterControllerClientclusterControllerClient=ClusterControllerClient.create(clusterControllerSettings)){// Configure the settings for our cluster.InstanceGroupConfigmasterConfig=InstanceGroupConfig.newBuilder().setMachineTypeUri("n1-standard-2").setNumInstances(1).build();InstanceGroupConfigworkerConfig=InstanceGroupConfig.newBuilder().setMachineTypeUri("n1-standard-2").setNumInstances(2).build();ClusterConfigclusterConfig=ClusterConfig.newBuilder().setMasterConfig(masterConfig).setWorkerConfig(workerConfig).build();// Create the cluster object with the desired cluster config.Clustercluster=Cluster.newBuilder().setClusterName(clusterName).setConfig(clusterConfig).build();// Create the Cloud Dataproc cluster.OperationFuture<Cluster,ClusterOperationMetadata>createClusterAsyncRequest=clusterControllerClient.createClusterAsync(projectId,region,cluster);Clusterresponse=createClusterAsyncRequest.get();// Print out a success message.System.out.printf("Cluster created successfully: %s",response.getClusterName());}catch(ExecutionExceptione){System.err.println(String.format("Error executing createCluster: %s ",e.getMessage()));}}}
constdataproc=require('@google-cloud/dataproc');// TODO(developer): Uncomment and set the following variables// projectId = 'YOUR_PROJECT_ID'// region = 'YOUR_CLUSTER_REGION'// clusterName = 'YOUR_CLUSTER_NAME'// Create a client with the endpoint set to the desired cluster regionconstclient=newdataproc.v1.ClusterControllerClient({apiEndpoint:`${region}-dataproc.googleapis.com`,projectId:projectId,});asyncfunctioncreateCluster(){// Create the cluster configconstrequest={projectId:projectId,region:region,cluster:{clusterName:clusterName,config:{masterConfig:{numInstances:1,machineTypeUri:'n1-standard-2',},workerConfig:{numInstances:2,machineTypeUri:'n1-standard-2',},},},};// Create the clusterconst[operation]=awaitclient.createCluster(request);const[response]=awaitoperation.promise();// Output a success messageconsole.log(`Cluster created successfully: ${response.clusterName}`);
fromgoogle.cloudimportdataproc_v1asdataprocdefcreate_cluster(project_id,region,cluster_name):"""This sample walks a user through creating a Cloud Dataproc cluster using the Python client library. Args: project_id (string): Project to use for creating resources. region (string): Region where the resources should live. cluster_name (string): Name to use for creating a cluster. """# Create a client with the endpoint set to the desired cluster region.cluster_client=dataproc.ClusterControllerClient(client_options={"api_endpoint":f"{region}-dataproc.googleapis.com:443"})# Create the cluster config.cluster={"project_id":project_id,"cluster_name":cluster_name,"config":{"master_config":{"num_instances":1,"machine_type_uri":"n1-standard-2"},"worker_config":{"num_instances":2,"machine_type_uri":"n1-standard-2"},},}# Create the cluster.operation=cluster_client.create_cluster(request={"project_id":project_id,"region":region,"cluster":cluster})result=operation.result()# Output a success message.print(f"Cluster created successfully: {result.cluster_name}")
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-08-22 UTC."],[[["Dataproc restricts the creation of clusters with image versions older than 1.3.95, 1.4.77, 1.5.53, and 2.0.27 to mitigate Apache Log4j security vulnerabilities, and it also blocks clusters on Dataproc image versions 0.x, 1.0.x, 1.1.x, and 1.2.x."],["It's recommended to utilize the latest sub-minor image versions for Dataproc clusters, such as 2.0.29, 1.5.55, and 1.4.79 or later, which include log4j.2.17.1, for enhanced security."],["Creating a Dataproc cluster requires a name that starts with a lowercase letter, up to 51 lowercase letters, numbers, and hyphens, and must not end with a hyphen, as well as specifying a Compute Engine region for resource isolation."],["The most common methods for creating a cluster are using `gcloud` commands, by importing a YAML configuration file, or by using the Dataproc API REST requests; the Google Cloud Console is also an option for cluster creation."],["Full internal IP networking cross connectivity is required for master and worker VMs in a Dataproc cluster, which is provided by the `default` VPC network."]]],[]]