Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Aggiornare un cluster Dataproc utilizzando un modello
Questa pagina mostra come utilizzare un modello Explorer API di Google per aggiornare un cluster Dataproc in modo da modificare il numero di worker in un cluster. Eseguire la scalabilità di un cluster
per includere più worker è un'attività comune quando sono necessari worker aggiuntivi per elaborare job di dimensioni maggiori.
Per altri modi per aggiornare un cluster Dataproc, consulta:
Specifica la regione in cui si trova il tuo cluster (conferma o sostituisci "us-central1").
La regione del cluster è elencata nella pagina Cluster di Dataproc nella Google Cloud console.
Specifica il clusterName del cluster esistente che stai aggiornando (conferma o sostituisci "example-cluster").
updateMask:
"config.worker_config.num_instances". Si tratta del PATH JSON relativo alla risorsa Cluster al parametro numInstances da aggiornare (vedi le istruzioni per il corpo della richiesta).
Corpo della richiesta:
config.workerConfig.numInstances:
("3": il nuovo numero di worker). Puoi modificare questo valore per aggiungere meno o più worker. Ad esempio, se il tuo cluster standard ha il numero predefinito di 2 worker, specificando "3" verrà aggiunto un worker; specificando "4" verranno aggiunti 2 worker.
Un cluster Dataproc standard deve avere almeno 2 worker.
Fai clic su EXECUTE (ESEGUI). La prima volta che esegui il modello di API, potrebbe esserti chiesto di scegliere e accedere al tuo Account Google, quindi di autorizzare Google APIs Explorer ad accedere al tuo account. Se la richiesta riesce, la risposta JSON
indica che l'aggiornamento del cluster è in attesa.
Per verificare che il numero di worker nel cluster sia stato aggiornato,
apri la pagina Dataproc
Cluster nella Google Cloud console
e visualizza la colonna Nodi worker totali del cluster. Potrebbe essere necessario fare clic su AGGIorna nella parte superiore della pagina per visualizzare il valore aggiornato al termine dell'aggiornamento del cluster.
Esegui la pulizia
Per evitare che al tuo account Google Cloud vengano addebitati costi relativi alle risorse utilizzate su questa pagina, segui questi passaggi.
[[["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-09-08 UTC."],[[["\u003cp\u003eThis guide details how to update a Dataproc cluster's worker count using the Google APIs Explorer template.\u003c/p\u003e\n"],["\u003cp\u003eUpdating the worker count is done through the \u003ccode\u003econfig.workerConfig.numInstances\u003c/code\u003e parameter, where you can specify the desired number of workers.\u003c/p\u003e\n"],["\u003cp\u003eBefore making an update, you must specify your project ID, the region of your cluster, and the name of the existing cluster to modify.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eupdateMask\u003c/code\u003e parameter with a value of "config.worker_config.num_instances" is required to successfully update the worker count.\u003c/p\u003e\n"],["\u003cp\u003eAfter executing the update, you can confirm the change by checking the "Total worker nodes" column on the Dataproc Clusters page.\u003c/p\u003e\n"]]],[],null,["Update a Dataproc cluster by using a template This page shows you how to use an [Google APIs Explorer](https://developers.google.com/apis-explorer/#p/) template to\nupdate a Dataproc cluster to change the number of workers in a\ncluster. [Scaling a cluster](/dataproc/docs/concepts/configuring-clusters/scaling-clusters)\nup to include more workers is a common task when additional workers are needed\nto process larger jobs.\n\nFor other ways to update a Dataproc cluster, see:\n\n- [Create a Dataproc cluster by using the Google Cloud console](/dataproc/docs/quickstarts/create-cluster-console#update_a_cluster)\n- [Create a Dataproc cluster by using the Google Cloud CLI](/dataproc/docs/quickstarts/create-cluster-gcloud#update_a_cluster)\n- [Create a Dataproc cluster by using client libraries](/dataproc/docs/quickstarts/create-cluster-client-libraries)\n\nBefore you begin This quickstart assumes you have already created a Dataproc cluster. You can use the [APIs Explorer](/dataproc/docs/quickstarts/create-cluster-template), the [Google Cloud console](/dataproc/docs/quickstarts/update-cluster-console#create_a_cluster), the gcloud CLI [gcloud](/dataproc/docs/quickstarts/update-cluster-gcloud#create_a_cluster) command-line tool, or the [Quickstarts using Cloud Client Libraries](/dataproc/docs/quickstarts/create-cluster-client-libraries) to create a cluster.\n\n\u003cbr /\u003e\n\nUpdate a cluster\n\nTo update the number of workers in your cluster, fill in and execute the\nGoogle APIs Explorer **Try this API** template.\n| **Note:** The `region`, `clusterName` and `updateMask` and `config.workerConfig.numInstances` parameter values are filled in for you. Confirm or replace the `region` and`clusterName` parameter values to match your cluster's region and name. The `updateMask` parameter value is required to update the number of workers in your cluster. You can accept or change the `config.workerConfig.numInstances` parameter value.\n\n1. **Request parameters:**\n\n 1. Insert your [**projectId**](https://console.cloud.google.com/).\n 2. Specify the [**region**](/compute/docs/regions-zones/regions-zones#available) where your cluster is located (confirm or replace \"us-central1\"). Your cluster's region is listed on the Dataproc [**Clusters**](https://console.cloud.google.com/dataproc/clusters) page in the Google Cloud console.\n 3. Specify the [**clusterName**](/dataproc/docs/reference/rest/v1/projects.regions.clusters/patch#body.PATH_PARAMETERS.cluster_name) of the existing cluster that you are updating (confirm or replace \"example-cluster\").\n 4. [**updateMask**](/dataproc/docs/reference/rest/v1/projects.regions.clusters/patch): \"config.worker_config.num_instances\". This is the JSON PATH relative to the [Cluster](/dataproc/docs/reference/rest/v1/projects.regions.clusters#resource:-cluster) resource to the `numInstances` parameter to be updated (see the Request body instructions).\n2. **Request body:**\n\n 1. [**config.workerConfig.numInstances**](/dataproc/docs/reference/rest/v1/ClusterConfig#InstanceGroupConfig.FIELDS.num_instances): (\"3\": the new number of workers). You can change this value to add fewer or more workers. For example, if your standard cluster has the default number of 2 workers, specifying \"3\" will add 1 worker; specifying \"4 will add 2). A standard Dataproc cluster must have at least 2 workers.\n3. Click **EXECUTE**. The first time you\n run the API template, you may be asked to choose and sign into\n your Google account, then authorize the Google APIs Explorer to access your\n account. If the request is successful, the JSON response\n shows that cluster update is pending.\n\n4. To confirm that the number of workers in the cluster has been updated,\n open the Dataproc\n [Clusters](https://console.cloud.google.com/dataproc/clusters) page in the Google Cloud console\n and view the cluster's **Total worker nodes** column. You may need\n to click REFRESH at the top of the page to view the updated value after the\n cluster update completes.\n\nClean up\n\n\nTo avoid incurring charges to your Google Cloud account for\nthe resources used on this page, follow these steps.\n\n1. If you don't need the cluster to explore the other quickstarts or to run other jobs, use the [APIs Explorer](/dataproc/docs/quickstarts/quickstart-explorer-delete), the [Google Cloud console](/dataproc/docs/quickstarts/update-cluster-console#delete_a_cluster), the gcloud CLI [gcloud](/dataproc/docs/quickstarts/update-cluster-gcloud#delete_a_cluster) command-line tool, or the [Quickstarts using Cloud Client Libraries](/dataproc/docs/quickstarts/create-cluster-client-libraries) to delete the cluster.\n\nWhat's next\n\n- You can use this quickstart template to restore the cluster to its previous\n `workerConfig.numInstances` value.\n\n- Learn how to [write and run a Spark Scala job](/dataproc/docs/tutorials/spark-scala)."]]