Bobcares

How we configure MongoDB backup strategy

by | May 22, 2019

MongoDB is a better choice to store very large datasets in various web applications such as Facebook.

Also, MongoDB speeds up the data retrieval process by storing the data in a single document.

However, any problem with database makes web applications unavailable. Therefore, it’s critical to have a proper MongoDB backup strategy.

At Bobcares, we often get requests from our customers set up MongoDB backup strategy as part of our Server Management Services.

Today, we’ll see how our Support Engineers set up MongoDB backup strategy and fix the related errors.

Why have a MongoDB backup strategy?

Any application that requires high availability, clustering, fast performance, then MongoDB is one of the best backend databases for these applications.

Also, having a proper MongoDB backup strategy prevents you from data loss. Fortunately, in production servers having automated scheduled backups really work as a fallback option.

In the case of a failure such as a data center migration or bug in your system, MongoDB backups help to recover the data. Again, the backup strategy can vary in different scenario. It depends on the type of servers, data, and application constraints.

 

The top 3 MongoDB Backup Strategies

Here, let’s look at major backup strategies for the MongoDB database.

MongoDB can back up by three main methods:

1. Mongodump

Mongodump is a backup tool used for creating a backup of the data in MongoDB and it captures the documents in the database.

Furthermore, the mongodump strategy is sufficient for a small deployment, they are not suitable for larger systems. In addition, mongorestore utility is also available to restore the data from the existing database.

Our Support Engineers took the backup of a whole Database by using the following command

mongodump --db mydb --out /var/backups/mongo

 

2. Copying the Underlying Files

MongoDB can be back up by copying the underlying files of the MongoDB database. Also, MongoDB supports a point-in-time snapshot.

This snapshots can use to create MongoDB backups at the exact time. Before taking the snapshot of the database, it is necessary to stop all writes to the database for the successful restoration of the database.

This method is efficient than mongodump for taking full backups and restoring the MongoDB database.

 

3. MongoDB Management Service (MMS)

MMS provides monitoring and backup capabilities. Above all, this is the only continuous backup solution for MongoDB. Also, it features point-in-time recovery and fully managed backup strategy.

In addition, MongoDB Management Service avoids the need for custom backup monitoring.

 

 

How we set up the backup strategy for our customer

Recently, one of our customers requested help with regularly taking a backup of all his MongoDB databases.

Then our Support Engineers took the following steps to set up a backup strategy.

We took copying the underlying files strategy as a backup option for this customer. Because the customer needed to back up the entire folder /backup/databases/mongoDatabases/ containing MongoDB database backups.

Unlike normal MySQL databases, MongoDB backup contains a complete folder structure. In MySQL, the backup will be a single .sql file. Therefore, the backup strategy for MongoDB needs to maintain the exact directory structure.

So, we first created a tar file of backup folders at “/backup/databases/mongoDatabases” and uploaded to FTP server.

Then, we verified that the tar file is transferred completely.

150 Opening ASCII mode data connection for file list
drwxr-xr-x 2 u119953 u119953 3 Feb 28 10:16
drwxr-xr-x 3 u119953 u119953 11 Feb 27 20:43
-rw-r--r-- 1 u119953 u119953 2904 Feb 28 10:16 02-28-17.tgz 226 Transfer complete

In order to automate this task, our Dedicated Engineers set it up as a cron job on the server to run at 3 am every day. Thus, the customer had a set of MongoDB backup in his backup FTP server.

 

[Having trouble while setting up MongoDB backup strategy? We’ll fix it for you.]

 

Conclusion

In short, backups are essential to safeguard your data. MongoDB backup strategy minimizes data loss in case of a disaster event as much as possible. Today, we saw the various methods for MongoDB backup and how our Support Engineers setup MongoDB backup strategy for one of our customer.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF