The Backup Methods Available for MongoDB
Adamo Tonete
The Backup Methods Available for MongoDB Adamo Tonete Agenda - - PowerPoint PPT Presentation
The Backup Methods Available for MongoDB Adamo Tonete Agenda Backup importance for companies and backup plans. Available Methods: - Disk Snapshot - mongodump - rsync or copy - Point in time backup from Percona - MongoDB Cloud / Ops
Adamo Tonete
2
Backup importance for companies and backup plans. Available Methods:
Q&A
4
5
7
Data usually is the most valuable asset in a company. A company with severe data loss may not even come back to the business. Could you imagine a bank losing all its data or an e-commerce offline for 1 week?
8
Data loss can occur in 3 main different situations: 1) Human Error 2) DB failure/corruption 3) System failure/collapse 4) Security Breach
10
Backup Plan Choose the best RPO, RTO for your company.
11
12
13
1TB replica-set
14
1TB replica- set
15
1TB replica- set 95% read 5% writes
16
1TB replica- set 2000 inserts/day 3000 review day
17
We have 1TB data and... 5 GB is for user login 2 GB day of new writes ~ 900 GB of reviews and 40GB is the favorites (90% of the traffic) Favorites are updated every 20 minutes asynchronous.
18
Login Favorites Comment/upvote Historical data/non fav 90% traffic - 10% data 10% traffic - 90% data
19
20
5 GB user - 30 minutes 40 GB favorites - 20 minutes 900 GB - non favorite data Comments every hour - 500 MB
21
What feature should have priority in a recovery situation?
22
Login Favorites Comment/upvote 90% traffic - 10% data
23
and slowly recovering the old data.
depends on the expectations.
25
Disk snapshot is a full copy of the data currently in a disk. The snapshot process may take a while but the advantage is when a restore is needed the files are already ready for the database. No need to create indexes or run a file restore, the recover time is fast.
26
Advantages: Straight forward approach, take a copy of what is in the disk and that’s all.
27
Disadvantages May slow down the database while the snapshot is being created. Can take several hours depending on the disk speed No "partial" restore all or nothing
28
Backup type: Binary copy Time to backup: High Complexity: Low Time to recover: Low
30
while a mongod process is stopped or all the writes are stopped.
31
Advantages Data is ready to be used in the target folder. Just start the mongod process using the backup folder.
32
Disadvantages Needs to stop a secondary or lock writes. May affect performance. Restore is all or nothing.
33
Backup type: Binary Time to backup: High Complexity: Medium Time to recover: Low
35
mongodump in bounded with mongodb and it is the preferable tool to backup a mongodb database. It is important to mention there are 2 steps to perform a disaster recover when using mongodump 1) create the dump file 2) restore the dump file with mongorestore
36
Use mongodump to create backups per:
37
Although the mongodump tool is very versatile only having backup file doesn't mean you are safe. dump files need to processed by mongorestore to rebuild the database. An error in the dump file may break the entire restore process.
38
Backup files Backup files dump process
39
Backup files Backup files Collection Start Time End Time users T T+10 logins T T+20 favorites T+10 T+30
T+20 T+40
40
Backup files Backup files
41
Backup files Backup files dump process
l
42
Backup files Backup files Collection Start Time End Time
users T T+10 T+50 logins T T+20 T+40 favorites T+10 T+30 T+20 messages T+20 T+40 T+0 Oplog
43
It is easy to achieve a point in time backup in a replica-set with mongodump. However the same is not true for sharding. How to guarantee all the backups will end at the same time? https://github.com/Percona-Lab/mongodb_consistent_backup
44
Percona POINT in time backup is a Beta tool from percona to backup a cluster wide project in a point in time way. It does rely on mongodump and ensures all the dumps ends at the same time generating an point in time backup from a cluster. Full backup, not partial
45
46
Advantages Highly flexible tool to generate backups. Default logical backup method offered by mongodb
47
Disadvantages Default behavior is not point in time. Restore time can take longer as indexes needs to be rebuilt. Backup files needs to be tested
48
Backup type: logical Time to backup: depends Complexity: low to high Time to recover: depends usually high
50
Fully managed backup service offered by MongoDB It is possible to backup using cloud provider snapshot or continuous backup. Only need an agent installed and all done. The configuration is done by a
51
Backup type: logical/snapshots Time to backup: low Complexity: (unknown) Time to recover: (unknown) would say fast as the data is in the same DC
53
Binary lightweight backup method that copies the database to a different folder/disk without affecting the instance performance. Available in WiredTiger only. Acts very similar to a disk snapshot but in the database level. Generates a point of time copy of the database.
54
Backup type: logical Time to backup: medium Complexity: low Time to recover: low
56
Rate My Session
57
Thank You Sponsors!!