Google Cloud CLI を使用する

Dataproc Metastore API を使用する代わりに、Google Cloud CLIgcloud metastore コマンドを使用して Dataproc Metastore サービスを管理、アクセスすることもできます。

このページでは、Google Cloud CLI の使用を開始する方法について説明します。これにより、Cloud SDK を使用して Dataproc Metastore と情報のやりとりができます。

始める前に

  1. アカウントにログインします。 Google Cloud を初めて使用する場合は、 アカウントを作成して、 実際のシナリオでプロダクトがどのように機能するかを評価してください。 Google Cloud新規のお客様には、ワークロードの実行、テスト、デプロイができる無料クレジット $300 分を差し上げます。
  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 role (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. Google Cloud CLI をインストールします。

  5. 外部 ID プロバイダ(IdP)を使用している場合は、まず連携 ID を使用して gcloud CLI にログインする必要があります。

  6. gcloud CLI を初期化するには、次のコマンドを実行します:

    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 role (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. Google Cloud CLI をインストールします。

  10. 外部 ID プロバイダ(IdP)を使用している場合は、まず連携 ID を使用して gcloud CLI にログインする必要があります。

  11. gcloud CLI を初期化するには、次のコマンドを実行します:

    gcloud init

Google Cloud CLI のスタートガイド

gcloud CLI を使用するにあたっては、Google Cloud CLI のドキュメントをご覧ください。--help フラグを使用すると、ツール、リソース、コマンドについてのヘルプを表示できます。

gcloud metastore --help

Google Cloud CLI リファレンスでも --help フラグで表示できます。

ローカル クライアントでデフォルト構成のプロパティを設定する

ほとんどの gcloud metastore コマンドでは、--location フラグを使用するか、デフォルトのロケーションを設定することで指定するロケーションが必要です。また、Dataproc Metastore サービスのためにデフォルトのプロジェクトと階層を設定することもできます。

  1. デフォルトのプロジェクトを設定するには、次のコマンドを実行します。
    gcloud config set project PROJECT_ID

    ここで、PROJECT_ID は、 Google Cloud プロジェクトが属する Dataproc Metastore サービスの ID です。

  2. Dataproc Metastore のロケーションを構成するには、次のコマンドを実行します。
    gcloud config set metastore/location LOCATION

    ここで、LOCATION は、us-central1 などのサポートされているリージョンです。

  3. Dataproc Metastore 階層を構成するには、次のコマンドを実行します。
    gcloud config set metastore/tier TIER

    ここで、TIER には、新しいサービスの容量を設定します。

  4. 省略可: gcloud CLI の構成を一覧表示するには、次のコマンドを実行します。
    gcloud config list

次のステップ