mongocli ops-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 Ops Manager
UI or
API.
Syntax
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.
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
TipSee also:To learn more about manually restoring the downloaded data files, see Manual Restore One Snapshot. NoteDownload LimitationsEach 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. NoteIf you set | 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 NoteIf you set
| 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 NoteIf you set
| no |
--output , -o | string | Command output format. Valid values are:
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. NoteIf you set | 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
| no |
--snapshotId | string | The unique identifier of the snapshot to use for restore. NoteIf you set snapshotId, you cannot set | 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 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
|
delivery.methodName | string | Means by which the data is delivered. Accepted values are:
|
delivery.statusName | string | Current status of the downloadable file. Accepted values are:
|
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:
|
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 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 }
HTTP Example
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 }