#MongoDBDaysBackup, Restore, andDisaster RecoveryCraig WilsonSoftware Engineer, 10gen
You Gotta Back It UpTo Get It BackLeo Laporte
Even More ImportantRestoring It
Slightly Less, But Still VeryImportantPractice
Backups with MongoDB• Not difficult   – Multiple options   – Choose the one that fits your needs• Can be automated• Practice
Choices
Choices• Selectivity• Live/Offline• Efficiency• Backup Size• Environment Constraints
mongodump• Dumps collections to *.bson files   – Use bsondump to view these files• Mirrors your structure• Can be run in l...
mongorestore• Selected dbs, collections• --oplogReplay
File System - fsync +lock• No more writes• Copy the data files• Remember to unlock
File System - Snapshot• Snapshot  – Journaling needs to be on  – Journal needs to be on the same volume
File System• Entire database• Backup files will be large• Fastest way to create a backup• Fastest way to restore a backup
Disaster Recovery
Replica SetsDisaster Avoidance
Disaster Avoidance• Redundancy• Multiple Datacenters• Multiple Regions
Disaster Avoidance > rs.conf(){   "_id" : "replSetName",   "version" : 3,   "members" : [   {      "_id" : 0,      "host" ...
Disaster Recovery Logistics• Recovery (restore) time• Replacement   – Machine   – Component (disk, memory, etc)   – Cluste...
Sharded Systems
Sharded Systems• No true point in time1. Stop balancing – sh.stopBalancer()2. Stop one config server (data R/O)3. Backup D...
What have we discussed?
What have we discussed?• You have Options• It’s not difficult• Practice!
#MongoDBDaysThank YouCraig WilsonSoftware Engineer, 10gen
Upcoming SlideShare
Loading in …5
×

Backup, Restore, and Disaster Recovery

713 views
623 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
713
On SlideShare
0
From Embeds
0
Number of Embeds
130
Actions
Shares
0
Downloads
14
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • Needs more content?
  • One of the Best Examples of this is Netflix and their Chaos Monkey.
  • 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

    ×