Use a Google Cloud CLI

Como alternativa ao uso das APIs do metastore do Dataproc, é possível gerenciar e acessar os serviços do metastore do Dataproc usando os comandos gcloud metastore da Google Cloud CLI.

Nesta página, explicamos como usar a Google Cloud CLI para interagir com o metastore do Dataproc.

Antes de começar

  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.

    Go to project selector

  3. Enable the Dataproc Metastore API.

    Enable the API

  4. Install the Google Cloud CLI.

  5. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

  6. To initialize the gcloud CLI, run the following command:

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

    Go to project selector

  8. Enable the Dataproc Metastore API.

    Enable the API

  9. Install the Google Cloud CLI.

  10. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

  11. To initialize the gcloud CLI, run the following command:

    gcloud init
  12. Começar a usar a Google Cloud CLI

    Para começar a usar a CLI gcloud, consulte a documentação da CLI do Google Cloud. Você pode receber ajuda com a ferramenta, ver os recursos e os comandos usando a sinalização --help:

    gcloud metastore --help
    

    A referência da Google Cloud CLI também fornece as informações mostradas pela flag --help.

    Definir propriedades de configuração padrão no cliente local

    A maioria dos comandos gcloud metastore requer um local, que você especifica usando a sinalização --location ou definindo o local padrão. Também é possível definir o projeto e o nível padrão para seus serviços do metastore do Dataproc.

    1. Para definir o projeto padrão, execute o comando a seguir:
      gcloud config set project PROJECT_ID

      em que PROJECT_ID é o ID do projeto Google Cloud a que o serviço Metastore do Dataproc pertence.

    2. Para configurar o local do metastore do Dataproc, execute o seguinte comando:
      gcloud config set metastore/location LOCATION

      em que LOCATION é uma região compatível como us-central1.

    3. Para configurar o nível do metastore do Dataproc, execute o seguinte comando:
      gcloud config set metastore/tier TIER

      em que TIER define a capacidade do novo serviço.

    4. Opcional: para listar a configuração da CLI gcloud, execute o seguinte comando:
      gcloud config list

    A seguir