Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Nesta página, explicamos como restaurar um serviço do metastore do Dataproc de um backup.
Um backup é um snapshot das configurações e dos metadados armazenados em um serviço do Dataproc Metastore. É possível usar o recurso de restauração
para configurar rapidamente um novo serviço do metastore do Dataproc com
os dados salvos anteriormente em um backup.
Para receber as permissões necessárias para restaurar um serviço do Dataproc Metastore de um backup,
peça ao administrador para conceder a você os
seguintes papéis do IAM:
Para conceder controle total dos recursos do metastore do Dataproc e concluir um backup, use uma das seguintes opções:
Para usar o objeto do Cloud Storage que armazena backups programados:
Usuário de objetos do Cloud Storage (roles/storage.objectUser)
no agente de serviço do metastore do Dataproc
Esses papéis predefinidos contêm
as permissões necessárias para restaurar um serviço do Dataproc Metastore de um backup. Para conferir as permissões exatas
necessárias, expanda a seção Permissões necessárias:
Permissões necessárias
As seguintes permissões são necessárias para restaurar um serviço do metastore do Dataproc de um backup:
Para restaurar um serviço de metadados:
metastore.services.restore, metastore.backups.use
Ao restaurar um serviço de um backup, você pode escolher uma das seguintes opções:
Restaure todos os metadados e as configurações salvas no backup.
Restaure todos os metadados, mas não as configurações salvas no
backup. Em vez disso, o serviço mantém as configurações de configuração atuais.
As configurações de configuração incluem parâmetros do metastore do Dataproc, como nome do serviço, número da porta e configurações de rede.
Os metadados incluem todas as informações de banco de dados e tabela armazenadas em um
serviço do Dataproc Metastore.
Considerações
Enquanto uma operação de restauração está em execução, não é possível atualizar o serviço. Por exemplo, não é possível mudar as configurações. No entanto, você
ainda pode usar o serviço para operações normais, como acessar
os metadados dele em clusters autogerenciados ou do Dataproc anexados.
Os rótulos do metastore do Dataproc não são restaurados.
Os dados armazenados no diretório do data warehouse não são restaurados.
A restauração de um backup não restaura nem substitui políticas
detalhadas do IAM.
Para restaurar de um backup programado, é necessário que ele esteja localizado em um bucket do Cloud Storage.
Restaurar a partir de um backup
Para restaurar um serviço do metastore do Dataproc de um backup, conclua
as seguintes etapas.
Se você estiver usando o console do Google Cloud , só será possível restaurar metadados de um
backup criado no mesmo projeto e região do
novo serviço.
Se você usar a Google Cloud CLI ou as APIs do metastore do Dataproc, será possível restaurar metadados de um backup criado em um projeto e uma região diferentes (backup entre serviços).
Console
No console do Google Cloud , abra a página Metastore do Dataproc:
SERVICE: o nome do seu serviço metastore do Dataproc.
PROJECT_ID: o ID do projeto do Google Cloud
em que o serviço do metastore do Dataproc está localizado.
LOCATION: a região do Google Cloud serviço do metastore do Dataproc.
BACKUP: opcional: o identificador do arquivo de backup
de que você está fazendo a restauração. Esse valor pode ser o ID do backup, um URL totalmente
qualificado ou o nome relativo no seguinte formato:
projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}.
RESTORE_TYPE: o tipo de operação de restauração
a ser executada.
Os valores aceitos incluem metadata-only ou full. O valor padrão
é metadata-only.
BACKUP_LOCATION (opcional): o local do Cloud Storage do backup programado.
Por exemplo, gs://my-bucket/path/to/location.
Verifique se a operação de restauração foi bem-sucedida.
Quando a restauração é concluída, o metastore do Dataproc
retorna automaticamente ao estado ativo, independente de ter sido bem-sucedida ou
não.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-08-27 UTC."],[[["\u003cp\u003eThis page outlines the process of restoring a Dataproc Metastore service using a previously created backup, which includes the service's configuration and metadata.\u003c/p\u003e\n"],["\u003cp\u003eRestoration can be done to either restore both metadata and configuration settings, or only metadata while retaining the current service configuration.\u003c/p\u003e\n"],["\u003cp\u003eRestoring a service requires specific IAM roles and permissions, including Dataproc Metastore Editor or Administrator, and Cloud Storage Object User roles.\u003c/p\u003e\n"],["\u003cp\u003eThe restore operation can be initiated through the Google Cloud console, the gcloud CLI, or via REST APIs, with cross-service backups supported through the CLI and APIs.\u003c/p\u003e\n"],["\u003cp\u003eDuring a restore operation, the service cannot be updated, although it remains usable for accessing metadata, and the restore history, viewable in the console, is limited to the last 25 restores.\u003c/p\u003e\n"]]],[],null,["# Restore Dataproc Metastore from a backup\n\nThis page explains how to restore a Dataproc Metastore service\nfrom a [backup](/dataproc-metastore/docs/backup-metadata).\n\nA backup is a snapshot of the configuration settings and metadata stored in\na Dataproc Metastore service. You can use the restore feature\nto quickly set up a new Dataproc Metastore service with\nthe data previously saved in a backup.\n\nBefore you begin\n----------------\n\n- [Enable Dataproc Metastore](/dataproc-metastore/docs/enable-service) in your project.\n- [Create a Dataproc Metastore service](/dataproc-metastore/docs/create-service).\n- [Back up a Dataproc Metastore service](/dataproc-metastore/docs/backup-metadata).\n\n### Required roles\n\n\nTo get the permissions that\nyou need to restore a Dataproc Metastore service from a backup,\n\nask your administrator to grant you the\nfollowing IAM roles:\n\n- To grant full control of Dataproc Metastore resources to complete a backup, either the:\n - [Dataproc Metastore Editor](/iam/docs/roles-permissions/metastore#metastore.editor) (`roles/metastore.editor`) on the metadata service.\n - [Dataproc Metastore Administrator](/iam/docs/roles-permissions/metastore#metastore.admin) (`roles/metastore.admin`) on the project.\n- To use the Cloud Storage object that stores scheduled backups: [Cloud Storage Object User](/iam/docs/roles-permissions/storage#storage.objectUser) (`roles/storage.objectUser`) on the Dataproc Metastore service agent\n\n\nFor more information about granting roles, see [Manage access to projects, folders, and organizations](/iam/docs/granting-changing-revoking-access).\n\n\nThese predefined roles contain\n\nthe permissions required to restore a Dataproc Metastore service from a backup. To see the exact permissions that are\nrequired, expand the **Required permissions** section:\n\n\n#### Required permissions\n\nThe following permissions are required to restore a Dataproc Metastore service from a backup:\n\n- To restore a metadata service: ` metastore.services.restore, metastore.backups.use`\n- To use the Cloud Storage object:\n - ` orgpolicy.policy.get `\n - ` resourcemanager.projects.get `\n - ` resourcemanager.projects.list `\n - ` storage.managedFolders.create `\n - ` storage.managedFolders.delete `\n - ` storage.managedFolders.get `\n - ` storage.managedFolders.list `\n - ` ``storage.multipartUploads.*`` `\n - ` storage.objects.create `\n - ` storage.objects.delete `\n - ` storage.objects.get `\n - ` storage.objects.list `\n - ` storage.objects.restore `\n - ` storage.objects.update`\n\n\nYou might also be able to get\nthese permissions\nwith [custom roles](/iam/docs/creating-custom-roles) or\nother [predefined roles](/iam/docs/roles-overview#predefined).\nFor more information about specific Dataproc Metastore roles and permissions, see [Dataproc Metastore IAM overview](/dataproc-metastore/docs/iam-and-access-control).\n\n\u003cbr /\u003e\n\nAbout restoring from a backup\n-----------------------------\n\nWhen you restore a service from a backup, you can choose one of the\nfollowing options:\n\n- Restore all metadata and the configuration settings saved in the backup.\n- Restore all metadata, but don't restore the configuration settings saved in\n the backup. Instead, your service retains your current configuration settings.\n\n *Configuration settings* include Dataproc Metastore parameters\n such as service name, port number, and network settings.\n *Metadata* includes all the database and table information stored in a\n Dataproc Metastore service.\n\n### Considerations\n\n- While a restore operation is running, you can't update your\n service --- for example, you can't change configuration settings. However, you\n can still use your service for normal operations, such as using it to access\n its metadata from attached Dataproc or self-managed clusters.\n\n- Dataproc Metastore labels aren't restored.\n\n- Data stored in the warehouse directory isn't restored.\n\n- Restoring from a backup doesn't restore or replace fine-grained\n IAM policies.\n\n- Restoring from a scheduled backup requires that your backup is located in a\n Cloud Storage bucket.\n\nRestore from a backup\n---------------------\n\nTo restore a Dataproc Metastore service from a backup, complete\nthe following steps.\n\n- If you're using the Google Cloud console, you can only restore metadata from a\n backup that was created in the same project and region as\n your new service.\n\n- If you use the Google Cloud CLI or Dataproc Metastore APIs,\n you can restore metadata from a backup created in a different project and\n region (cross-service backup).\n\n### Console\n\n1. In the Google Cloud console, open the **Dataproc Metastore** page:\n\n [Open Dataproc Metastore](https://console.cloud.google.com/dataproc/metastore/services)\n2. On the **Dataproc Metastore** page, click the name of the service\n you want to restore from a backup.\n\n The **Service detail** page opens.\n **Figure 1.** The Dataproc Metastore service detail page\n3. To view your backups, click the **Backup/Restore** tab.\n\n4. Select the backup you want to use. To do this, click the menu icon\n more_vert and select\n **Restore**.\n\n The **Restore** page opens.\n\n You can also restore your service on the **Backup detail** page.\n To do this, click the name of the backup and then click **Restore**.\n5. Select the appropriate restore operation:\n\n - **Restore metastore data**. Restores all metadata, but doesn't restore the configuration settings saved in the backup\n - **Restore metastore data and service configuration**. Restores all metadata and the all configuration settings saved in the backup.\n6. To update the service, click **Restore**.\n\n Return to the **Dataproc Metastore** page, and\n verify that your service was successfully backed up.\n\n When the restore completes, Dataproc Metastore\n automatically returns to the [active state](/dataproc-metastore/docs/reference/rest/v1/projects.locations.services?_gl=1*1qaoqiw*_ga*MTIzMTkxNzU5Ni4xNjYzNzk5NTI1*_ga_WH2QY8WWF5*MTY2MzgwMzk0MC4xOS4xLjE2NjM4MDQxNTAuMC4wLjA.#state) regardless of whether or\n not the restore succeeded.\n\n### gcloud CLI\n\n1. To restore a Dataproc Metastore service, run the\n following [`gcloud metastore services restore`](https://cloud.google.com/sdk/gcloud/reference/metastore/services/restore) command:\n\n ```\n gcloud metastore services restore SERVICE \\\n --project=PROJECT_ID \\\n --location=LOCATION \\\n --backup=BACKUP \\\n --restore-type=RESTORE_TYPE \\\n --backup-location=BACKUP_LOCATION\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eSERVICE\u003c/var\u003e: the name of your Dataproc Metastore service.\n - \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the project ID of the Google Cloud project your Dataproc Metastoreservice resides in.\n - \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: the Google Cloud region that your Dataproc Metastore service resides.\n - \u003cvar translate=\"no\"\u003eBACKUP\u003c/var\u003e: Optional: the identifier of the backup file you're restoring from. This value can be the backup ID, a fully qualified URL, or the relative name in the following format: `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`.\n - \u003cvar translate=\"no\"\u003eRESTORE_TYPE\u003c/var\u003e: the type of restore operation to perform. Accepted values include `metadata-only` or `full`. The default value is `metadata-only`.\n - \u003cvar translate=\"no\"\u003eBACKUP_LOCATION\u003c/var\u003e: Optional: The Cloud Storage location of your scheduled backup. For example: `gs://my-bucket/path/to/location`.\n2. Verify that the restore operation was successful.\n\n When the restore completes, Dataproc Metastore\n automatically returns to the [active state](/dataproc-metastore/docs/reference/rest/v1/projects.locations.services?_gl=1*1qaoqiw*_ga*MTIzMTkxNzU5Ni4xNjYzNzk5NTI1*_ga_WH2QY8WWF5*MTY2MzgwMzk0MC4xOS4xLjE2NjM4MDQxNTAuMC4wLjA.#state) regardless of whether or\n not the restore succeeded.\n\n### REST\n\nFollow the API instructions to [restore metadata into a service](/dataproc-metastore/docs/reference/rest/v1/projects.locations.services/restore)\nby using the APIs Explorer.\n\nWhen the restore completes, Dataproc Metastore automatically\nreturns to the [active state](/dataproc-metastore/docs/reference/rest/v1/projects.locations.services?_gl=1*1qaoqiw*_ga*MTIzMTkxNzU5Ni4xNjYzNzk5NTI1*_ga_WH2QY8WWF5*MTY2MzgwMzk0MC4xOS4xLjE2NjM4MDQxNTAuMC4wLjA.#state) regardless of whether or not the restore\nsucceeded.\n\n### View restore history\n\nTo view the restore history of a Dataproc Metastore service in\nthe Google Cloud console, complete the following steps:\n\n1. In the Google Cloud console console, open the [Dataproc Metastore](https://console.cloud.google.com/dataproc/metastore/services) page.\n2. In the navigation bar, click **Backup/Restore**.\n\n Your restore history appears in a table under **Restore**.\n\n The history displays up to the latest 25 restores you completed.\n\n Deleting a Dataproc Metastore service also deletes all\n associated restore history.\n\nTroubleshoot common issues\n--------------------------\n\n- [The service agent or user account doesn't have necessary permissions](/dataproc-metastore/docs/troubleshooting#backup-restore-user-permissions).\n- For more help solving common troubleshooting issues, see [Backup and restore error scenarios](/dataproc-metastore/docs/troubleshooting#backup-and-restore-error-scenarios).\n\nWhat's next\n-----------\n\n- [Back up metadata from a service](/dataproc-metastore/docs/backup-metadata)\n- [Update and delete a service](/dataproc-metastore/docs/manage-service)\n- [Hive Metastore](/dataproc-metastore/docs/hive-metastore)"]]