Organízate con las colecciones
Guarda y clasifica el contenido según tus preferencias.
Actualizar un clúster de Dataproc mediante una plantilla
En esta página se muestra cómo usar una plantilla de Explorador de APIs de Google para actualizar un clúster de Dataproc y cambiar el número de trabajadores que contiene. Ampliar un clúster para incluir más trabajadores es una tarea habitual cuando se necesitan trabajadores adicionales para procesar tareas más grandes.
Para ver otras formas de actualizar un clúster de Dataproc, consulta los siguientes artículos:
Especifica la región
en la que se encuentra tu clúster (confirma o sustituye "us-central1").
La región de tu clúster se indica en la página Clústeres de Dataproc en la consola de Google Cloud .
Especifica el clusterName
del clúster que quieres actualizar (confirma o sustituye "example-cluster").
updateMask:
"config.worker_config.num_instances". Es la ruta JSON relativa al recurso Cluster del parámetro numInstances que se va a actualizar (consulta las instrucciones del cuerpo de la solicitud).
Cuerpo de la solicitud:
config.workerConfig.numInstances:
("3": el nuevo número de trabajadores). Puedes cambiar este valor para añadir más o menos trabajadores. Por ejemplo, si tu clúster estándar tiene el número predeterminado de 2 trabajadores, al especificar "3" se añadirá 1 trabajador y, al especificar "4", se añadirán 2.
Un clúster de Dataproc estándar debe tener al menos 2 trabajadores.
Haz clic en EXECUTE. La primera vez que ejecutes la plantilla de la API, es posible que se te pida que elijas una cuenta de Google e inicies sesión en ella. Después, autoriza a Explorador de APIs de Google para que acceda a tu cuenta. Si la solicitud se realiza correctamente, la respuesta JSON muestra que la actualización del clúster está pendiente.
Para confirmar que se ha actualizado el número de trabajadores del clúster, abre la página Clústeres de Dataproc en la Google Cloud consola
y consulta la columna Nodos de trabajador totales del clúster. Es posible que tengas que hacer clic en ACTUALIZAR en la parte superior de la página para ver el valor actualizado una vez que se haya completado la actualización del clúster.
Limpieza
Para evitar que se apliquen cargos en tu cuenta de Google Cloud por los recursos utilizados en esta página, sigue estos pasos.
[[["Es fácil de entender","easyToUnderstand","thumb-up"],["Me ofreció una solución al problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Es difícil de entender","hardToUnderstand","thumb-down"],["La información o el código de muestra no son correctos","incorrectInformationOrSampleCode","thumb-down"],["Me faltan las muestras o la información que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-09-11 (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)."]]