2 / 2
Jun 2024

Hi Team,

We have 4 sharded clusters with MongoDB version 4.4, and the total size of these clusters is roughly 28TB.

This MongoDB setup is on-premises, and I need to migrate these databases to a cloud VM with MongoDB version 6.6. Which approach should we use? In MySQL, we typically take a backup, note the binlog, restore the backup to the destination MySQL, and configure replication from the source to the destination using the last binlog. This way, legacy data is moved using the backup, and delta data is moved using replication. I need a similar approach for MongoDB, but it’s a sharded cluster.

Please advise.

Thanks & Regards,
Aravind

Hello,
To migrate your MongoDB sharded cluster to a cloud VM with MongoDB version 6.6, follow these steps:

Disable the Balancer:
Stop chunk migration by disabling the balancer.
Avoid metadata write operations during migration.
Use sh.stopBalancer() to disable the balancer.
Migrate Each Config Server Separately:
Deploy config servers as a replica set (CSRS) for consistency.
Start replacement config servers one by one.
Ensure no arbiters, delayed members, or index build restrictions1.
Migrate Shards:
Migrate non-primary members first, then the primary.
If the replica set has two voting members, add an arbiter to maintain majority votes during migration.
Remember to secure your instances before binding them to publicly-accessible IP addresses. Good luck with your migration.
Best Regards
esther598