backup, restore, and disaster recovery

22
Software Engineer, 10gen Craig Wilson #MongoDBDays Backup, Restore, and Disaster Recovery

Upload: mongodb

Post on 15-Jan-2015

526 views

Category:

Documents


6 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Backup, Restore, and Disaster Recovery

Software Engineer, 10gen

Craig Wilson

#MongoDBDays

Backup, Restore, and Disaster Recovery

Page 2: Backup, Restore, and Disaster Recovery

You Gotta Back It UpTo Get It BackLeo Laporte

Page 3: Backup, Restore, and Disaster Recovery

Even More ImportantRestoring It

Page 4: Backup, Restore, and Disaster Recovery

Slightly Less, But Still Very ImportantPractice

Page 5: Backup, Restore, and Disaster Recovery

Backups with MongoDB

• Not difficult– Multiple options– Choose the one that fits your needs

• Can be automated

• Practice

Page 6: Backup, Restore, and Disaster Recovery

Choices

Page 7: Backup, Restore, and Disaster Recovery

Choices

• Selectivity

• Live/Offline

• Efficiency

• Backup Size

• Environment Constraints

Page 8: Backup, Restore, and Disaster Recovery

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

Page 9: Backup, Restore, and Disaster Recovery

mongorestore

• Selected dbs, collections

• --oplogReplay

Page 10: Backup, Restore, and Disaster Recovery

File System - fsync +lock• No more writes

• Copy the data files

• Remember to unlock

Page 11: Backup, Restore, and Disaster Recovery

File System - Snapshot

• Snapshot– Journaling needs to be on– Journal needs to be on the same volume

Page 12: Backup, Restore, and Disaster Recovery

File System

• Entire database

• Backup files will be large

• Fastest way to create a backup

• Fastest way to restore a backup

Page 13: Backup, Restore, and Disaster Recovery

Disaster Recovery

Page 14: Backup, Restore, and Disaster Recovery

Replica SetsDisaster Avoidance

Page 15: Backup, Restore, and Disaster Recovery

Disaster Avoidance

• Redundancy

• Multiple Datacenters

• Multiple Regions

Page 16: Backup, Restore, and Disaster Recovery

> 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” } }] }

Disaster Avoidance

Page 17: Backup, Restore, and Disaster Recovery

Disaster Recovery Logistics• Recovery (restore) time

• Replacement– Machine– Component (disk, memory, etc)– Cluster

• Configuration (reconfiguration)

Page 18: Backup, Restore, and Disaster Recovery

Sharded Systems

Page 19: Backup, Restore, and Disaster Recovery

Sharded Systems

• No true point in time

1. Stop balancing – sh.stopBalancer()

2. Stop one config server (data R/O)

3. Backup Data (shards, config)

4. Restart config server

5. Resume Balancer

Page 20: Backup, Restore, and Disaster Recovery

What have we discussed?

Page 21: Backup, Restore, and Disaster Recovery

What have we discussed?• You have Options

• It’s not difficult

• Practice!

Page 22: Backup, Restore, and Disaster Recovery

Software Engineer, 10gen

Craig Wilson

#MongoDBDays

Thank You