MongoDB Restore (Task)
Restore MongoDB from a backup.
Prerequisites
- MongoDB database asset
- MongoDB credentials
- Storage bucket asset
- Storage bucket asset credentials
Procedure from web console
- Navigate to the tasks page: Operations > Tasks (or go directly to
/home/operations/tasks) - Click on Create Task button
- Select MongoDB restore
- Fill out the MongoDB restore task form with the following information:
- Task name: Enter a descriptive name for your restore task
- The MongoDB asset to restore to: Select the target MongoDB instance from the dropdown
- The database name to restore: Specify the name of the database you want to restore
- The Bucket asset where backups are stored: Choose the storage bucket containing the backup from the dropdown
- The restore path: Define the path within the bucket where the backup files are located
- The opts for MongoDB restore: Configure additional restore options (optional)
- MongoDB credential: Select the credential to access the MongoDB instance
- Bucket credential: Select the credential to access the storage bucket
- Click Next to continue with the task configuration
- Select the target cluster where you want to execute the restore task (optional - if not specified, the task will run on the default cluster)
- Review the task configuration summary
- Click Create Task to execute the MongoDB restore task
Procedure from CLI
Create a YAML file with the MongoDB restore task configuration:
apiVersion: operations.resiliency.io/v1alpha1
kind: Task
metadata:
name: <task-name>
namespace: resiliency-system
spec:
placement:
clusterName: <target-cluster-id>
credentialName: <cluster-credential-name>
templateRef:
templateName: mongodb-restore
params:
- name: mongodb-asset
value: <mongodb-asset-id>
- name: mongodb-database
value: <database-name>
- name: mongodb-restore-opts
value: "<restore-options>"
- name: bucket-asset
value: <bucket-asset-id>
- name: restore-path
value: <path-to-backup-in-bucket>
- name: mongodb-credential
value: <mongodb-credential-name>
- name: bucket-credential
value: <bucket-credential-name>
Apply the task to the cluster
kubectl apply -f mongodb-restore-task.yaml
Note:
- Replace the placeholder values (
<task-name>,<mongodb-asset-id>, etc.) with your actual configuration values - This task will perform a one-time MongoDB restore operation from the specified backup path
- The restore-path should point to the location of your backup files within the bucket