I have a MongoDB cluster runnning on 3 AWS EC2 instances, 1 for primary and 2 secondary nodes. I'm trying to perform a backup and restore without having to recreate the replica set. mongodump seems a bad option for the long term if the DB grows too much. So I tried to follow MongoDB documentation to create volume backups for /data and /journal from a secondary but how the backup is restored when using a replica set remains unclear. So:

  1. Will the primary and other secondaries be updated if I restore the backup to only one secondary?

  2. If not, can I restore the secondary backups to the primary? (Including /data and /journal volumes). What should I do afterwards? Will the primary replicate the changes to the secondary?

  3. Can I avoid recreating the replica set?

1 Answer 1

  1. No. Copying to Secondary will not help
  2. Yes. Primary will replicate the data to Secondary. Follow the steps below
  3. Re-creating the replica set is not an option


  1. You can restore it on the Secondary node first
  2. Next, Switch your Secondary with restored data to be the new Primary. Now the Primary has latest data
  3. Bring down the Secondary, erase its data and then bring it up (Do a Resync) so it can copy the data from the Primary with latest data
  4. Repeat the same on other Secondary
  5. Once done, you can switch your Primary if required
  • I tried that a couple times, last time between steps 1 and 2, the secondary node in which the backup was restored was updated by the primary before I could switch to Primary.
    – adrian
    Aug 27, 2019 at 7:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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