Docs Menu
Docs Home
/ /
MongoDB Command Line Interface
/ / /

mongocli ops-manager backup restore start

On this page

  • Syntax
  • Arguments
  • Options
  • Output
  • Examples

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 Ops Manager UI or API.

mongocli ops-manager|om backup restore start
AUTOMATED_RESTORE|HTTP
[ --checkpoint <checkpoint-ID> ]
--clusterId <cluster-ID>
[ --expirationHours <N> ]
[ --oplogInc <oplog-Inc> ]
[ --oplogTs <oplog-timestamp> ]
[ --output|-o <output-format> ]
[ --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.

Argument
Description
automated
Atlas restores the snapshot corresponding to snapshotId to the Atlas cluster and project specified by targetClusterId and targetGroupId.
pointInTime
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.

Tip

See also:

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

Note

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.

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
--output, -o
string

Command output format. Valid values are:

  • json for output in JSON format

  • go-template for custom output using the Go template

  • go-template-file for custom output specified using Go template file

If omitted, the command returns output in the default format.

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. 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

The command prints the following fields in the specified 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.

The following examples show two ways to restore a deployment.

The following example uses the mongocli om 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 om backup restore start AUTOMATED_RESTORE --snapshotId 5e7cad8243b1d948cb474471 --clusterId 5e7bcb3243b1d945ae76f397 --targetProjectId 5e7b5c7a43b1d945ae766091 --targetClusterId 5e7bcba043b1d945ae76f51c --output json

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

{
"results": [
{
"clusterId": "5e7bcb3243b1d945ae76f397",
"created": "2020-03-26T21:54:48Z",
"delivery": {
"expires": "2020-03-28T13:54:48Z",
"expirationHours": 40,
"maxDownloads": 2147483647,
"methodName": "HTTP",
"statusName": "READY",
"url": "http://ec2-34-567-890-123.eu-west-1.compute.amazonaws.com:9080/backup/restore/v2/pull/1a2b34c567d8e912ae3ab4f5/OWQzZWM0YzFlNGZmNGU0MTk1ZmI1ZTBiYWQxNmYxNTI=/myDemo-1585229116-1a2b34c567d8e912ae3ab4f5.tar.gz",
"targetClusterId": "5e7bcba043b1d945ae76f51c",
"targetClusterName": "backup",
"targetGroupId": "5e7b5c7a43b1d945ae766091"
},
"encryptionEnabled": false,
"groupId": "5e7b5c7a43b1d945ae766091",
"id": "1a2b34c567d8e912ae3ab4f5",
"links": [
{
"rel": "self",
"href": "http://ec2-34-567-890-123.eu-west-1.compute.amazonaws.com:9080/api/public/v1.0/groups/5e7b5c7a43b1d945ae766091/clusters/5e7bcb3243b1d945ae76f397/restoreJobs/1a2b34c567d8e912ae3ab4f5"
}
],
"snapshotId": "5e7cad8243b1d948cb474471",
"statusName": "IN_PROGRESS",
"pointInTime": false,
"timestamp": {
"date": "2020-03-26T13:25:16Z",
"increment": 1
}
}
],
"links": [
{
"rel": "self",
"href": "http://ec2-34-567-890-123.eu-west-1.compute.amazonaws.com:9080/api/public/v1.0/groups/5e7b5c7a43b1d945ae766091/clusters/5e7bcb3243b1d945ae76f397/restoreJobs?batchId=1a2b34c567d8e912ae3ab4f5"
}
],
"totalCount": 1
}

The following example uses the mongocli om 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 om backup restore start HTTP --snapshotId 5e7cad8243b1d948cb474471 --clusterId 5e7bcb3243b1d945ae76f397 --expirationHours 5 --maxDownloads 1
--output json

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

{
"results": [
{
"clusterId": "5e7bcb3243b1d945ae76f397",
"created": "2020-03-26T22:40:02Z",
"delivery": {
"expires": "2020-03-27T03:40:02Z",
"expirationHours": 5,
"maxDownloads": 1,
"methodName": "HTTP",
"statusName": "READY",
"url": "http://ec2-34-567-890-123.eu-west-1.compute.amazonaws.com:9080/backup/restore/v2/pull/1a2b34c567d8e912ae3ab4f5/MDI3ZGNmZWViNmQ2NDFiMmEwOGIwYzFjODcxOTE1Yjk=/myDemo-1585229116-1a2b34c567d8e912ae3ab4f5.tar.gz"
},
"encryptionEnabled": false,
"groupId": "5e7b5c7a43b1d945ae766091",
"id": "1a2b34c567d8e912ae3ab4f5",
"links": [
{
"rel": "self",
"href": "http://ec2-34-567-890-123.eu-west-1.compute.amazonaws.com:9080/api/public/v1.0/groups/5e7b5c7a43b1d945ae766091/clusters/5e7bcb3243b1d945ae76f397/restoreJobs/1a2b34c567d8e912ae3ab4f5"
}
],
"snapshotId": "5e7cad8243b1d948cb474471",
"statusName": "FINISHED",
"pointInTime": false,
"timestamp": {
"date": "2020-03-26T13:25:16Z",
"increment": 1
}
}
],
"links": [
{
"rel": "self",
"href": "http://ec2-34-567-890-123.eu-west-1.compute.amazonaws.com:9080/api/public/v1.0/groups/5e7b5c7a43b1d945ae766091/clusters/5e7bcb3243b1d945ae76f397/restoreJobs/1a2b34c567d8e912ae3ab4f5"
}
],
"totalCount": 1
}

Back

Backups