Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Backup, Restore, and Disaster Recovery

800 views

Published on

  • Be the first to comment

  • Be the first to like this

Backup, Restore, and Disaster Recovery

  1. 1. #MongoDBDaysBackup, Restore, andDisaster RecoveryCraig WilsonSoftware Engineer, 10gen
  2. 2. You Gotta Back It UpTo Get It BackLeo Laporte
  3. 3. Even More ImportantRestoring It
  4. 4. Slightly Less, But Still VeryImportantPractice
  5. 5. Backups with MongoDB• Not difficult – Multiple options – Choose the one that fits your needs• Can be automated• Practice
  6. 6. Choices
  7. 7. Choices• Selectivity• Live/Offline• Efficiency• Backup Size• Environment Constraints
  8. 8. mongodump• Dumps collections to *.bson files – Use bsondump to view these files• Mirrors your structure• Can be run in live or offline mode• --dbpath for direct file access• --oplog to dump oplog last PIT• --query/filter selective dump
  9. 9. mongorestore• Selected dbs, collections• --oplogReplay
  10. 10. File System - fsync +lock• No more writes• Copy the data files• Remember to unlock
  11. 11. File System - Snapshot• Snapshot – Journaling needs to be on – Journal needs to be on the same volume
  12. 12. File System• Entire database• Backup files will be large• Fastest way to create a backup• Fastest way to restore a backup
  13. 13. Disaster Recovery
  14. 14. Replica SetsDisaster Avoidance
  15. 15. Disaster Avoidance• Redundancy• Multiple Datacenters• Multiple Regions
  16. 16. Disaster Avoidance > rs.conf(){ "_id" : "replSetName", "version" : 3, "members" : [ { "_id" : 0, "host" : "myhost1.dnsname.com:27017“, “tags” : { “dc” : “east” } }, { "_id" : 1, "host" : "myhost2.dnsname.com:27017“, “tags” : { “dc” : “east” } }, { "_id" : 2, "host" : "myhost3.dnsname.com:27017“, “tags” : { “dc” : “west” } }]}
  17. 17. Disaster Recovery Logistics• Recovery (restore) time• Replacement – Machine – Component (disk, memory, etc) – Cluster• Configuration (reconfiguration)
  18. 18. Sharded Systems
  19. 19. Sharded Systems• No true point in time1. Stop balancing – sh.stopBalancer()2. Stop one config server (data R/O)3. Backup Data (shards, config)4. Restart config server5. Resume Balancer
  20. 20. What have we discussed?
  21. 21. What have we discussed?• You have Options• It’s not difficult• Practice!
  22. 22. #MongoDBDaysThank YouCraig WilsonSoftware Engineer, 10gen

×