TechnologyNov 4, 20256 min read

Rubrik MongoDB Backup and Recovery Across Various Deployment Platforms


MongoDB is one of the most popular NoSQL databases. It is a document-oriented platform that stores data as BSON format, which is a binary extension of JSON-like document format. Documents are grouped together into a collection. A collection in MongoDB is analogous to a table in a relational database. 

MongoDB can be deployed in a variety of ways—and MongoDB provides various methods for managing backup and recovery for different deployment options. However, there are no good solutions available to consistently manage backup and recovery at scale across all the MongoDB deployment platforms.

Until now. 

Rubrik backup and recovery for self-managed MongoDB deployments is an easy-to-use, feature-rich data recovery management solution. Here’s how it works. 
 

 

 

The Anatomy of MongoDB Backup

MongoDB collections have a flexible schema design that supports nested documents, arrays, and dynamic schema to enable adaptable data modeling. MongoDB provides horizontal scalability, performance, and high availability for modern applications that require storing big data with flexible and scalable deployments. 

MongoDB has the following deployment options:

  • MongoDB Atlas: A fully-managed cloud DBaaS offering
  • MongoDB Enterprise: A self-managed commercial offering with additional capabilities and advanced security features
  • MongoDB Community: A self-managed free-to-use open-source offering


Just like any data management platform, backing up your MongoDB data protects against data loss. But unlike traditional structured databases, NoSQL databases backup and recovery is more challenging. For MongoDB that means:  

  • Capturing application-consistent point-in-time snapshots of an eventually consistent, replicated and distributed database

  • Establishing continuous backup, even after MongoDB node failure and replica-set master node switchover

  • Deduplicating different backup copies taken across replica-set nodes, as the physical layout of data across replica nodes is completely different

  • Leveraging MongoDB’s ability to seamlessly change cluster topology, despite the challenge of restoring earlier backups from old topologies 


Rubrik can meet these challenges, providing forever incremental and application-consistent backup using MongoDB replication operations logs (oplogs). Oplogs are structured BSON documents that record a history of all write operations performed on the MongoDB database. Here’s how it works:

  • One time first full backup is taken to create a base backup image. 

  • The incremental merge of oplogs is performed on the base backup image to create the backup image chain. 

  • MongoDB database collections are processed in parallel to speed up the creation of the backup image.
     

Mongodb | Rubrik


First Full Backup

  1. CDM initiates full backup for each collection in a DB. Multiple collections are processed across Mongo replica nodes in parallel.

  2. Rubrik Backup Service (RBS) running on Mongo node sets up a cursor for the collection and starts extracting documents. Multiple threads are used, each thread working on a different collection.

  3. Documents for each collection are copied to CDM cluster storage. This process completes after processing all the collections for a DB.

Oplog Backup

  1. CDM sends a request to start oplog tailing for each Mongo replica node.

  2. RBS running on Mongo node sets up cursor on oplog collection and starts tailing it to get oplog documents into memory.

  3. RBS filters the oplog documents based on collection name and writes those to CDM cluster storage. This process runs continuously.    

This Rubrik backup and recovery solution for MongoDB provides the flexibility of assigning SLA at a database level. If needed, certain collections in a database can be excluded from the backup process. This is an efficient way to manage backup data storage as it retains only a single copy of a replica-set data and continues taking incremental backups even in case of replica-set node failures.

 

Recovering MongoDB from Rubrik Backup

This solution provides different recovery options for the backup; a complete MongoDB source, a selected database, or specific collection(s) can be recovered. Recovery can be done to a point-in-time using MongoDB oplogs backup up to the desired RTO.
 

Mongodb | Rubrik


Recovery of backup

  1. CDM prepares the DB snapshot to restore. Additionally, if point-in-time recovery is needed for collection(s), the oplog snapshots required for recovery are also prepared.

  2. Mongo replica nodes are prepared for recovery using RBS.

  3. Mongo documents and oplogs are ingested to replica nodes from CDM, multiple threads are used to recover collections in-parallel.

The Rubrik backup and recovery solution for MongoDB is managed via Rubrik Security Cloud which provides an easy-to-use interface for multiple other enterprise applications. Various security and resiliency features are provided by Rubrik Security Cloud to keep MongoDB backups protected from data loss and security threats.

Learn more about Rubrik solutions for MongoDB.


 

Related Articles