Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Sebagai alternatif untuk menjalankan alur kerja di
cluster terkelola, Anda dapat menggunakan
pemilih cluster untuk memilih cluster yang ada untuk alur kerja Anda. Di akhir alur kerja, cluster yang dipilih tidak dihapus.
Selektor menentukan satu atau beberapa
label pengguna Dataproc.
Cluster di region yang sama dengan alur kerja yang labelnya cocok dengan semua label pemilih memenuhi syarat untuk menjalankan tugas alur kerja. Jika beberapa cluster cocok dengan pemilih, Dataproc akan memilih cluster dengan memori YARN bebas terbanyak.
Menambahkan pemilih cluster ke template
Anda dapat menambahkan pemilih cluster ke template alur kerja menggunakan
Google Cloud CLI atau Dataproc API.
[[["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-09-04 UTC."],[[["\u003cp\u003eCluster selectors allow workflows to run on existing clusters instead of managed clusters, and the selected cluster is not deleted post-workflow.\u003c/p\u003e\n"],["\u003cp\u003eSelectors use Dataproc user labels to identify eligible clusters within the same region as the workflow, and Dataproc chooses the cluster with the most free YARN memory if multiple clusters match.\u003c/p\u003e\n"],["\u003cp\u003eYou can add a cluster selector to a workflow template using either the Google Cloud CLI or the Dataproc API, with options to set specific cluster labels.\u003c/p\u003e\n"],["\u003cp\u003eAutomatically-applied cluster labels like \u003ccode\u003egoog-dataproc-cluster-name\u003c/code\u003e and \u003ccode\u003egoog-dataproc-cluster-uuid\u003c/code\u003e can be used to point a cluster selector to an existing cluster.\u003c/p\u003e\n"],["\u003cp\u003eClusters with matching labels can be used to create cluster pools, and the workflow template can select a cluster within that pool based on the applied labels.\u003c/p\u003e\n"]]],[],null,["As an alternative to running a workflow on a\n[managed cluster](/dataproc/docs/concepts/workflows/using-workflows#configuring_or_selecting_a_cluster), you can use a\ncluster selector to choose an existing cluster for your workflow. At the\nconclusion of the workflow, the selected cluster is not deleted.\n\nSelectors specify one or more\n[Dataproc user labels](/dataproc/docs/concepts/labels).\nClusters in same\n[region](/compute/docs/regions-zones#available) as the workflow whose labels\nmatch all of the selector labels are eligible to run workflow jobs. If multiple\nclusters match the selector, Dataproc will\nchoose the cluster with the most free YARN memory.\n\nAdd a cluster selector to a template\n\nYou can add a cluster selector to a workflow template using the\nGoogle Cloud CLI or the Dataproc API. \n\ngcloud command \n\n```\ngcloud dataproc workflow-templates set-cluster-selector template-id \\\n --region=region \\\n --cluster-labels=name=value[[,name=value]...]\n```\n\nREST API See [WorkflowTemplatePlacement.ClusterSelector](/dataproc/docs/reference/rest/v1/projects.locations.workflowTemplates#clusterselector). This field is provided as part of a completed [WorkflowTemplate](/dataproc/docs/reference/rest/v1/projects.regions.workflowTemplates#resource-workflowtemplate) submitted with a [workflowTemplates.create](/dataproc/docs/reference/rest/v1/projects.regions.workflowTemplates/create) or [workflowTemplates.update](/dataproc/docs/reference/rest/v1/projects.regions.workflowTemplates/update) request.\n\nConsole\n\nYou can view existing workflow templates and instantiated workflows from\nthe Dataproc\n[**Workflows**](https://console.cloud.google.com/dataproc/workflows/instances) page in Google Cloud console.\n\nUse automatically applied labels\n\nYou can point a cluster selector to an existing cluster by using\none of the following [automatically-applied cluster labels](/dataproc/docs/concepts/labels#automatically-applied_labels):\n\n- `goog-dataproc-cluster-name`\n- `goog-dataproc-cluster-uuid`\n\n**Example:** \n\n```\ngcloud dataproc workflow-templates set-cluster-selector template-id \\\n --region=region \\\n --cluster-labels=goog-dataproc-cluster-name=my-cluster\n```\n\n\u003cbr /\u003e\n\nSelect from a cluster pool\n\nYou can let Dataproc choose a cluster from a pool of clusters.\nThe cluster pools can be defined with labels.\n\n**Example:** \n\n```\ngcloud dataproc clusters create cluster-1 --labels cluster-pool=pool-1 \\\n --region=\u003cvar translate=\"no\"\u003eregion\u003c/var\u003e\ngcloud dataproc clusters create cluster-2 --labels cluster-pool=pool-1 \\\n --region=\u003cvar translate=\"no\"\u003eregion\u003c/var\u003e\ngcloud dataproc clusters create cluster-3 --labels cluster-pool=pool-2 \\\n --region=\u003cvar translate=\"no\"\u003eregion\u003c/var\u003e\n```\n\nAfter cluster creation ... \n\n```\ngcloud dataproc workflow-templates create my-template \\\n --region=\u003cvar translate=\"no\"\u003eregion\u003c/var\u003e\ngcloud dataproc workflow-templates set-cluster-selector my-template \\\n --region=\u003cvar translate=\"no\"\u003eregion\u003c/var\u003e \\\n --cluster-labels=cluster-pool=pool-1\n```\n\nThe workflow will be run on either cluster-1 or cluster-2, but not on cluster-3."]]