Amazon DocumentDB - Item Level Recovery

0

Hi All,

is it possible item level recovery in document db, i don't see options in console. we have only taking backup and restore cluster , instance from snapshot. Could someone please help on this, how we can do the item level recovery in document db (i.e, missing collections or tables or indexs)

Thanks, Bhargav.

  • please accept the answer if it was useful

feita há 6 meses238 visualizações
1 Resposta
0

Amazon DocumentDB does not provide built-in item-level recovery directly through the console. However, you can achieve item-level recovery using the following approaches:

1. Point-in-Time Restore (PITR) and Manual Extraction

Restore a Cluster to a Point in Time:

  • Use the DocumentDB console or AWS CLI to restore your cluster to a point in time before the item(s) were deleted.
  • This creates a new cluster with the data as it existed at the specified time.

Extract the Needed Data:

  • Connect to the new cluster and manually extract the items, collections, tables, or indexes that you need.
  • Use MongoDB tools like mongodump and mongorestore to transfer the required data back to your original cluster.

2. Use of Change Streams for Tracking and Recovery

  • If you have enabled change streams on your collections, you can use them to track changes to the data in real-time.
  • This allows you to capture deletions and modifications, making it possible to manually reconstruct the data if needed.

3. Custom Backup and Restore Logic

  • Implement custom logic to periodically back up critical collections or documents at the application level.
  • Store these backups in S3 or another storage service, allowing you to restore individual items when necessary.

Example of Restoring Using PITR

Here's a step-by-step example of how to restore a collection from a snapshot:

aws docdb restore-db-cluster-to-point-in-time \
    --source-db-cluster-identifier my-cluster \
    --target-db-cluster-identifier my-cluster-restore \
    --restore-to-time 2023-06-01T12:00:00Z

Connect to the Restored Cluster:

Use your MongoDB client or tools like mongosh to connect to the newly restored cluster.

Extract the Required Data:

mongodump --uri mongodb://restored-cluster-endpoint:27017 --db your_db --collection your_collection --out /path/to/dump

Restore the Data to the Original Cluster:

mongorestore --uri mongodb://original-cluster-endpoint:27017 --db your_db --collection your_collection /path/to/dump/your_db/your_collection.bson

Summary While Amazon DocumentDB does not support direct item-level recovery, using point-in-time restores, change streams, and custom backup logic allows you to achieve the same goal. For critical applications, consider implementing a comprehensive backup strategy to minimize data loss and facilitate recovery.

profile picture
ESPECIALISTA
respondido há 6 meses
profile picture
ESPECIALISTA
avaliado há 6 meses

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas