Objetivos
En este instructivo, se muestra cómo instalar el componente de Jupyter de Dataproc en un clúster nuevo y, luego, conectarte a la IU del notebook de Jupyter que se ejecuta en el clúster desde tu navegador local mediante la puerta de enlace de componentes de Dataproc.
Costos
En este documento, usarás los siguientes componentes facturables de Google Cloud:
Para generar una estimación de costos en función del uso previsto, usa la calculadora de precios.
Antes de comenzar
Si aún no lo hiciste, crea un Google Cloud proyecto y un bucket de Cloud Storage.
Configura el proyecto
- 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.
-
Make sure that billing is enabled for your Google Cloud project.
-
Enable the Dataproc, Compute Engine, and Cloud Storage APIs.
-
Install the Google Cloud CLI.
-
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
-
To initialize the gcloud CLI, run the following command:
gcloud init
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
-
Enable the Dataproc, Compute Engine, and Cloud Storage APIs.
-
Install the Google Cloud CLI.
-
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
-
To initialize the gcloud CLI, run the following command:
gcloud init
Crea un bucket de Cloud Storage en tu proyecto para almacenar los notebooks que crees en este instructivo.
- In the Google Cloud console, go to the Cloud Storage Buckets page.
- Click Create.
- On the Create a bucket page, enter your bucket information. To go to the next
step, click Continue.
-
In the Get started section, do the following:
- Enter a globally unique name that meets the bucket naming requirements.
- To add a
bucket label,
expand the Labels section ( ),
click add_box
Add label, and specify a
key
and avalue
for your label.
-
In the Choose where to store your data section, do the following:
- Select a Location type.
- Choose a location where your bucket's data is permanently stored from the Location type drop-down menu.
- If you select the dual-region location type, you can also choose to enable turbo replication by using the relevant checkbox.
- To set up cross-bucket replication, select
Add cross-bucket replication via Storage Transfer Service and
follow these steps:
Set up cross-bucket replication
- In the Bucket menu, select a bucket.
In the Replication settings section, click Configure to configure settings for the replication job.
The Configure cross-bucket replication pane appears.
- To filter objects to replicate by object name prefix, enter a prefix that you want to include or exclude objects from, then click Add a prefix.
- To set a storage class for the replicated objects, select a storage class from the Storage class menu. If you skip this step, the replicated objects will use the destination bucket's storage class by default.
- Click Done.
-
In the Choose how to store your data section, do the following:
- Select a default storage class for the bucket or Autoclass for automatic storage class management of your bucket's data.
- To enable hierarchical namespace, in the Optimize storage for data-intensive workloads section, select Enable hierarchical namespace on this bucket.
- In the Choose how to control access to objects section, select whether or not your bucket enforces public access prevention, and select an access control method for your bucket's objects.
-
In the Choose how to protect object data section, do the
following:
- Select any of the options under Data protection that you
want to set for your bucket.
- To enable soft delete, click the Soft delete policy (For data recovery) checkbox, and specify the number of days you want to retain objects after deletion.
- To set Object Versioning, click the Object versioning (For version control) checkbox, and specify the maximum number of versions per object and the number of days after which the noncurrent versions expire.
- To enable the retention policy on objects and buckets, click the Retention (For compliance) checkbox, and then do the following:
- To enable Object Retention Lock, click the Enable object retention checkbox.
- To enable Bucket Lock, click the Set bucket retention policy checkbox, and choose a unit of time and a length of time for your retention period.
- To choose how your object data will be encrypted, expand the Data encryption section (Data encryption method. ), and select a
- Select any of the options under Data protection that you
want to set for your bucket.
-
In the Get started section, do the following:
- Click Create. Tus notebooks se almacenarán en Cloud Storage en
gs://bucket-name/notebooks/jupyter
.
Crea un clúster e instala el componente Jupyter
Crea un clúster con el componente de Jupyter instalado.
Abre las IU de Jupyter y JupyterLab
Haz clic en los vínculos de la puerta de enlace de componentes de laGoogle Cloud consola en la consola de Google Cloud para abrir el notebook de Jupyter o las IU de JupyterLab que se ejecutan en el
El directorio de nivel superior que muestra tu instancia de Jupyter es un directorio virtual que te permite ver el contenido de tu bucket de Cloud Storage o de tu sistema de archivos local. Puedes elegir la ubicación si haces clic en el vínculo GCS de Cloud Storage o Disco local para el sistema de archivos local del nodo principal de tu clúster.
- Haz clic en el vínculo de GCS. La IU web del notebook de Jupyter muestra notebooks almacenados en tu bucket de Cloud Storage, incluidos los notebooks que crees en este instructivo.
Limpia
Una vez que completes el instructivo, puedes limpiar los recursos que creaste para que dejen de usar la cuota y generar cargos. En las siguientes secciones, se describe cómo borrar o desactivar estos recursos.
Borra el proyecto
La manera más fácil de eliminar la facturación es borrar el proyecto que creaste para el instructivo.
Para borrar el proyecto, sigue estos pasos:
- In the Google Cloud console, go to the Manage resources page.
- In the project list, select the project that you want to delete, and then click Delete.
- In the dialog, type the project ID, and then click Shut down to delete the project.
Borra el clúster
- Para borrar tu clúster, realiza los siguientes pasos:
gcloud dataproc clusters delete cluster-name \ --region=${REGION}
Borra el bucket
- Para borrar el bucket de Cloud Storage que creaste en la sección Antes de comenzar, paso 2, incluye los notebooks almacenados en el bucket.
gcloud storage rm gs://${BUCKET_NAME} --recursive