Back up by using a MongoDB CE replica set pod internally
within the Red Hat® OpenShift® cluster.
Procedure
- Create a directory for the backups.
oc exec -it mas-mongo-ce-0 -c mongod --namespace mongoce -- bash -c "mkdir /data/backups"
-
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"
- Copy the backup archives to the local system.
oc cp mongoce/mas-mongo-ce-0:/data/backups ./backups -c mongod
- 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.