Docs Menu
Docs Home
/
MongoDB Enterprise Kubernetes Operator
/

Configure MongoDB Database Backups

On this page

  • Considerations
  • Prerequisites
  • Procedure

You can configure continuous, automated backups for the MongoDB databases that the Kubernetes Operator manages using the MongoDB custom resource.

Note

If you already configured backups for your MongoDB resources during MongoDB database resource deployment, you don't need to complete the following procedure.

Before you configure backups for MongoDB resources, see the following considerations:

  • If you set assignment labels using the Kubernetes Operator, the values that you set in the Kubernetes configuration file for assignment labels override the values defined in the Ops Manager UI. Assignment labels that you don't set using the Kubernetes Operator continue to use the values set in the Ops Manager UI.

  • If you set a snapshot schedule field using the Kubernetes Operator, the value that you set in the Kubernetes configuration file for that field overrides the value defined in the Ops Manager UI. Snapshot schedule fields that you don't set using the Kubernetes Operator continue to use the value set in the Ops Manager UI.

    Example

    • You set backup.snapshotSchedule.snapshotIntervalHours=6 in the Kubernetes Operator.

    • You set the following values in the UI:

      • Snapshot Inverval: 10

      • Snapshot Retention Days: 5

    Ops Manager uses the following values for your deployment:

    • Snapshot Inverval: 6

    • Snapshot Retention Days: 5

  • If you enable backups for your MongoDB database deployment using the Kubernetes Operator, but you don't set a snapshot schedule using the Kubernetes Operator, Ops Manager uses the snapshot schedule you set in the Ops Manager UI.

  • If you enable backups for your MongoDB deployment, but you don't set a snapshot schedule at all, Ops Manager uses the default snapshot schedule.

Before you configure continuous backups for MongoDB resources, complete the following tasks:

1

Add the spec.backup.mode setting to the config file for your MongoDB database deployment and set its value to enabled as shown in the following replica set example:

1---
2apiVersion: mongodb.com/v1
3kind: MongoDB
4metadata:
5 name: <my-replica-set>
6spec:
7 members: 3
8 version: "6.0.0-ent"
9 type: ReplicaSet
10 opsManager:
11 configMapRef:
12 name: <my-project>
13 credentials: <my-credentials>
14 backup:
15 # Sets labels for the Backup Daemon.
16 assignmentLabels: ["test1", "test2"]
17 mode: enabled

To learn more about creating or editing a config file, see deploy a replica set or deploy a sharded cluster.

3

Add one or more spec.backup.assignmentLabels to the specification file for the deployment. Use assignment labels to identify that specific backup stores are associated with particular projects. Setting labels in Kubernetes Operator overrides labels that you set in Ops Manager. To learn more, see considerations.

See the example of the specification file with assignment labels earlier in this procedure.

4

Run the following command to check the status of the backups:

kubectl get mdb <resource-name> -n <metadata.namespace> -o yaml

The status.backup.statusname field indicates the status of the backup. The status displays STARTED when you successfully configure backups.

Back

Secure Internal Authentication with X.509