I'm running MongoDB 3.2.9 with WiredTiger on 3 EC2 instances. When backing up the database volumes using elastic block store snapshots, do I need to perform db.fsyncLock() when running a 3 node replica set where all nodes are running without journal enabled? Additionally, for reference, my storage.dbPath maps to a dedicated EBS volume for /data on each mongod instance on each EC2 server. There are also separate dedicated volumes for logs.

I'm working off of the below documentation for reference, but it's not clear how these steps map from single instance deployments to replica set deployments: https://docs.mongodb.com/ecosystem/tutorial/backup-and-restore-mongodb-on-amazon-ec2

If I do need to run db.fsyncLock(), does the lock apply to all instances on all EC2 servers? The documentation says that it locks the 'entire' mongod instance, but it's not clear to me whether the instance in this case refers to an instance on a single EC2 server, or if this applies to all instances in the replica set spread over all EC2 servers (3 EC2 servers in my case).

  • Can you clarify whether journal is enabled for your data nodes? You mention "an arbiter without Journal enabled" but then "There are also separate dedicated volumes for /logs and the journalling performed by WiredTiger.' Ideally the journal should always be enabled for all data-bearing nodes (which is the default setting). – Stennie Apr 6 '18 at 1:07
  • @Stennie I've updated the text to clarify that all nodes are running without Journal enabled. This is not ideal, and will be changed in the future. WiredTiger does some journalling itself independent of whether journal is enabled in the mongod.conf file. I added that last bit about dedicated volumes to hammer down the point that the /data volumes are independent of everything else, one ebs volume per node for each /data directory. – GarySharpe Apr 7 '18 at 0:22
  • Which files are you referring to for WiredTiger journal independent of the journal setting? These are likely metadata files rather than journal. NOTE: in addition to reducing data recovery options after unclean shutdown, disabling the journal will generally reduce performance in a replica set environment with WiredTiger. Some read or write concerns require acknowledgement of data being written to disk; without journal the only option to satisfy that will be a sync to data files. The --nojournal option has been deprecated for replica set members using WiredTiger as of MongoDB 3.6. – Stennie Apr 7 '18 at 0:57

Yes, to get a consistent backup (when journaling is not enabled) you need to db.synclock your mongod. You use synclock only at that node from where you take the backup (and you only need to make the backup from one node; you can restore whole replica set from one backup). db.synclock locks only that node where you give this command, other nodes work as they were, so lock (and make the backup) one of the SECONDARY nodes.

Addition, you DON'T need to make the backup of arbiter, because there is no data to be backuped. Arbiter is just "voter" or "observer" at replica set.

| improve this answer | |
  • 1
    FYI: there is no need to run db.fsyncLock() for WiredTiger in 3.2 when taking filesystem/EBS snapshot backups (even if the journal files reside on a separate volume). This is mentioned on docs.mongodb.com/manual/tutorial/…: Changed in version 3.2: MongoDB 3.2 added support for volume-level back up of MongoDB instances using the WiredTiger storage engine when the MongoDB instance’s data files and journal files reside on separate volumes. – Stennie Apr 5 '18 at 10:28
  • 1
    @Stennie, question asker wrote that there is no journaling! – JJussi Apr 5 '18 at 11:41
  • 1
    I read the phrasing as "an arbiter without Journal enabled" because the OP went on to say "There are also separate dedicated volumes for /logs and the journalling performed by WiredTiger.". Will ask for clarification. – Stennie Apr 6 '18 at 1:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.