Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Dataproc-Cluster mit der Google Cloud -Console erstellen
Auf dieser Seite erfahren Sie, wie Sie mit der Google Cloud Console einen Dataproc-Cluster erstellen, einen einfachen Apache Spark-Job im Cluster ausführen und dann die Anzahl der Worker im Cluster ändern.
Eine detaillierte Anleitung dazu finden Sie direkt in der Google Cloud Console. Klicken Sie dazu einfach auf Anleitung:
Sign in to your Google Cloud account. If you're new to
Google Cloud,
create an account to evaluate how our products perform in
real-world scenarios. New customers also get $300 in free credits to
run, test, and deploy workloads.
In the Google Cloud console, on the project selector page,
select or create a Google Cloud project.
Klicken Sie im Dialogfeld Dataproc-Cluster erstellen in der Zeile Cluster in Compute Engine auf Erstellen.
Geben Sie im Feld Clusternameexample-cluster ein.
Wählen Sie in den Listen Region und Zone eine Region und eine Zone aus.
Wählen Sie eine Region aus (z. B. us-east1 oder europe-west1), um Ressourcen wie VM-Instanzen (virtuelle Maschinen) und Cloud Storage- und Metadatenspeicherorte zu isolieren, die von Dataproc in der Region verwendet werden. Weitere Informationen finden Sie unter Verfügbare Regionen und Zonen und Regionale Endpunkte.
Verwenden Sie für alle anderen Optionen die Standardeinstellungen.
Klicken Sie auf Erstellen, um den Cluster zu erstellen.
Der neue Cluster wird auf der Seite Cluster in einer Liste angezeigt. Der Status ist Wird bereitgestellt, bis der Cluster zur Verwendung bereit ist. Anschließend ändert sich der Status in Aktiv. Die Bereitstellung des Clusters kann einige Minuten dauern.
Spark-Job senden
Senden Sie einen Spark-Job, der einen Wert für Pi schätzt:
Klicken Sie im Dataproc-Navigationsmenü auf Jobs.
Klicken Sie auf der Seite Jobs auf add_boxJob senden und gehen Sie dann so vor:
Verwenden Sie im Feld Job-ID die Standardeinstellung oder geben Sie eine ID an, die für Ihr Google Cloud Projekt eindeutig ist.
Wählen Sie im Drop-down-Menü Cluster die Option example-cluster aus.
Wählen Sie als Jobtyp die Option Spark aus.
Geben Sie im Feld Hauptklasse oder JAR-Dateiorg.apache.spark.examples.SparkPi ein.
Geben Sie im Feld JAR-Dateienfile:///usr/lib/spark/examples/jars/spark-examples.jar ein.
Geben Sie im Feld Argumente den Wert 1000 ein, um die Anzahl der Aufgaben festzulegen.
Klicken Sie auf Senden.
Ihr Job wird auf der Seite Jobdetails angezeigt. Der Jobstatus ist Wird ausgeführt oder Wird gestartet und ändert sich nach dem Einreichen zu Erfolgreich.
Wenn Sie das Scrollen in der Ausgabe vermeiden möchten, klicken Sie auf Zeilenumbruch: aus. Die Ausgabe sieht etwa so aus:
Pi is roughly 3.1416759514167594
Klicken Sie auf den Tab Konfiguration, um Jobdetails aufzurufen.
Cluster aktualisieren
So aktualisieren Sie Ihren Cluster, indem Sie die Anzahl der Worker-Instanzen ändern:
Klicken Sie im Dataproc-Navigationsmenü auf Cluster.
Klicken Sie in der Liste der Cluster auf example-cluster.
Klicken Sie auf der Seite Clusterdetails auf den Tab Konfiguration.
Die Clustereinstellungen werden angezeigt.
Klicken Sie auf mode_editBearbeiten.
Geben Sie im Feld Worker-Knoten den Wert 5 ein.
Klicken Sie auf Speichern.
Der Cluster wurde aktualisiert. Verwenden Sie das gleiche Verfahren, um die Anzahl der Worker-Knoten auf den ursprünglichen Wert zu reduzieren.
Bereinigen
Mit den folgenden Schritten vermeiden Sie, dass Ihrem Google Cloud -Konto die auf dieser Seite verwendeten Ressourcen in Rechnung gestellt werden:
Wenn Sie den Cluster löschen möchten, klicken Sie auf der Seite Clusterdetails für example-cluster auf deleteLöschen.
Klicken Sie auf Löschen, um zu bestätigen, dass Sie den Cluster löschen möchten.
Nächste Schritte
Probieren Sie diese Kurzanleitung mit anderen Tools aus:
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-08-22 (UTC)."],[[["\u003cp\u003eThis guide demonstrates how to create a Dataproc cluster using the Google Cloud console, with steps provided in a guided format.\u003c/p\u003e\n"],["\u003cp\u003eYou can submit an Apache Spark job to the cluster, specifically one that estimates Pi using the Monte Carlo method, by following the provided steps.\u003c/p\u003e\n"],["\u003cp\u003eThe guide shows how to modify the worker nodes of an existing cluster, allowing you to increase or decrease the resources allocated to your cluster.\u003c/p\u003e\n"],["\u003cp\u003eInstructions are included for cleaning up the cluster to avoid incurring unwanted charges.\u003c/p\u003e\n"],["\u003cp\u003eThe content also provides additional resources, links to quickstart guides for using other tools, and additional guidance on creating firewall rules and writing Spark Scala jobs.\u003c/p\u003e\n"]]],[],null,["# Quickstart: Create a Dataproc cluster by using the Google Cloud console\n\nCreate a Dataproc cluster by using the Google Cloud console\n===========================================================\n\nThis page shows you how to use the Google Cloud console to create a\nDataproc cluster, run a basic\n[Apache Spark](http://spark.apache.org/)\njob in the cluster, and then modify the number of workers in the cluster.\n\n*** ** * ** ***\n\nTo follow step-by-step guidance for this task directly in the\nGoogle Cloud console, click **Guide me**:\n\n[Guide me](https://console.cloud.google.com/freetrial?redirectPath=/?walkthrough_id=dataproc--quickstart-dataproc-console)\n\n*** ** * ** ***\n\nBefore you begin\n----------------\n\n- Sign in to your Google Cloud account. If you're new to Google Cloud, [create an account](https://console.cloud.google.com/freetrial) to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n-\n\n\n Enable the Dataproc API.\n\n\n [Enable the API](https://console.cloud.google.com/flows/enableapi?apiid=dataproc)\n\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n-\n\n\n Enable the Dataproc API.\n\n\n [Enable the API](https://console.cloud.google.com/flows/enableapi?apiid=dataproc)\n\n\u003cbr /\u003e\n\nCreate a cluster\n----------------\n\n1. In the Google Cloud console, go to the Dataproc\n **Clusters** page.\n\n [Go to Clusters](https://console.cloud.google.com/dataproc/clusters)\n2. Click **Create cluster**.\n\n3. In the **Create Dataproc cluster** dialog, click **Create** in\n the **Cluster on Compute Engine** row.\n\n4. In the **Cluster name** field, enter `example-cluster`.\n\n5. In the **Region** and **Zone** lists, select a region and zone.\n\n Select a region (for example, `us-east1` or `europe-west1`)\n to isolate resources, such as virtual machine (VM) instances and\n Cloud Storage and metadata storage locations that are utilized by\n Dataproc, in the region. For more\n information, see\n [Available regions and zones](/compute/docs/regions-zones/regions-zones#available)\n and\n [Regional endpoints](/dataproc/docs/concepts/regional-endpoints).\n6. For all the other options, use the default settings.\n\n7. To create the cluster, click **Create**.\n\n Your new cluster appears in a list on the **Clusters** page. The status is\n **Provisioning** until the cluster is ready to use, and then the status\n changes to **Running**. Provisioning the cluster might take a couple of\n minutes.\n\nSubmit a Spark job\n------------------\n\nSubmit a Spark job that estimates a value of Pi:\n\n1. In the Dataproc navigation menu, click **Jobs**.\n2. On the **Jobs** page, click\n add_box **Submit job**, and then do\n the following:\n\n 1. In the **Job ID** field, use the default setting, or provide an ID that is unique to your Google Cloud project.\n 2. In the **Cluster** drop-down, select **`example-cluster`**.\n 3. For **Job type** , select **Spark**.\n 4. In the **Main class or jar** field, enter `org.apache.spark.examples.SparkPi`.\n 5. In the **Jar files** field, enter `file:///usr/lib/spark/examples/jars/spark-examples.jar`.\n 6. In the **Arguments** field, enter `1000` to set the number of tasks.\n\n | **Note:** The Spark job estimates Pi by using the [Monte Carlo method](https://wikipedia.org/wiki/Monte_Carlo_method). It generates *x* and *y* points on a coordinate plane that models a circle enclosed by a unit square. The input argument (`1000`) determines the number of x-y pairs to generate; the more pairs generated, the greater the accuracy of the estimation. This estimation uses Dataproc worker nodes to parallelize the computation. For more information, see [Estimating Pi using the Monte Carlo Method](https://academo.org/demos/estimating-pi-monte-carlo/) and [JavaSparkPi.java on GitHub](https://github.com/apache/spark/blob/master/examples/src/main/java/org/apache/spark/examples/JavaSparkPi.java).\n 7. Click **Submit**.\n\n Your job is displayed on the **Job details** page. The job status is\n **Running** or **Starting** , and then it changes to **Succeeded** after\n it's submitted.\n\n To avoid scrolling in the output, click **Line wrap: off**. The output\n is similar to the following: \n\n ```\n Pi is roughly 3.1416759514167594\n ```\n\n To view job details, click the **Configuration** tab.\n\nUpdate a cluster\n----------------\n\nUpdate your cluster by changing the number of worker instances:\n\n1. In the Dataproc navigation menu, click **Clusters**.\n2. In the list of clusters, click **`example-cluster`**.\n3. On the **Cluster details** page, click the **Configuration** tab.\n\n Your cluster settings are displayed.\n4. Click mode_edit **Edit**.\n\n5. In the **Worker nodes** field, enter `5`.\n\n6. Click **Save**.\n\nYour cluster is now updated. To decrease the number of worker nodes to the\noriginal value, follow the same procedure.\n\nClean up\n--------\n\n\nTo avoid incurring charges to your Google Cloud account for\nthe resources used on this page, follow these steps.\n\n1. To delete the cluster, on the **Cluster details** page for **`example-cluster`** , click delete **Delete**.\n2. To confirm that you want to delete the cluster, click **Delete**.\n\nWhat's next\n-----------\n\n- Try this quickstart by using other tools:\n - [Use the API Explorer](/dataproc/docs/quickstarts/create-cluster-template).\n - [Use the Google Cloud CLI](/dataproc/docs/quickstarts/create-cluster-gcloud).\n- Learn how to [create robust firewall rules when you create a project](/dataproc/docs/concepts/configuring-clusters/network).\n- Learn how to [write and run a Spark Scala job](/dataproc/docs/tutorials/spark-scala)."]]