Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Mengupdate cluster Dataproc menggunakan template
Halaman ini menunjukkan cara menggunakan template Google APIs Explorer untuk
memperbarui cluster Dataproc guna mengubah jumlah pekerja dalam
cluster. Menskalakan cluster
untuk menyertakan lebih banyak pekerja adalah tugas umum saat pekerja tambahan diperlukan
untuk memproses tugas yang lebih besar.
Untuk mengetahui cara lain dalam mengupdate cluster Dataproc, lihat:
Tentukan region
tempat cluster Anda berada (konfirmasi atau ganti "us-central1").
Region cluster Anda tercantum di halaman Clusters Dataproc di konsol Google Cloud .
Tentukan clusterName
cluster yang ada yang Anda perbarui (konfirmasi atau ganti "example-cluster").
updateMask:
"config.worker_config.num_instances". Ini adalah JSON PATH
yang relatif terhadap resource Cluster
ke parameter numInstances yang akan diperbarui (lihat petunjuk Isi permintaan).
Isi permintaan:
config.workerConfig.numInstances:
("3": jumlah pekerja baru). Anda dapat mengubah nilai ini untuk menambahkan lebih sedikit pekerja atau lebih banyak pekerja. Misalnya, jika cluster standar Anda memiliki jumlah pekerja default
sebesar 2, menentukan "3" akan menambahkan 1 pekerja; menentukan "4 akan menambahkan 2).
Cluster Dataproc standar harus memiliki minimal 2 pekerja.
Klik EXECUTE. Saat pertama kali
menjalankan template API, Anda mungkin diminta untuk memilih dan login ke
Akun Google Anda, lalu memberi otorisasi Google APIs Explorer untuk mengakses akun
Anda. Jika permintaan berhasil, respons JSON akan menunjukkan bahwa update cluster tertunda.
Untuk mengonfirmasi bahwa jumlah pekerja di cluster telah diperbarui, buka halaman Cluster Dataproc di konsol Google Cloud dan lihat kolom Total worker nodes cluster. Anda mungkin perlu
mengklik MUAT ULANG di bagian atas halaman untuk melihat nilai yang diperbarui setelah
update cluster selesai.
Pembersihan
Agar akun Google Cloud Anda tidak dikenai biaya untuk
resource yang digunakan di halaman ini, ikuti langkah-langkah berikut.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-08-22 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)."]]