0

I used MongoDB 3.6 and was following MongoDB documentation:

https://docs.mongodb.com/manual/tutorial/resync-replica-set-member

to do a full copy of data from Primary node to another mongod instance. I copied both admin and local plus all database folders into the new node. After all data are ready, added new node into replica set. It seems the replica set starts another initial sync and copy data from Primary to the new node. I got 400 GB data in primary node, so after a few hours Secondary node data size reach 600 GB and no disk space left and cause the sync fail. So it seems MongoDB still copying all data from Primary to Secondary even after I did this data copy manually. More surprisingly, it keeps the data I copied and continue to do its own data sync. Any suggestion?

  • For a file copy backup you need to include the full contents of the dbPath from your source replica set member and writes needs to be quiesced (mongod shutdown or writes stopped using db.syncLock()). If you are seeing new data files created in the dbPath on the target server, I suspect you have an incomplete copy of the source dbPath. – Stennie Aug 14 at 5:39
  • @Stennie: Thanks. Yes, I only copied all folders containing data plus admin, config and local folders. So you mean I will need to copy mongod.locck and all WiredTiger files as well? – Ben10 Aug 14 at 7:59
0

The way you perform the resync isn't right. To perform resync of the secondary member (assuming it is already a member of the replica set), bring down (stop mongod process) the secondaray node, delete all the folders from the /data directory including journal and restart the node so it re-joins the replica set again

Once it re-joins the replica set, mongodb will automatically copy all the data files including local database to the secondary. You don't need to copy admin or local database manually as mongo will take care of it

Thank you!

-Anban

  • Understand Mongo can do intial sync by delete all data from secondary. However, kept experience issue dba.stackexchange.com/questions/245242/… during this initial sync process. So trying to do a full copy of data as Mongo doc (link in my question) suggested – Ben10 Aug 17 at 2:46
  • May be your disk is corrupt and requires closer look into it. Can you try to change the sync source and then initiate the re-sync again? – Anban Aug 19 at 2:59

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.