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.

Snapshots

Overview

This resource allows you to view snapshot metadata and remove existing snapshots. A snapshot is a complete copy of the data in a mongod instance at a point in time. To delete a resource, you must issue the request from an IP address on your user account’s whitelist.

You can retrieve snapshot metadata for the whole cluster or replica set, or for a single config server in a cluster.

In order to perform a restore of the snapshot data, you must create a restore job.

Endpoints

Get All Snapshots 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/snapshots

Get a Single Snapshot for a Cluster

GET /api/public/v1.0/groups/GROUP-ID/clusters/CLUSTER-ID/snapshots/SNAPSHOT-ID

Delete a Snapshot

Remove a single snapshot. Note that while the two above methods return metadata about the snapshot, this will actually remove the underlying backed-up data.

DELETE /api/public/v1.0/groups/GROUP-ID/clusters/CLUSTER-ID/snapshots/SNAPSHOT-ID

Get All Snapshots for a Config Server

Get all snapshots for a config server. HOST-ID must be the ID of a config server.

GET /api/public/v1.0/groups/GROUP-ID/hosts/HOST-ID/snapshots

Get a Single Snapshot for a Config Server

GET /api/public/v1.0/groups/GROUP-ID/hosts/HOST-ID/snapshots/SNAPSHOT-ID

Sample Entity

The following is a sample snapshot document.

{
  "clusterId" : "348938fbdbca74718cba",
  "complete" : true,
  "created" : {
    "date" : "2015-07-29T02:57:17Z",
    "increment" : 1
  },
  "expires" : "2016-07-27T02:57:17Z",
  "groupId" : "2847387cd717dabc348a",
  "id" : "5875f665da588548965b",
  "isPossiblyInconsistent" : false,
  "missingShards": [
    {
      "id": "472837bcbd278abcd7",
      "groupId": "2847387cd717dabc348a",
      "typeName": "REPLICA_SET",
      "clusterName": "Cluster 1",
      "shardName": "shard002",
      "replicaSetName": "rs2",
      "lastHeartbeat": "2014-02-26T17:32:45Z"
    }
  ],
  "parts" : [ {
    "clusterId" : "55b83f6ce4b074d9e2f2e741",
    "dataSizeBytes" : 177588,
    "encryptionEnabled": true,
    "masterKeyUUID" : "1234-3456-4567-abcd-def0"
    "fileSizeBytes" : 201326640,
    "mongodVersion" : "3.0.5",
    "replicaSetName" : "rs0",
    "storageSizeBytes" : 11235328,
    "typeName" : "REPLICA_SET"
  }, {
    "clusterId" : "55b83f6ce4b074d9e2f2e73d",
    "dataSizeBytes" : 3450212,
    "encryptionEnabled": true,
    "masterKeyUUID" : "1234-3456-4567-abcd-def0"
    "fileSizeBytes" : 201326640,
    "mongodVersion" : "3.0.5",
    "replicaSetName" : "rs1",
    "storageSizeBytes" : 21721088,
    "typeName" : "REPLICA_SET"
  }, {
    "dataSizeBytes" : 3211448,
    "fileSizeBytes" : 201326640,
    "hostId" : "8e42be22e49d3002c1744f2f5c6327eb",
    "mongodVersion" : "3.0.5",
    "storageSizeBytes" : 25989120,
    "typeName" : "CONFIG_SERVER"
  } ]
}

Entity Fields

Name Type Description
groupId string ID of the group that owns the snapshot.
clusterId string ID of the cluster represented by the snapshot. Not present for a config server snapshot.
hostId string ID of the config server represented by the snapshot. Present only for a config server snapshot.
created BSON timestamp The exact point-in-time at which the snapshot was taken.
expires timestamp The date after which this snapshot is eligible for deletion.
complete boolean Is this snapshot complete? This will be false if the snapshot creation job is still in progress.
isPossiblyInconsistent boolean Could this snapshot be inconsistent? isPossiblyInconsistent is only present for sharded cluster snapshots. In order to take a snapshot of a sharded cluster in a consistent state, the backup agent will temporarily turn off the balancer before creating the snapshot. In some cases, it will not be able to turn off the balancer in a timely manner, so the snapshot will be created with the balancer still running. If this happens, the snapshot may be in an inconsistent state (e.g., because chunk migrations may be in progress).
missingShards array of clusters List of shards that are missing from the snapshot. Only present for a sharded cluster snapshot. In steady state, this array will be empty. However, if the backup agent is unable to connect to a shard when a snapshot is created, it will be omitted from the snapshot. Each document in the array is a cluster document containing a self link.
parts array of parts The individual parts that comprise the complete snapshot. For a replica set, this array will contain a single element. For a sharded cluster, there will be one element for each shard plus one element for the config server.
parts.typeName string

The type of server represented by the part. Possible values are:

  • REPLICA_SET
  • CONFIG_SERVER
parts.clusterId string ID of the replica set. Not present for a config server.
parts.replicaSetName string Name of the replica set. Not present for a config server.
parts.encryptionEnabled boolean Indicates whether the snapshot data is encrypted.
parts.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.
parts.hostId string ID of a config server. Not present for a replica set.
parts.mongodVersion string The version of mongod that was running when the snapshot was created.
parts.dataSizeBytes number The total size of the data in the snapshot.
parts.storageSizeBytes number The total size of space allocated for document storage.
parts.fileSizeBytes number The total size of the data files.

Examples

Get All Snapshots

Request

curl -i -u "username:apiKey" --digest "https://<ops-manager-host>/api/public/v1.0/groups/525ec8394f5e625c80c7404a/clusters/53bc556ce4b049c88baec825/snapshots"

Response

HTTP/1.1 200 OK

{
  "totalCount" : 3,
  "results" : [ {
    "id" : "53bd5fb5e4b0774946a16fad",
    "groupId" : "525ec8394f5e625c80c7404a",
    "clusterId" : "53bc556ce4b049c88baec825",
    "created" : {
      "date" : "2014-07-09T15:24:37Z",
      "increment" : 1
    },
    "expires" : "2014-07-11T15:24:37Z",
    "complete" : true,
    "parts" : [ {
      "typeName" : "REPLICA_SET",
      "clusterId" : "53bc556ce4b049c88baec825",
      "replicaSetName" : "rs0",
      "mongodVersion" : "2.6.3",
      "dataSizeBytes" : 17344,
      "storageSizeBytes" : 10502144,
      "fileSizeBytes" : 67108864
    } ],
    "links" : [ ... ]
  }, {
    ...
  } ],
  "links": [ ... ]
}

Get One Snapshot

Request

curl -i -u "username:apiKey" --digest "https://<ops-manager-host>/api/public/v1.0/groups/525ec8394f5e625c80c7404a/clusters/53bc556ce4b049c88baec825/snapshots/53bd5fb5e4b0774946a16fad"

Response

HTTP/1.1 200 OK

{
  "id" : "53bd5fb5e4b0774946a16fad",
  "groupId" : "525ec8394f5e625c80c7404a",
  "clusterId" : "53bc556ce4b049c88baec825",
  "created" : {
    "date" : "2014-07-09T15:24:37Z",
    "increment" : 1
  },
  "expires" : "2014-07-11T15:24:37Z",
  "complete" : true,
  "parts" : [ {
    "typeName" : "REPLICA_SET",
    "clusterId" : "53bc556ce4b049c88baec825",
    "replicaSetName" : "rs0",
    "mongodVersion" : "2.6.3",
    "dataSizeBytes" : 17344,
    "storageSizeBytes" : 10502144,
    "fileSizeBytes" : 67108864
  } ],
  "links" : [ ... ]
}

Remove a Snapshot

Request

curl -i -u "username:apiKey" --digest -X DELETE "https://<ops-manager-host>/api/public/v1.0/groups/525ec8394f5e625c80c7404a/clusters/53bc556ce4b049c88baec825/snapshots/53bd5fb5e4b0774946a16fad"

Response

HTTP/1.1 200 OK