- API >
- Public API Resources >
- Backup and Restore >
- Restore Jobs
Restore Jobs¶
On this page
Overview¶
The restoreJobs
resource allows you to manage restore jobs. A restore job is essentially a
request to retrieve one of your existing snapshots, or a snapshot for a recent
specific point-in-time, in order to restore a mongod
to a previous state.
To initiate a restore job, you must issue the request from an IP
address on your user account’s whitelist.
Endpoints¶
Get All Restore Jobs for a Cluster¶
Get all restore jobs for a cluster. CLUSTER-ID
must be the ID of
either a replica set or a sharded cluster.
Using the batchId
query parameter, you can retrieve all restore jobs
in the specified batch. When creating a restore job for a sharded
cluster, Ops Manager creates a separate job for each shard, plus another for
the config server. Each of those jobs will be part of a batch. A restore
job for a replica set, however, will not be part of a batch.
Get a Single Restore Job for a Cluster¶
Get All Restore Jobs for a Legacy Mirrored Config Server¶
Get all restore jobs for a legacy mirrored config server (a config
server that is not a replica set). HOST-ID
is the ID of the config
server. To get restore jobs for a config server that is a replica set, use
CLUSTER-ID
.
Note
For information on running a config server as a replica set, see Create the Config Server Replica Set in the MongoDB manual.
Get a Single Restore Job for a Legacy Mirrored Config Server¶
Get a single restore job for a legacy mirrored config server (a
config server that is not a replica set). HOST-ID
is the ID of the
config server. To get a single restore job for a config server that is a
replica set, you must instead query for the restore job using CLUSTER-ID
.
Create a Restore Job for a Cluster¶
Create a restore job for the specified CLUSTER-ID
. You can create a
restore job for either an existing snapshot or a custom snapshot. A custom
snapshot is created from a specific point-in-time for a replica set or
from a checkpoint for a sharded cluster.
The response body includes an array of restore jobs. When requesting a
restore of a replica set, the array will contain a single element. For a
sharded cluster, the array will contain one element for each shard, plus
one for the config server. Each element will also include the
batchId
representing the batch to which the jobs belong.
The Create Restore Jobs examples describe each restore job type.
Create a Restore Job for a Legacy Mirrored Config Server¶
Create a restore job for a legacy mirrored config server (a config
server that is not a replica set). HOST-ID
is the ID of a config server
that is not a replica set.
Sample Entity¶
The following is one example of a return document. The fields in a return document depend on the type of restore and other factors:
Entity Fields¶
Name | Type | Description |
---|---|---|
groupId |
string | ID of the group that owns the restore job. |
clusterId |
string | ID of the cluster represented by the restore job. |
snapshotId |
string | ID of the snapshot to restore. |
batchId |
string | ID of the batch to which this restore job belongs. Only present for a restore of a sharded cluster. |
hostId |
string | ID of the config server to which this restore job belongs. Only present for a restore of a legacy mirrored config server. |
created |
timestamp | When the restore job was requested. |
timestamp |
BSON timestamp | Timestamp of the latest oplog entry in the restored snapshot. |
statusName |
string | Current status of the job. Possible values are:
|
pointInTime |
boolean | Is this job for a point-in-time restore? |
delivery |
object | Additional details about how the restored snapshot data will be delivered. |
delivery.methodName |
string | How the data will be delivered. Possible values are:
|
delivery.url |
string | The URL from which the restored snapshot data can be downloaded. Only
present if delivery.methodName is HTTP . |
delivery.expires |
timestamp | Date after which the URL will no longer be available. Only present if
delivery.methodName is HTTP . |
delivery.expirationHours |
number | The number of hours the download URL will be valid once the restore
job is complete. Only present if delivery.methodName is HTTP . |
delivery.maxDownloads |
number | The number of times the download URL can be used. This must be
Only present if |
delivery.statusName |
string | Current status of the downloadable file. Possible values are:
|
delivery.formatName |
string | Format in which data from an SCP restore should be written to the destination.
Only present if
|
delivery.hostname |
string | Hostname of the server to which the data should be written for an SCP restore.
Only present if delivery.methodName is SCP . |
delivery.port |
number | Port to use for SCP. Only present if delivery.methodName is SCP. |
username |
string | Username to use for SCP. Only present if delivery.methodName is SCP. |
password |
string | Password to use for SCP. If delivery.methodName is SCP, then you must include
this field when creating the restore job. However, it will never be exposed when
a restore job entity is returned. |
passwordTypeName |
string | Type of authentication to use for SCP. Only present if
|
targetDirectory |
string | Target directory to which the data should be written for an SCP restore. Only
present if delivery.methodName is SCP . |
hashes |
object array | If the corresponding delivery.url has been downloaded, each document
in this array is a mapping of a restore file to a hashed checksum. This
array is present only after the file is downloaded. Note that for an
HTTP restore, this array will only contain a single object representing
the hash of the .tar.gz file. |
encryptionEnabled |
boolean | Indicates whether the restored snapshot data is encrypted. |
masterKeyUUID |
string | The KMIP master key ID used to encrypt the snapshot data. This field is
present only if encryptionEnabled is true for the snapshot. |
hashes.typeName |
string | The hashing algorithm used to compute the hash value. Possible values are:
|
hashes.fileName |
string | The name of the file that has been hashed. |
hashes.hash |
string | The hash of the file. |
Links¶
Relation | Description |
---|---|
self |
Me |
http://mms.mongodb.com/cluster |
The cluster to restore. |
http://mms.mongodb.com/snapshot |
The snapshot to restore. |
http://mms.mongodb.com/group |
The group that owns the cluster. |
Examples¶
Get a Restore Job for a Legacy Mirrored Config Server¶
Get a restore job for a legacy mirrored config server (a config server that is not a replica set).
Request¶
Response¶
Create Restore Jobs¶
Create a Restore Job for an Existing Snapshot via HTTPS¶
Request¶
Response¶
Create a Restore Job for an Existing Snapshot via SCP¶
Request¶
Response¶
Create a Point-In-Time Restore Job for a Replica Set¶
Request¶
Response¶
Create a Checkpoint Restore Job for a Sharded Cluster¶
Request¶
Response¶
Create a Restore Job for a Legacy Mirrored Config Server¶
Create a restore job for a legacy mirrored config server (a config server that is not a replica set).