Configuring backup with the MongoDB Ops Manager

By default, backing up data is disabled for the MongoDB Ops Manager.

Before you begin

Create a MongoDB Ops Manager instance that meets the following configuration requirements:
Number of replicas: 3
Number of cores: 4
Memory: 8 GiB
Storage size: 64 GiB
The following example is a custom resource that meets the minimum requirements for backup and restore.
apiVersion: mongodb.cpd.ibm.com/v1
kind: CPDMongoDBOpsManager
metadata:
  name: <opsManagerInstanceName>     #Replace with your instance name
spec:
  license:
    accept: true
  version: 4.0.0
  dedicated: false
  replicas: 2
  storageSize: "64G"
  storageClass: <yourStorageClass>     #Replace with your storage class
  resources:
    requests:
      cpu: "4"
      memory: "8G"
    limits:
      cpu: "4"
      memory: "8G"
  applicationDatabase:
    replicas: 3
    storageSize: "64G"
    storageClass: <yourStorageClass>     #Replace with your storage class
    resources:
      requests:
        cpu: "4"
        memory: "8G"
      limits:
        cpu: "4"
        memory: "8G"
For details on creating a MongoDB Ops Manager instance, see Deploying MongoDB OpsManager with a custom resource.

Procedure

  1. Create two MongoDB instances.
    Name these instances opLogStores and blockStores. The instances must meet the following configuration requirements:
    apiVersion: mongodb.cpd.ibm.com/v1
    kind: CPDMongoDB
    metadata:
      name: <yourMongoDBInstanceName>     #Replace with your service instance name
    spec:
      license:
        accept: true
      opsManager: <opsManagerInstanceName>     #Replace with your Ops Manager instance name
      replicas: 1
      storageSize: "16G"
      storageClass: <yourStorageClass>     #Replace with your storage class.
      dedicated: false
      resources:
        requests:
          memory: 1Gi
          cpu: 1
        limits:
          memory: 1Gi
          cpu: 1
    Important: Do not change the spec.backup.opLogStores instance name after it has been created.
    Confirm that PHASE of the MongoDB instances returns Running with the following command:
    % oc get mdb
    Output should be similar to the following example:
    NAME             PHASE     VERSION     TYPE         AGE
    blog2-mongodb    Running   4.4.0-ent   ReplicaSet   3d23h
    mdb2-mongodb     Running   4.4.0-ent   ReplicaSet   3d23h
    oplog2-mongodb   Running   4.4.0-ent   ReplicaSet   3d23h
  2. Configure Ops Manager to enable backups.
    1. Run the following command to edit your custom resource.
      oc edit CPDMongoDBOpsManager <opsManagerInstanceName> cpdmongodbopsmanager.mongodb.cpd.ibm.com/<opsManagerInstanceName>
    2. Add the following backup configuration to your custom resource. Modify the variables for your environment.
        backup:
          enabled: true
          headDB:
            storageClass: <yourStorageClass>   # Replace with your storage class
          opLogStores:
            - name: oplog
              mongodbResourceRef:
                name: <instancename>-mongodb   # MongoDB instance for opLogStores
          blockStores:
            - name: blockStore
              mongodbResourceRef:
                name: <instancename>-mongodb  # MongoDB instance for blockStores
  3. Confirm that your MongoDB Ops Manager instance is running.
    Run the following command to check the status of your Ops Manager instance.
    % oc get om
    Check that the STATE (BACKUP) returns Running. Output should be similar to the following example:
    NAME                      REPLICAS   VERSION   STATE (OPSMANAGER)   STATE (APPDB)   STATE (BACKUP)   AGE     WARNINGS
    mongodb-om2-ops-manager   2          5.0.6     Running              Running         Running          3d23h
  4. Configure your instance to backup your data.
    1. Open the MongoDB Ops Manager. See Administering with the MongoDB Ops Manager for details.
    2. Navigate to the Organizations page from the MongoDB Ops Manager.
    3. Click the MongoDB instance to backup.
    4. Click Continuous Backup in the navigation menu.
    5. Click Begin Setup> Next.
    6. Choose your MongoDB instance as the Replica Set or Cluster.
    7. Click Start Backup.