Restoring MongoDB data to the original instance

You can restore a MongoDB instance to the original host and choose between restoring to the latest backup or an earlier MongoDB database backup version. When you restore data to its original instance, you cannot rename it. This restore option runs a full production restoration of data, and existing data is overwritten at the target site if the Overwrite existing databases application option is selected.

Before you begin

Before you create a restore job for MongoDB, ensure that the following requirements are met:
  • At least one MongoDB backup job is set up and running successfully. For instructions about setting up a backup job, see Backing up MongoDB data.
  • IBM Spectrum® Protect Plus roles and resource groups are assigned to the user who is setting up the restore job. For instructions about assigning roles, see Managing user access, and Roles for MongoDB.
  • Enough disk space is allocated at the target server for the restore operation.
  • Dedicated volumes are allocated for file copying.
  • The same directory structure and layout are available on both the target and source servers.
  • When restoring from a IBM Spectrum Protect archive, files will be migrated to a staging pool from the tape prior to the job beginning. Depending on the size of the restore, this process could take several hours.

For more information about space requirements, see Space prerequisites for MongoDB protection. For more information about prerequisites and setup, see Prerequisites for MongoDB.

Procedure

  1. In the navigation pane, click Manage Protection > Applications > MongoDB > Create job, and then select Restore to open the Restore wizard.
    Tips:
    • You can also open the wizard by clicking Jobs and Operations > Create job > Restore > MongoDB.
    • For a running summary of your selections in the wizard, click Preview Restore in the navigation pane in the wizard.
    • The wizard is opened in the default setup mode. To run the wizard in advanced setup mode, select Advanced Setup. With advanced setup mode, you can set more options for your restore job.
  2. On the Select source page, take the following actions:
    1. Click a source in the list to show the databases that are available for restore operations. You can also use the search function to search for available instances and toggle the displayed instances through the View filter.
    2. Click the add to restore list icon Add to restore list icon next to the database that you want to use as the source of the restore operation. You can select more than one database from the list.

      The selected sources are added to the restore list next to the database list. To remove an item from the list source, click the remove from restore list icon Remove from restore list icon next to the item.

    3. Click Next to continue.
  3. On the Source snapshot page, select the type of restore job that you want to create:
    On-demand: Snapshot
    Runs a one-time restore operation. The restore job starts immediately upon the completion of the wizard.
    On-demand: Point in Time
    Runs a one-time restore job from a point-in-time backup of a database. The restore job starts immediately upon the completion of the wizard.
    Recurring
    Creates a repeating point-in-time restore job that runs on a schedule.
  4. Complete the fields on the Source snapshot page and click Next to continue.
    The fields that are shown depend on the number of items that were selected on the Select source page and on the restore type. Some fields are also not shown until you select a related field.

    Fields that are shown for an on-demand snapshot, single resource restore

    Option Description
    Date range Specify a range of dates to show the available snapshots within that range.
    Backup storage type All backups in the selected date range are listed in rows that show the time that the backup operation occurred and the service level agreement (SLA) policy for the backup. Select the row that contains the backup time and SLA policy that you want, and then take one of the following actions:
    • Click the backup storage type that you want to restore from. The storage types that are shown depend on the types that are available in your environment and are shown in the following order:
      Backup
      Restores data that is backed up to a vSnap server.
      Replication
      Restores data that is replicated to a vSnap server.
      Object Storage
      Restores data that is copied to a cloud service or to a repository server.
      Archive
      Restores data that is copied to a cloud service archive or to a repository server archive (tape).
    • Click anywhere on the row. The first backup type that is shown sequentially from the left of the row is selected by default. For example, if the storage types Backup, Replication, and Archive are shown, Backup is selected by default.
    Use alternate vSnap server for the restore job If you are restoring data from a cloud service or a repository server, select this box to specify an alternative vSnap server, and then select a server from the Select alternate vSnap menu.

    When you restore data from a restore point that was copied to a cloud resource or repository server, a vSnap server is used as a gateway to complete the operation. By default, the vSnap server that is used to complete the restore operation is the same vSnap server that is used to complete the backup and copy operations. To reduce the load on the vSnap server, you can select an alternative vSnap server to serve as the gateway.

    Fields that are shown for an on-demand snapshot, multiple resources restore; point-in-time restore; or recurring restore

    Option Description
    Restore Location Type Select a type of location from which to restore data:
    Site
    The site to which snapshots were backed up. The site is defined in the System Configuration > Site pane.
    Cloud service
    The cloud service to which snapshots were copied. The cloud service is defined in the System Configuration > Backup Storage > Object Storage pane.
    Repository server
    The repository server to which snapshots were copied. The repository server is defined in the System Configuration > Backup Storage > Repository Server pane.
    Cloud service archive
    The cloud archive service to which snapshots were copied. The cloud service is defined in the System Configuration > Backup Storage > Object Storage pane.
    Repository server archive
    The repository server to which snapshots were copied to tape. The repository server is defined in the System Configuration > Backup Storage > Repository Server pane.
    Select a location If you are restoring data from a site, select one of the following restore locations:
    Demo
    The demonstration site from which to restore snapshots.
    Primary
    The primary site from which to restore snapshots.
    Secondary
    The secondary site from which to restore snapshots.

    If you are restoring data from a cloud or repository server, select a server from the Select a location menu.

    Date selector For on-demand restore operations, specify a range of dates to show the available snapshots within that range.
    Restore Point For on-demand restore operations, select a snapshot from the list of available snapshots in the selected date range.
    Use alternate vSnap server for the restore job If you are restoring data from a cloud service or a repository server, select this box to specify an alternative vSnap server, and then select a server from the Select alternate vSnap menu.

    When you restore data from a restore point that was copied to a cloud service or repository server, a vSnap server is used as a gateway to complete the operation. By default, the vSnap server that is used to complete the restore operation is the same vSnap server that is used to complete the backup and copy operations. To reduce the load on the vSnap server, you can select an alternative vSnap server to serve as the gateway.

  5. On the Restore method page, choose the type of restore operation, and click Next to continue.
    • Production

      To recover an entire instance to the original instance, the preferred method is to choose this option with the overwrite application option. MongoDB instances that are members of a replica set are not started during a production restore operation. This action prevents data from being overwritten when connecting to the replica set.

    • Test

      Choose this option to restore data to the same server but using a different port.

    • Instant Access

      Choose this option to mount the backup to the application server without restoring the data or overwriting the data.

      Click Next to continue.

    For test mode or production mode, you can optionally enter a new name for the restored database.

    For production mode, you can also specify a new folder for the restored database by expanding the database and entering a new folder name.

  6. On the Set destination page, choose Restore to original instance and click Next.
  7. Optional: On the Job options page, configure additional options for the restore job and click Next to continue.
    In the Recovery Options section, the Recover until end of backup for MongoDB is selected by default. This option recovers the selected data to the state it was in at the time the backup was created. The recovery operation makes use of the log files that are included in the MongoDB backup.
    Application Options
    Set the application options:
    Overwrite existing database
    Enable this option to allow the restore job to overwrite the selected database. If this option is not selected, the restore job fails when data with the same name is found during the restore process.
    Attention: Ensure that no other data shares the same local database directory as the original data or the data will be overwritten.
    Maximum Parallel Streams per Database
    Set the maximum number of parallel data streams from the backup storage per database. This setting applies to each database in the job definition. Multiple databases can still be restored in parallel if the value of the option is set to 1. Multiple parallel streams might speed up restore operations, but high bandwidth consumption might affect overall system performance.
    This option is applicable only when you are restoring a MongoDB database to its original location by using its original database name.
    Advanced Options
    Set the advanced job definition options:
    Run cleanup immediately on job failure
    This option enables the automatic cleanup of backup data as part of a restore if recovery fails. This option is selected by default. Do not clear this option unless instructed by IBM® Support for troubleshooting purposes.
    Allow session overwrite
    Select this option to replace existing databases with the same name during a restore operation. During an instant disk restore operation, the existing database is shut down and overwritten, and then the recovered database is restarted. If this option is not selected and a database with the same name is encountered, the restore operation fails with an error.
    Continue with restores of other selected databases even if one fails
    If one database in the instance is not successfully restored, the restore operation continues for all other data that is being restored. When this option is not selected, the restore job stops when the recovery of a resource fails.
    Mount Point Prefix
    For Instant Access restore operations, specify a mount point prefix for the path where the mount is to be directed.
  8. Optional: On the Apply scripts page, specify scripts that can be run before or after a job runs. Batch and PowerShell scripts are supported on Windows operating systems while shell scripts are supported on Linux® operating systems.
    Pre-Script
    Select this check box to choose an uploaded script and an application or script server where the pre-script will run. To select an application server, clear the Use Script Server check box. To configure scripts and script servers, click System Configuration > Script.
    Post-Script
    Select this option to choose an uploaded script and an application or script server where the post-script will run. To select an application server, clear the Use Script Server check box. To configure scripts and script servers, click System Configuration > Script page.
    Continue job/task on script error
    Select this option to continue running the job when the script that is associated with the job fails. When this option is enabled, in the event that a script completes processing with a nonzero return code, the backup or restore job continues to run and the pre-script task status is reported as COMPLETED. If a post-script completes processing with a nonzero return code, the post-script task status is reported as COMPLETED. When this option is not selected, the backup or restore job does not run, and the pre-script or post-script task is reported as FAILED.

    Click Next to continue.

  9. On the Schedule page, click Next to start on-demand jobs after you complete the Restore wizard. For recurring jobs, enter a name for the job schedule, and specify how often and when to start the restore job.
  10. On the Review page, review your restore job settings.
    Attention: Review the selected options before you proceed to Submit because data will be overwritten when the Overwrite existing data application option is selected. You can cancel a restore job when it is in progress, but if the Overwrite existing data option is selected, data is overwritten even if you cancel the job.
  11. To proceed with the job, click Submit. To cancel the job, navigate to Jobs and Operations and click the Schedule tab. Find the restore job you want to cancel. Click Actions, and select Cancel.