Navigation

mongocli cloud-manager backup restore start

The backup restore start command restores a deployment using the snapshot or point in time of a cluster. You can also restore a deployment using the MongoDB Cloud Manager UI or API.

Syntax

mongocli cloud-manager|cm backup restore start
     AUTOMATED_RESTORE|HTTP
     [ --checkpoint <checkpoint-ID> ]
     --clusterId <cluster-ID>
     [ --expirationHours <N> ]
     [ --oplogInc <oplog-Inc> ]
     [ --oplogTs <oplog-timestamp> ]
     [ --pointInTimeUTCMillis <pointInTime-UTC-ms> ]
     [ --profile|-P <profile-name> ]
     [ --projectId <project-ID> ]
     [ --maxDownloads <N> ]
     --snapshotId <snapshot-ID>
     [ --targetClusterId <cluster-ID> ]
     [ --targetProjectId <project-ID> ]

Note

Use -h or --help to view the command-line help for this command.

Arguments

Argument Description
automated Atlas restores the snapshot corresponding to snapshotId to the Atlas cluster and project specified by targetClusterId and targetGroupId.
pointInTime Atlas performs a Continuous Cloud Backup restore.
download

Atlas generates and displays a URL to download a .tar.gz of the snapshot corresponding to the snapshotId. The contents of the tar.gz archive contain the data files for your Atlas cluster.

See also

To learn more about manually restoring the downloaded data files, see Manual Restore One Snapshot.

Download Limitations

Each cloud backup can have one download at a time, and each project can have a maximum of 20 downloads at a time.

Options

Option Type Description Required?
--checkpoint string

Only available for AUTOMATED RESTORE of sharded clusters.

The unique identifier for the sharded cluster checkpoint that represents the point in time to which your data will be restored.

Note

If you set checkpointId, you cannot set oplogInc, oplogTs, or pointInTimeUTCMillis.

no
--clusterId string The unique identifier of the cluster that the job represents. yes
--expirationHours integer

Only available for HTTP.

The number of hours the download URL is valid once the restore job is complete.

no
--oplogInc string

Only available for AUTOMATED RESTORE of replica sets.

The 32-bit incrementing ordinal that represents operations within a given second. When paired with oplogTs, they represent the point in time to which your data will be restored.

Note

If you set oplogInc, you:

  • Must set oplogTs.
  • Cannot set checkpointId or pointInTimeUTCMillis.
no
--oplogTs string

Only available for AUTOMATED RESTORE of replica sets.

The oplog timestamp given as a timestamp in the number of seconds that have elapsed since the UNIX epoch. When paired with oplogInc, they represent the point in time to which your data will be restored.

Note

If you set oplogTs, you:

  • Must set oplogInc.
  • Cannot set checkpointId or pointInTimeUTCMillis.
no
--pointInTimeUTCMillis integer

Only available for AUTOMATED RESTORE of replica sets.

The timestamp in the number of milliseconds that have elapsed since the UNIX epoch that represents the point in time to which your data will be restored. This timestamp must be within last 24 hours of the current time.

Note

If you set pointInTimeUTCMillis, you cannot set oplogInc, oplogTs, or checkpointId.

no
--profile, -P string Name of the profile where the project ID and the Programmatic API Keys for the project are saved. If omitted, uses the default profile. To learn more about creating a profile, see Configure the MongoDB CLI. no
--projectId string Unique identifier of the project that contains the cluster. If omitted, uses the project ID in the profile or environment variable. no
--maxDownloads integer

Only available for HTTP.

The number of times the download URL can be used. This must be 1 or greater.

no
--snapshotId string

The unique identifier of the snapshot to use for restore.

Note

If you set snapshotId, you cannot set oplogInc, oplogTs, pointInTimeUTCMillis, or checkpointId.

yes
--targetClusterId string

Only available for AUTOMATED RESTORE.

The unique identifier of the target cluster to restore.

no
--targetProjectId string

Only available for AUTOMATED RESTORE.

The unique identifier of the project that contains the destination cluster for the restore job

no

Output

The command prints the following fields in JSON format to the terminal if the command succeeds. If the command returns an error, see Troubleshooting for recommended solutions.

Name Type Description
clusterId string Unique identifier of the cluster that the restore job represents.
created string Timestamp in ISO 8601 date and time format in UTC when the restore job was requested.
delivery object Method and details of how the restored snapshot data is delivered.
delivery.expirationHours number

For HTTP only.

Number of hours the download URL is valid once the restore job is complete.

delivery.expires string

For HTTP only.

Timestamp in ISO 8601 date and time format in UTC after which the URL is no longer available.

delivery.maxDownloads number

For HTTP only.

Number of times the download URL can be used. This must be 1 or greater.

delivery.methodName string

Means by which the data is delivered. Accepted values are:

  • HTTP
delivery.statusName string

Current status of the downloadable file. Accepted values are:

  • NOT_STARTED
  • IN_PROGRESS
  • READY
  • FAILED
  • INTERRUPTED
  • EXPIRED
  • MAX_DOWNLOADS_EXCEEDED
delivery.url string

For HTTP only.

URL from which the restored snapshot data can be downloaded.

encryptionEnabled boolean Flag indicating whether the restored snapshot data is encrypted.
groupId string Unique identifier of the group that owns the restore job.
id string Unique identifier of the restore job.
links object array One or more links to sub-resources and/or related resources. The relations between URLs are explained in the Web Linking Specification.
pointInTime boolean Flag indicating that the job is for a PIT restore.
snapshotId string Unique identifier of the snapshot to restore.
statusName string

Current status of the job. Accepted values are:

  • FINISHED
  • IN_PROGRESS
  • BROKEN
  • KILLED
timestamp object Timestamp of the Oplog entry when the snapshot was created.
timestamp.date string Timestamp in ISO 8601 date and time format in UTC of the latest oplog entry in the restored snapshot.
timestamp.increment string Order of all operations completed at the latest oplog entry in the restored snapshot.

Examples

The following examples show two ways to restore a deployment.

Automated Restore Example

The following example uses the mongocli cm backup restore start AUTOMATED_RESTORE command to restore a deployment, which is specified using the targetProjectId and targetClusterId fields. The command uses the default profile where the project ID and the Programmatic API Keys for the source cluster are stored.

mongocli cm backup restore start AUTOMATED_RESTORE --snapshotId 5e84e57f3bc1517e75d5a9c0 --clusterId 5e84e393395ec72bfc888f6c --targetProjectId 5e84b94c003f2d6370004f4e --targetClusterId 5e84f087b2466072c21fb69b

The previous command prints the following fields to the terminal. To learn more about these fields, see Output.

{
      "results": [
             {
                     "clusterId": "5e84e393395ec72bfc888f6c",
                     "created": "2020-04-01T20:54:46Z",
                     "delivery": {
                             "expires": "2020-04-03T20:54:46Z",
                             "expirationHours": 48,
                             "maxDownloads": 2147483647,
                             "methodName": "HTTP",
                             "statusName": "READY",
                             "url": "https://api-backup-dev.mongodb.com/backup/restore/v2/pull/5e84ff96faa907226c329877/NDQwZTU2MzlmOTA5NGQxYmI2ODM5YzdhMzM1YWY5Njk=/cm-clstr-repl-1585767727-5e84ff96faa907226c329877.tar.gz",
                             "targetClusterId": "5e84f087b2466072c21fb69b",
                             "targetClusterName": "myReplicaSet",
                             "targetGroupId": "5e84b94c003f2d6370004f4e"
                     },
                     "encryptionEnabled": false,
                     "groupId": "5e84b94c003f2d6370004f4e",
                     "id": "5e84ff96faa907226c329877",
                     "links": [
                             {
                                     "rel": "self",
                                     "href": "https://cloud.mongodb.com/api/public/v1.0/groups/5e84b94c003f2d6370004f4e/clusters/5e84e393395ec72bfc888f6c/restoreJobs/5e84ff96faa907226c329877"
                             }
                     ],
                     "snapshotId": "5e84e57f3bc1517e75d5a9c0",
                     "statusName": "IN_PROGRESS",
                     "pointInTime": false,
                     "timestamp": {
                             "date": "2020-04-01T19:02:07Z",
                             "increment": 1
                     }
             }
      ],
      "links": [
             {
                     "rel": "self",
                     "href": "https://cloud.mongodb.com/api/public/v1.0/groups/5e84b94c003f2d6370004f4e/clusters/5e84e393395ec72bfc888f6c/restoreJobs?batchId=5e84ff96faa907226c329877"
             }
      ],
      "totalCount": 1
}

HTTP Example

The following example uses the mongocli cm backup restore start HTTP command to restore a deployment. The command uses the default profile where the project ID and the Programmatic API Keys for the source cluster are stored.

mongocli cm backup restore start HTTP --snapshotId 5e84e57f3bc1517e75d5a9c0 --clusterId 5e84e393395ec72bfc888f6c --expirationHours 5 --maxDownloads 1

The previous command prints the following fields to the terminal. To learn more about these fields, see Output.

{
      "results": [
             {
                     "clusterId": "5e84e393395ec72bfc888f6c",
                     "created": "2020-04-01T21:01:38Z",
                     "delivery": {
                             "expires": "2020-04-02T02:01:38Z",
                             "expirationHours": 5,
                             "maxDownloads": 1,
                             "methodName": "HTTP",
                             "statusName": "READY",
                             "url": "https://api-backup-dev.mongodb.com/backup/restore/v2/pull/5e85013204cf6c27f31ed946/YzRiNjhkY2Y5NzhiNDEyNGJmN2VlMmFiYWE3ZTA0NDQ=/cm-clstr-repl-1585767727-5e85013204cf6c27f31ed946.tar.gz"
                     },
                     "encryptionEnabled": false,
                     "groupId": "5e84b94c003f2d6370004f4e",
                     "id": "5e85013204cf6c27f31ed946",
                     "links": [
                             {
                                     "rel": "self",
                                     "href": "https://cloud.mongodb.com/api/public/v1.0/groups/5e84b94c003f2d6370004f4e/clusters/5e84e393395ec72bfc888f6c/restoreJobs/5e85013204cf6c27f31ed946"
                             }
                     ],
                     "snapshotId": "5e84e57f3bc1517e75d5a9c0",
                     "statusName": "FINISHED",
                     "pointInTime": false,
                     "timestamp": {
                             "date": "2020-04-01T19:02:07Z",
                             "increment": 1
                     }
             }
      ],
      "links": [
             {
                     "rel": "self",
                     "href": "https://cloud.mongodb.com/api/public/v1.0/groups/5e84b94c003f2d6370004f4e/clusters/5e84e393395ec72bfc888f6c/restoreJobs/5e85013204cf6c27f31ed946"
             }
      ],
      "totalCount": 1
}