Usa Google Cloud CLI.

Como alternativa al uso de las APIs de Dataproc Metastore, puedes administrar y acceder a los servicios de Dataproc Metastore con los comandos de gcloud metastore de la CLI de Google Cloud.

En esta página, se explica cómo comenzar a usar Google Cloud CLI para que puedas interactuar con Dataproc Metastore.

Antes de comenzar

  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. Si usas un proveedor de identidad externo (IdP), primero debes acceder a gcloud CLI con tu identidad federada.

  6. Para inicializar gcloud CLI, ejecuta el siguiente 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. Si usas un proveedor de identidad externo (IdP), primero debes acceder a gcloud CLI con tu identidad federada.

  11. Para inicializar gcloud CLI, ejecuta el siguiente comando:

    gcloud init
  12. Comienza a usar Google Cloud CLI

    Para comenzar a usar gcloud CLI, revisa la Documentación de Google Cloud CLI. Puedes obtener ayuda para la herramienta, los recursos y los comandos con la marca --help:

    gcloud metastore --help
    

    La referencia de Google Cloud CLI también proporciona la información que muestra la marca --help.

    Establece las propiedades de configuración predeterminadas en tu cliente local

    La mayoría de los comandos gcloud metastore requieren una ubicación, que se especifica con la marca --location o estableciendo la ubicación predeterminada. También puedes configurar el proyecto y el nivel predeterminados para tus servicios de Dataproc Metastore.

    1. Para establecer el proyecto predeterminado, ejecuta el siguiente comando:
      gcloud config set project PROJECT_ID

      en el que PROJECT_ID es el ID del proyecto Google Cloud al que pertenece el servicio de Dataproc Metastore.

    2. Para configurar la ubicación de Dataproc Metastore, ejecuta el siguiente comando:
      gcloud config set metastore/location LOCATION

      en el que LOCATION es una región compatible, como us-central1.

    3. Para configurar el nivel de Dataproc Metastore, ejecuta el siguiente comando:
      gcloud config set metastore/tier TIER

      en el que TIER establece la capacidad del servicio nuevo.

    4. Opcional: Para mostrar la configuración de gcloud CLI, ejecuta el siguiente comando:
      gcloud config list

    ¿Qué sigue?