Backing up by using MongoDB CE pods internally

Back up by using a MongoDB CE replica set pod internally within the Red Hat® OpenShift® cluster.

Before you begin

The administrator needs to get the credentials and determine the primary set member. For more information, see Getting the credentials and determining the primary set member.

Procedure

  1. Create a directory for the backups.
    oc exec -it mas-mongo-ce-0 -c mongod --namespace mongoce -- bash -c "mkdir /data/backups"
  2. Back up the databases.
    Example of backing up Maximo® Application Suite core databases mas_{{instanceId}}_core and mas_{{instanceId}}_catalog.
    oc exec -it mas-mongo-ce-0 -c mongod --namespace mongoce -- bash -c "mongodump --host={{primaryHost}} --port=27017 --username=admin --password={{decodedPassword}} --authenticationDatabase=admin --ssl --sslCAFile=/var/lib/tls/ca/ca.crt  -d mas_{{instanceId}}_core --archive=/data/backups/mas_{{instanceId}}_core.archive"
    oc exec -it mas-mongo-ce-0 -c mongod --namespace mongoce -- bash -c "mongodump --host={{primaryHost}} --port=27017 --username=admin --password={{decodedPassword}} --authenticationDatabase=admin --ssl --sslCAFile=/var/lib/tls/ca/ca.crt  -d mas_{{instanceId}}_catalog --archive=/data/backups/mas_{{instanceId}}_catalog.archive"
  3. Copy the backup archives to the local system.
    oc cp mongoce/mas-mongo-ce-0:/data/backups ./backups -c mongod
  4. Remove back ups from the mongod container in the mas-mongo-ce-0 pod.
    oc exec -it mas-mongo-ce-0 -c mongod --namespace mongoce -- bash -c "rm -rf /data/backups"
    Note: The archive files are stored in ./backups on the administrator's local computer. Copy the archives to a safe location.