Utilizza Google Cloud CLI

In alternativa all'utilizzo delle API Dataproc Metastore, puoi gestire e accedere ai servizi Dataproc Metastore utilizzando i comandi gcloud metastore di Google Cloud CLI.

Questa pagina spiega come iniziare a utilizzare Google Cloud CLI, in modo da poterla utilizzare per interagire con Dataproc Metastore.

Prima di iniziare

  1. 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.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  3. Enable the Dataproc Metastore API.

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains the serviceusage.services.enable permission. Learn how to grant roles.

    Enable the API

  4. Install the Google Cloud CLI.

  5. Se utilizzi un provider di identità (IdP) esterno, devi prima accedere a gcloud CLI con la tua identità federata.

  6. Per inizializzare gcloud CLI, esegui questo comando:

    gcloud init
  7. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  8. Enable the Dataproc Metastore API.

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains the serviceusage.services.enable permission. Learn how to grant roles.

    Enable the API

  9. Install the Google Cloud CLI.

  10. Se utilizzi un provider di identità (IdP) esterno, devi prima accedere a gcloud CLI con la tua identità federata.

  11. Per inizializzare gcloud CLI, esegui questo comando:

    gcloud init
  12. Inizia a utilizzare Google Cloud CLI

    Per iniziare a utilizzare gcloud CLI, consulta la documentazione di Google Cloud CLI. Puoi ricevere assistenza per lo strumento, le risorse e i comandi utilizzando il flag --help:

    gcloud metastore --help
    

    Il riferimento di Google Cloud CLI fornisce anche le informazioni mostrate dal flag --help.

    Impostare le proprietà di configurazione predefinite nel client locale

    La maggior parte dei comandi gcloud metastore richiede una località, che puoi specificare utilizzando il flag --location o impostando la località predefinita. Puoi anche impostare il progetto e il livello predefiniti per i tuoi servizi Dataproc Metastore.

    1. Per impostare il progetto predefinito, esegui questo comando:
      gcloud config set project PROJECT_ID

      dove PROJECT_ID è l'ID del progetto Google Cloud a cui appartiene il servizio Dataproc Metastore.

    2. Per configurare la posizione di Dataproc Metastore, esegui il seguente comando:
      gcloud config set metastore/location LOCATION

      dove LOCATION è una regione supportata, ad esempio us-central1.

    3. Per configurare il livello Dataproc Metastore, esegui il comando seguente:
      gcloud config set metastore/tier TIER

      dove TIER imposta la capacità del nuovo servizio.

    4. (Facoltativo) Per elencare la configurazione di gcloud CLI, esegui questo comando:
      gcloud config list

    Passaggi successivi