Best approach for migration data from one sharded collection to another sharded collection

Hello @Allwyn_Jesu ,

Could you please help me with below queries for better understanding of this migration?

  • Which MongoDB version?
  • Is collection_old still receiving inserts & updates?
  • Could you share the output of db.collection.stats().avgObjSize and db.collection.stats().size?
  • What sort of performance issues/other general issues are looking at?
  • How similar are collection_old & collection_new? Do they have the same shard key, indexes, document structure, etc?

I think, it will be better to check whether there are _id collisions between old & new and fix them beforehand, instead of trying to fix it after the fact? If they are very similar, and colliding _id can be avoided, perhaps a mongodump & mongorestore is the fastest way to achieve this, since you can specify the number of insertion worker.

Thanks,
Tarun

2 Likes