How it works...
The point of this recipe is to demonstrate a scenario where a database backup is being taken while there are operations still being performed on the server. In order to simulate this, we begin by opening two terminal windows. In step 1, we open a mongo shell (in the first Terminal window) and run a simple JavaScript code snippet, which would insert about 100,000 documents. As soon as you initiate this code, immediately switch to the other Terminal window and execute the mongodump utility as shown in step 2. We explicitly mention the --oplog flag to ensure we capture the point in time oplog entries of operations that are being performed during the backup operation. This will create a file called oplog.bson in the top level ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access