This role makes MongoDB Logical, Physical, Selective, Incremental and Snapshot-based backups. Percona allows Point-in-time recovery. See the official page for more details.
- What's new
- Supported MongoDB Versions
- Make a Backup
- Restore a Backup
- Other Commands
- Notes and Problems
- UP version to
perconabackup_version: "2.4.1"
More information on the official page.
Backup Type | MongoDB Version |
---|---|
Logical | >= 4.4 |
Physical | 4.4.6-8, 5.0 and higher with MongoDB Replication enabled and WiredTiger configured as the storage engine. |
- Physical backup (for Percona Server for MongoDB only):
pbm backup --type=physical
- Logical (for Percona Server for MongoDB and MongoDB Community Edition)
Logical backup is the copying of the actual database data. A pbm-agent connects to the database, retrieves the data, and writes it to the remote backup storage.
pbm backup --type=logical
- Connect to primary Mongod node in replicaset or Mongocfg node in sharded cluster
- Disable point-in-time recovery, bacause a restore and point-in-time recovery oplog slicing are incompatible operations and cannot be run simultaneously:
pbm config --set pitr.enabled=false
- Stop the balancer and Mongos nodes
- Stop the arbiter nodes manually since there’s no pbm-agent on these nodes to do that automatically
- Make sure no writes are made to the database during restore
- List backups:
pbm list
- Restore:
pbm restore --time <timestamp> -w
- Restart all Mongod nodes (Not Mongos!):
ansible '!mongos_servers' -i hosts -m reboot
- Connect to primary Mongod node in replicaset or Mongocfg node in sharded cluster
- Resync the backup list with the storage:
pbm config --force-resync
- Start the balancer and start Mongos nodes
- Make a fresh backup to serve as the new base for future restores.
Full list of commands on the official page.
- In MongoDB:
db.runCommand( { buildInfo: 1 } )
- get MongoDB versiondb.getSiblingDB("admin").pbmConfig.findOne()
- get pbm config from MongoDB
- In command line:
pbm config
- set, change or list the configpbm status
- show PBM statuspbm logs
- show PBM logspbm list
- list backupspbm backup
- make backuppbm cancel-backup
- cancel backuppbm describe-backup <backup-name> --with-collections
- describe backuppbm restore
- restore backuppbm oplog-replay
- replay oplogpbm describe-restore 2022-08-15T11:14:55.683148162Z -c pbm-config.yaml
- describe restorepbm delete-backup
- delete a backuppbm delete-pitr
- delete PITR chunkspbm cleanup
- delete backups and PITR chunkspbm help
- help and additional commands
- A full backup is required to run PITR.
- Percona can't backup to local filesystem.