Delete a Dataproc Metastore service

This page explains how to delete a Dataproc Metastore service.

You might want to delete your Dataproc Metastore service if you chose some configuration settings that can't be changed, such as the service name or the Hive metastore version.

Before you begin

Required roles

To get the permission that you need to delete a Dataproc Metastore service, ask your administrator to grant you the following IAM roles on your project, based on the principle of least privilege:

For more information about granting roles, see Manage access.

This predefined role contains the metastore.services.delete permission, which is required to delete a Dataproc Metastore service.

You might also be able to get this permission with custom roles or other predefined roles.

For more information about specific Dataproc Metastore roles and permissions, see Dataproc Metastore IAM overview.

Delete a service

The following instructions demonstrate how to delete a Dataproc Metastore service.

Considerations

  • Your Cloud Storage bucket isn't automatically deleted when you delete your Dataproc Metastore. To delete a bucket, see Deleting buckets.

  • After deleting a Dataproc Metastore, auto-created VPC Network Peering routes used by the service persist for up to 3 hours. Note that if any other Dataproc Metastore services continue to use these VPC Network Peering routes, they aren't deleted.

Console

  1. In the Google Cloud console, open the Dataproc Metastore page:

    Go to Dataproc Metastore

  2. Select the service you want to delete.

  3. In the navigation bar, click Delete.

    A dialog opens.

  4. On the dialog, click Delete.

    Return to the Dataproc Metastore page, and verify that your deleted service no longer appears in the list.

You can also delete your service on the Service detail page.

  1. On the Dataproc Metastore page, click the service that you want to delete.

    The Service detail page for that service opens.

    Service detail page
  2. In the navigation bar, click Delete Service.

    A dialog opens.

  3. On the dialog, click Delete.

    Return to the Dataproc Metastore page, and verify that your deleted service no longer appears in the list.

gcloud CLI

  1. To delete a service, run the following gcloud metastore services delete command.

    gcloud metastore services delete SERVICE \
        --location=LOCATION
    

    Replace the following:

    • SERVICE: The name of the Dataproc Metastore service you're deleting.
    • LOCATION: The Google Cloud region that your Dataproc Metastore service resides in.
  2. Verify that the deletion was successful.

REST

Follow the API instructions to delete a service by using the APIs Explorer.

Deletion-protection

Dataproc Metastore deletion protection is a feature that helps you prevent the accidental removal of existing and new Dataproc Metastore services. By using deletion protection, you can safeguard services that are important to your applications and workloads.

Considerations

  • By default, the deletion protection option is disabled.

  • You can only set deletion protection at the instance level. Individual protection can't be set on metadata, such as tables, databases or partitions. You also can't enable protection on a backup.

  • If the project containing a protected instance is deleted, the instance is also deleted, irrespective of deletion-protection.

Enable deletion-protection

You can enable deletion protection when you create an instance or on an existing instance.

For new services

Console

  1. In the Google Cloud console, go to the Dataproc Metastore page.

    Go to Dataproc Metastore

  2. In the navigation bar, click +Create.

    The Create Metastore service dialog opens.

  3. Select Dataproc Metastore 2.

  4. Under Deletion protection, click the toggle to enable the feature.

  5. Configure the remaining service options as necessary, or use the provided defaults.

  6. Click Submit.

gcloud CLI

To enable deletion-protection on a new Dataproc Metastore service, run the following gcloud metastore services create command.

gcloud metastore services update SERVICE \
  --location=LOCATION \
  --instance-sizeINSTANCE_SIZE \
  --deletion-protection

Replace the following:

  • SERVICE: The name of the Dataproc Metastore service you're deleting.
  • LOCATION: The Google Cloud region that your Dataproc Metastore service resides in.
  • INSTANCE: The instance size for your service.

For existing services

Console

  1. In the Google Cloud console, open the Dataproc Metastore page:

    Go to Dataproc Metastore

  2. On the Dataproc Metastore page, click the service name of the service that you want to update.

    The Service detail page opens.

  3. On the Configuration tab, click Edit.

    The Edit service page opens.

  4. Under Deletion protection, click the toggle to enable the feature.

  5. Click Submit.

gcloud CLI

To enable deletion-protection on an existing Dataproc Metastore service, run the following gcloud metastore services update command.

gcloud metastore services update SERVICE \
  --location=LOCATION \
  --deletion-protection

Replace the following:

  • SERVICE: The name of the Dataproc Metastore service you're deleting.
  • LOCATION: The Google Cloud region that your Dataproc Metastore service resides in.

Disable deletion-protection

To disable deletion-protection, on a Dataproc Metastore service, run following gcloud metastore services update command with the.

   gcloud metastore services update SERVICE 
--location=LOCATION
--no=deletion-protection

What's next