26
Keeping Your Data Safe Andrew Erlichson ([email protected]) VP, Education & Cloud Services

Webinar: Keeping Your MongoDB Data Safe

  • Upload
    mongodb

  • View
    2.116

  • Download
    4

Embed Size (px)

DESCRIPTION

A backup and recovery strategy is necessary to protect your mission critical data against the risk of catastrophic failure or human error. In this session, we'll discuss the different strategies to backing up and restoring your MongoDB clusters in case of a disaster scenario. We'll review the benefits and drawbacks of various approaches, including taking filesystem snapshots, using mongodump, or using MongoDB Management Service.

Citation preview

Page 1: Webinar: Keeping Your MongoDB Data Safe

Keeping Your Data Safe

Andrew Erlichson ([email protected])VP, Education & Cloud Services

Page 2: Webinar: Keeping Your MongoDB Data Safe

Disasters do happen

Page 3: Webinar: Keeping Your MongoDB Data Safe

Sometimes they are our fault

Page 4: Webinar: Keeping Your MongoDB Data Safe

4

• Lose very little to zero data in a failure

• Down for a very short interval (availability is high)

• BUT: programmer errors, deliberate data loss is often replicated nearly instantly.

Replication

Page 5: Webinar: Keeping Your MongoDB Data Safe

5

• Much slower to restore (availability suffers)

• Out of date to some extent

• Fairly cheap

• Well isolated

• Handles all risks

Backup

Page 6: Webinar: Keeping Your MongoDB Data Safe

6

• Checkpointing through Snapshots

• Isolation

Backup Defined

Page 7: Webinar: Keeping Your MongoDB Data Safe

7

• mongodump/mongorestore

• Storage-level solutions

• MMS Backup (new!)

Backup Approaches

Page 8: Webinar: Keeping Your MongoDB Data Safe

8

Replication

Page 9: Webinar: Keeping Your MongoDB Data Safe

9

• Can be run in live or offline mode

• Oplog-aware for point-in-time operations

• Filter can be applied in both directions

• Considerations– Working set– Sharding

mongodump / mongorestore

Page 10: Webinar: Keeping Your MongoDB Data Safe

10

Backing upmongodump --host foo.bar.com --oplog --out /data/backup

Restoring

To a running mongodb

mongorestore –host foo.bar.com --oplogReplay /data/backup

Directly to the filesystem

mongorestore –dbpath /data/backup

Using Mongodump

Page 11: Webinar: Keeping Your MongoDB Data Safe

11

• Copy files in your data directory (e.g. /data/db)

• Filesystem or block storage snapshot

• Fastest way to backup/restore

• Considerations– Consistency– Backup granularity– Ops expertise

Storage-level Backups

Page 12: Webinar: Keeping Your MongoDB Data Safe

12

• Don’t turn off journaling– Safe to take a snapshot of a running system if

journaling journaling.

• No Journaling– either shutdown a node or use fsyncLock()

If you have Snapshotting

Page 13: Webinar: Keeping Your MongoDB Data Safe

13

• Use a volume manager that can handle taking incremental snapshots.

• Turn on journaling

• Backup from a secondary node

• Take a snapshot ever six hours (or whatever frequency you need)

• Use features with the volume manager to take incremental snapshots.

Single Replica Set – Best Practices

Page 14: Webinar: Keeping Your MongoDB Data Safe

14

Sharded Systems

Page 15: Webinar: Keeping Your MongoDB Data Safe

15

• Option 1: Run mongodump against the mongos router– But can’t use --oplog option– impractical for large system

• Option 2: Backup each shard individually– Stop the balancer– Shutdown a replica set secondary on each shard– Shut down a node of the config server– Run mongodump or take snapshot of each shard– Run mongodump against the config server– Restart the config server, restart the balancer,

Sharded System

Page 16: Webinar: Keeping Your MongoDB Data Safe

16

What is MongoDB Management Service (MMS)?

Page 17: Webinar: Keeping Your MongoDB Data Safe

17

MongoDB Management Service

MongoDB, Inc.

Page 18: Webinar: Keeping Your MongoDB Data Safe

18

Free Monitoring

Page 19: Webinar: Keeping Your MongoDB Data Safe

19

MMS Backup: Big Picture

Point in time restores• Restore replica to any moment in

last 24 hours.

Reliable• Developed and monitored by

MongoDB• Redundant data centers• Fully managed solution

Handles Sharded Systems• Consistent Snapshots

Frees up Engineering to do Engineering• Are backups your core competency?

Page 20: Webinar: Keeping Your MongoDB Data Safe

20

Unlimited free restoresSeed dev, test, or new environments

Page 21: Webinar: Keeping Your MongoDB Data Safe

21

• From the initial sync, we rebuild your data in our datacenters and take a snapshot

• We take snapshots every 6 hours

• Oplog is stored for 24 hours

MMS Backup (under the hood)

Page 22: Webinar: Keeping Your MongoDB Data Safe

22

Sharded Clusters

Backup Agent

Shard0 Shard1 Shard2

OPLOG

MongoDBDatcenter

Encrypted Oplog

Detect NOP and create snapshot for each shard

NOPsSnapshot

SnapshotSnapshot

NOPNOP

NOP

Page 23: Webinar: Keeping Your MongoDB Data Safe

23

Mongodump File system MMS Backup

Initial complexity Medium High Low

Confidence in Backups

Medium Medium High

Point in time recovery of replica set

Snapshot Moments only

Snapshot Moments only

24H

System Overhead High Varies Low

Scalable No With work Yes

Consistent Snapshot of Sharded System

Difficult Difficult Yes

Recovery Approaches

Page 24: Webinar: Keeping Your MongoDB Data Safe

24

1. Create an account at mms.mongodb.com

2. Install MMS Monitoring Agent on your deployment

3. Install MMS Backup Agent on your deployment

4. Start initial sync

5. Rest easy!

Getting Started with MMS Backup

Page 25: Webinar: Keeping Your MongoDB Data Safe

25

MongoDB WorldNew York City, June 23-25

http://world.mongodb.comSave $200 with discount code MODERNAPPS

#MongoDBWorld

See how Bosch, UK Government Digital Service, Carfax, Stripe and others are engineering the next generation of data with MongoDB

Page 26: Webinar: Keeping Your MongoDB Data Safe