How to move millions of records between two mongodb servers?

I have a problem for moving data from server A to server B.
How to move millions of records between two MongoDB servers? I look for fast solution.

  1. I’m assuming that you want two separate clusters not a replica set.
  2. The most simple way is mongodump and mongorestore
  3. You could look into cluster to cluster sync

Hello @Ammar,

Welcome to the MongoDB Community forums :sparkles:

Could you please elaborate on the problem and the issue you are facing? Additionally, could you share the following details to better understand the case:

  • What is the size of the dataset?
  • What is the MongoDB version for both servers? Is it the same or different?
  • Where are both MongoDB servers deployed? On-prem or on MongoDB Atlas?
  • Are you considering downtime for the migration?

As @tapiocaPENGUIN mentioned, please refer to Back Up and Restore with MongoDB Tools to read more on how to leverage mongodump and mongorestore to migrate the data.

Furthermore, could you share if you have considered any method so far? If yes, please share the workflow with us.


Size: 200 millions record
Ver: MongoDB 6
On-premise setup
I want move 100 millions record to another server for backup.

I’m not sure what query or pattern the documents follow but you can do a mongodump with the --query flag to specify which ones get backed up.

If the server can be temporarily stopped, direct file copy can be also an option. (Of course, more requirements on the version/hardware…)

We can’t stop the server. We should move data to another server every 2 days