Navigation
This version of the documentation is archived and no longer supported. To learn how to upgrade your version of MongoDB Ops Manager, refer to the upgrade documentation.
You were redirected from a different version of the documentation. Click here to go back.

Restore Jobs

This 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. In order to initiate a restore job, the request must originate from an IP address on the API user’s whitelist.

Operations

GET /api/public/v1.0/groups/GROUP-ID/clusters/CLUSTER-ID/restoreJobs
  • Get all restore jobs for a cluster. CLUSTER-ID must be the ID of either a replica set or a sharded cluster.
GET /api/public/v1.0/groups/GROUP-ID/clusters/CLUSTER-ID/restoreJobs?batchId=BATCH-ID
  • Get 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 /api/public/v1.0/groups/GROUP-ID/clusters/CLUSTER-ID/restoreJobs/JOB-ID
  • Get a single restore job.
POST /api/public/v1.0/groups/GROUP-ID/clusters/CLUSTER-ID/restoreJobs
  • Create a restore job for the specified CLUSTER-ID. You can create a restore job for either an existing snapshot or for a specific recent point-in-time. (The recency depends on the size of your “point-in-time window.”) See below for examples of each. 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.

Sample Entity

{
  "id" : "53bd7f13e4b0a7304e226998",
  "groupId" : "525ec8394f5e625c80c7404a",
  "clusterId" : "53bc556ce4b049c88baec825",
  "snapshotId" : "53bd439ae4b0774946a16490",
  "created" : "2014-07-09T17:42:43Z",
  "timestamp" : {
    "date" : "2014-07-09T09:24:37Z",
    "increment" : 1
  },
  "statusName" : "FINISHED",
  "pointInTime" : false,
  "delivery" : {
    "methodName" : "HTTP",
    "url" : "https://api-backup.mongodb.com/backup/restore/v2/pull/ae6bc7a8bfdd5a99a0c118c73845dc75/53bd7f13e4b0a7304e226998/2292652411027442213/525ec8394f5e625c80c7404a-rs0-1404897877.tar.gz",
    "expires" : "2014-07-09T18:42:43Z",
    "statusName" : "READY"
  },
  "hashes" : [
    {
      "typeName": "SHA1",
      "fileName": "filename.0",
      "hash": "5h1DziNbqx9yY2VGJUz5RFnNco0="
    }
  ],
  "links" : [ ... ]
}

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.
created timestamp When the restore job was requested.
timestamp BSON timestamp Timestamp of the latest oplog entry in the restored snapshot.
statusName enum

Current status of the job. Possible values are:

  • FINISHED
  • IN_PROGRESS
  • BROKEN
  • KILLED
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 enum

How the data will be delivered. Possible values are:

  • HTTP
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.statusName enum

Current status of the downloadable file. Only present if delivery.methodName is HTTP. Possible values are:

  • READY
  • EXPIRED
  • MAX_DOWNLOADS_EXCEEDED
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.
hashes.typeName enum

The hashing algorithm used to compute the hash value. Possible values are:

  • SHA1
hashes.fileName string The name of the file that has been hashed.
hashes.hash string The hash of the file.

Examples

Get All Restore Jobs

curl -i -u "username:apiKey" --digest "https://mms.mongodb.com/api/public/v1.0/groups/525ec8394f5e625c80c7404a/clusters/53bc556ce4b049c88baec825/restoreJobs"

HTTP/1.1 200 OK

{
  "totalCount" : 2,
  "results" : [ {
    "id" : "53bd7f38e4b0a7304e226b3f",
    "groupId" : "525ec8394f5e625c80c7404a",
    "clusterId" : "53bc556ce4b049c88baec825",
    "snapshotId" : "53bd4356e4b0774946a16455",
    "created" : "2014-07-09T17:43:20Z",
    "timestamp" : {
      "date" : "2014-07-08T21:24:37Z",
      "increment" : 1
    },
    "statusName" : "FINISHED",
    "pointInTime" : false,
    "delivery" : {
      "methodName" : "HTTP",
      "url" : "https://api-backup.mongodb.com/backup/restore/v2/pull/ae6bc7a8bfdd5a99a0c118c73845dc75/53bd7f38e4b0a7304e226b3f/8924913772648127956/525ec8394f5e625c80c7404a-rs0-1404854677.tar.gz",
      "expires" : "2014-07-09T18:43:21Z",
      "statusName" : "READY"
    },
    "links" : [ ... ]
  }, {
    "id" : "53bd7f13e4b0a7304e226998",
    "groupId" : "525ec8394f5e625c80c7404a",
    "clusterId" : "53bc556ce4b049c88baec825",
    "snapshotId" : "53bd439ae4b0774946a16490",
    "created" : "2014-07-09T17:42:43Z",
    "timestamp" : {
      "date" : "2014-07-09T09:24:37Z",
      "increment" : 1
    },
    "statusName" : "FINISHED",
    "pointInTime" : false,
    "delivery" : {
      "methodName" : "HTTP",
      "url" : "https://api-backup.mongodb.com/backup/restore/v2/pull/ae6bc7a8bfdd5a99a0c118c73845dc75/53bd7f13e4b0a7304e226998/2292652411027442213/525ec8394f5e625c80c7404a-rs0-1404897877.tar.gz",
      "expires" : "2014-07-09T18:42:43Z",
      "statusName" : "READY"
    },
    "links" : [ ... ]
  } ],
  "links": [ ... ]
}

Get a Single Restore Job

curl -i -u "username:apiKey" --digest "https://mms.mongodb.com/api/public/v1.0/groups/525ec8394f5e625c80c7404a/clusters/53bc556ce4b049c88baec825/restoreJobs/53bd7f13e4b0a7304e226998"

HTTP/1.1 200 OK

{
  "id" : "53bd7f13e4b0a7304e226998",
  "groupId" : "525ec8394f5e625c80c7404a",
  "clusterId" : "53bc556ce4b049c88baec825",
  "snapshotId" : "53bd439ae4b0774946a16490",
  "created" : "2014-07-09T17:42:43Z",
  "timestamp" : {
    "date" : "2014-07-09T09:24:37Z",
    "increment" : 1
  },
  "statusName" : "FINISHED",
  "pointInTime" : false,
  "delivery" : {
    "methodName" : "HTTP",
    "url" : "https://api-backup.mongodb.com/backup/restore/v2/pull/ae6bc7a8bfdd5a99a0c118c73845dc75/53bd7f13e4b0a7304e226998/2292652411027442213/525ec8394f5e625c80c7404a-rs0-1404897877.tar.gz",
    "expires" : "2014-07-09T18:42:43Z",
    "statusName" : "READY"
  },
  "links" : [ ... ]
}

Create a Restore Job for an Existing Snapshot

curl -i -u "username:apiKey" -H "Content-Type: application/json" --digest -X POST "https://mms.mongodb.com/api/public/v1.0/groups/525ec8394f5e625c80c7404a/clusters/53bc556ce4b049c88baec825/restoreJobs" --data '
{
  "snapshotId": "53bd439ae4b0774946a16490"
}'

HTTP/1.1 200 OK

{
  "totalCount" : 1,
  "results" : [ {
    "id" : "53bd9f9be4b0a7304e23a8c6",
    "groupId" : "525ec8394f5e625c80c7404a",
    "clusterId" : "53bc556ce4b049c88baec825",
    "snapshotId" : "53bd439ae4b0774946a16490",
    "created" : "2014-07-09T20:01:31Z",
    "timestamp" : {
      "date" : "2014-07-09T09:24:37Z",
      "increment" : 1
    },
    "statusName" : "IN_PROGRESS",
    "pointInTime" : false,
    "links" : [ ... ]
  } ]
}

Create a Point-In-Time Restore Job

curl -i -u "username:apiKey" -H "Content-Type: application/json" --digest -X POST "https://mms.mongodb.com/api/public/v1.0/groups/525ec8394f5e625c80c7404a/clusters/53bc556ce4b049c88baec825/restoreJobs" --data '
{
  "timestamp": {
    "date": "2014-07-09T09:20:00Z",
    "increment": 0
  }
}'

HTTP/1.1 200 OK

{
  "totalCount" : 1,
  "results" : [ {
    "id" : "53bda0dfe4b0a7304e23b54a",
    "groupId" : "525ec8394f5e625c80c7404a",
    "clusterId" : "53bc556ce4b049c88baec825",
    "created" : "2014-07-09T20:06:55Z",
    "timestamp" : {
      "date" : "2014-07-09T09:20:00Z",
      "increment" : 0
    },
    "statusName" : "IN_PROGRESS",
    "pointInTime" : true,
    "links" : [ ... ]
  } ]
}
←   Snapshots Whitelist  →