Migration of Replica set to new datacenter

Hello All,

I have a replica set with three nodes primary,secondary and arbiter nodes. I need to migrate this replica set to new data center, can you please advise me what is the best option to perform this migration with minimum downtime? The size of datastore is around 4TB.

Thanks!

Welcome to the MongoDB Community @Kamal_Mahana!

I expect you may have completed your migration by now, but here is a suggestion if you are still in the planning stage (or perhaps someone else has a similar question).

You can migrate your replica set from the original data centre (DC1) to a new data centre (DC2) without downtime by temporarily adding more members to your replica set.

As general steps I would:

  • Add members in DC2 using initial sync or a file copy backup.

  • Configure additional members in DC2 as hidden, priority 0 until you are ready to start sending application traffic to the new data centre.

  • When ready to switch over, reconfigure the new members in DC2 as electable and hide the original members in DC1.

  • Remove the hidden members in DC1 to finalise your migration.

I also recommend taking this opportunity to replace your arbiter with a full data-bearing secondary. Arbiters are not ideal (see my comment on Replica set with 3 DB Nodes and 1 Arbiter) and the operational consequences will be more disruptive with an active cluster.

Regards,
Stennie