Navigation
You were redirected from a different version of the documentation. Click here to go back.

Backup Configurations

Overview

A backup configuration determines the settings used to back up a sharded cluster or replica set. The backupConfigs resource lets you view and update backup configurations. In certain cases, you can also create backup configurations, as described in the Update a Backup Configuration section. The backupConfigs resource supports only the GET and PATCH methods.

To update or create a backup configuration, you must issue the request from an IP address on your user account’s whitelist. The backupConfigs resource accepts PATCH requests only from whitelisted IP addresses.

Endpoints

Get All Backup Configurations for a Group

GET /api/public/v1.0/groups/GROUP-ID/backupConfigs

Get a Single Backup Configuration

Get a single backup configuration by cluster ID. CLUSTER-ID must be the ID of either a replica set or a sharded cluster.

GET /api/public/v1.0/groups/GROUP-ID/backupConfigs/CLUSTER-ID

Update a Backup Configuration

To change the state of an existing backup configuration you use the PATCH method. Send only those fields where you will change the value.

You cannot modify the username and password fields for a replica set or sharded cluster that is managed by Ops Manager Automation.

PATCH changes are generally asynchronous and will result in a response status code of 202 (Accepted). Additionally, if you issue a GET request for a backup configuration after a successful PATCH, the returned entity may not immediately reflect the update given the asynchronous nature of these state transitions.

PATCH /api/public/v1.0/groups/GROUP-ID/backupConfigs/CLUSTER-ID

When modifying the statusName property, these are the acceptable transitions:

  • STARTED: valid if the current status is STOPPED or INACTIVE.
  • STOPPED: valid if the current status is STARTED.
  • TERMINATING: valid if the current status is STOPPED.

You cannot change the statusName to INACTIVE or PROVISIONING.

Every sharded cluster and replica set has a backup configuration that is set to INACTIVE by default. If you have already activated Backup for your account, then you can back up a cluster or replica set through the API by changing the statusName property to STARTED.

Sample Entity

If you issue a PATCH request, send only those fields whose values are being changed.

{
  "authMechanismName": "MONGODB_CR",
  "clusterId": "yyy",
  "encryptionEnabled" : true
  "excludedNamespaces": [ "a", "b", "c.d" ],
  "storageEngineName" : "WIRED_TIGER",
  "groupId": "xxx",
  "statusName": "STARTED",
  "username": "johnny5",
  "password": "guess!",
  "sslEnabled": false,
  "syncSource": "PRIMARY",
  "provisioned": true,
}

Entity Fields

Name Type Description
groupId string ID of the group that owns this backup configuration.
clusterId string ID of the cluster that this backup configuration is for.
statusName string

The current (or desired) status of the backup configuration. Possible values are:

  • INACTIVE
  • PROVISIONING
  • STARTED
  • STOPPED
  • TERMINATING
storageEngineName string

The storage engine used for the backup. Possible values are:

  • MEMORY_MAPPED
  • WIRED_TIGER
authMechanismName string

The name of the authentication mechanism to use when connecting to the sync source database. Only present when using authentication. Possible values are:

  • MONGODB_CR
  • GSSAPI
  • PLAIN
  • MONGODB_X509
  • NONE
username string

The username to use to connect to the sync source database. Only present when backing up mongod instances that require clients to authenticate.

You can send this field to Ops Manager only when updating the backup configuration for a replica set or sharded cluster that is not managed by Ops Manager Automation.

password string

The password to use to connect to the sync source database. Only present when backup the mongod instances that require clients to authenticate. GET requests do not include this field.

You can send this field to Ops Manager only when updating the backup configuration for a replica set or sharded cluster that is not managed by Ops Manager Automation.

encryptionEnabled boolean Specifies whether encryption is enabled for the backup configuration. You must include the syncSource field when enabling encryption for a backup configuration. For existing backups in a group, enabling encryption requires an initial backup sync to recreate the backups’ head databases. See Encrypted Backup Snapshots for more information, including a list of prerequisites.
sslEnabled boolean Is SSL enabled for the sync source database?
syncSource string The mongod instance to get backup data from. Possible values are either a specific hostname or one of: PRIMARY and SECONDARY. This field is only used when updating a backup configuration. It is not returned by a GET request.
provisioned boolean Reports if Ops Manager has provisioned the resources needed to store a backup. This field is only present when the amount of data to be backed up exceeds a certain threshold.
excludedNamespaces string array

A list of database names and collection names to omit from the backup. Each string is a namespace in the form of <database> or <database>.<collection>. If this field is present the includedNamespaces field cannot be present.

You must send the new full list of excluded namespaces, including any that were already listed.

If the new list removes any namespaces from the previous list, you must also set the syncSource field, as the removal of an excluded namespace necessitates a full resync. Without the syncSource field, the request will fail.

If the new list only adds to the previous list, you do not need to set syncSource.

includedNamespaces string array

A list of database names and collection names to include in the backup. Each string is a namespace in the form of <database> or <database>.<collection>. Any namespace not listed in this array will not be backed up. If this field is present the excludedNamespaces field cannot be present.

You must send the new full list of included namespaces, including any that were already listed.

If the new list adds any namespaces to the previous list, you must also set the syncSource field, as the addition of an included namespace necessitates a full resync. Without the syncSource field, the request will fail.

If the new list only removes namespaces from the previous list, you do not need to set syncSource.

Examples

Get a Single Backup Configuration

Request

curl -i -u "username:apiKey" --digest "https://<ops-manager-host>/api/public/v1.0/groups/5196d3628d022db4cbc26d9e/backupConfigs/5196e5b0e4b0fca9cc88334a"

Response

HTTP/1.1 200 OK

{
  "groupId" : "5196d3628d022db4cbc26d9e",
  "clusterId" : "5196e5b0e4b0fca9cc88334a",
  "statusName" : "STARTED",
  "storageEngineName" : "WIRED_TIGER",
  "sslEnabled" : false,
  "excludedNamespaces" : [ ],
  "links" : [ ... ]
}

Get All Backup Configurations for a Group

Request

curl -i -u "username:apiKey" --digest "https://<ops-manager-host>/api/public/v1.0/groups/5196d3628d022db4cbc26d9e/backupConfigs"

Response

HTTP/1.1 200 OK

{
  "totalCount" : 3,
  "results" : [ {
    "groupId" : "5196d3628d022db4cbc26d9e",
    "clusterId" : "5196e5b0e4b0fca9cc88334a",
    "statusName" : "STARTED",
    "storageEngineName" : "WIRED_TIGER",
    "sslEnabled" : false,
    "excludedNamespaces" : [ ],
    "links" : [ ... ]
  }, {
    "groupId" : "5196d3628d022db4cbc26d9e",
    "clusterId" : "51a2ac88e4b0371c2dbf46ea",
    "statusName" : "STARTED",
    "storageEngineName" : "MEMORY_MAPPED",
    "sslEnabled" : false,
    "excludedNamespaces" : [ ],
    "links" : [ ... ]
  }, {
    "groupId" : "5196d3628d022db4cbc26d9e",
    "clusterId" : "52d33abee4b0ca49bc6acd6c",
    "statusName" : "STOPPED",
    "storageEngineName" : "WIRED_TIGER",
    "sslEnabled" : false,
    "excludedNamespaces" : [ ],
    "links" : [ ... ]
  } ],
  "links" : [ ... ]
}

Update a Backup Configuration

Request

curl -i -u "username:apiKey" -H "Content-Type: application/json" --digest -X PATCH "https://<ops-manager-host>/api/public/v1.0/groups/5196d3628d022db4cbc26d9e/backupConfigs/5196e5b0e4b0fca9cc88334a" --data '
{
  "statusName": "STOPPED"
}'

Response

HTTP/1.1 202 Accepted

{
  "groupId" : "5196d3628d022db4cbc26d9e",
  "clusterId" : "5196e5b0e4b0fca9cc88334a",
  "statusName" : "STOPPED",
  "storageEngineName" : "WIRED_TIGER",
  "sslEnabled" : false,
  "excludedNamespaces" : [ ],
  "links" : [ ... ]
}