How to replicate between On-Premises and Azure

I have three 3 node cluster on-premises ( 1 Primary and 2 Secondary ). I have same 3 node cluster in AZURE ( 1 Primary and 2 Secondary ) with same version and data but with different FQDN in azure. How shall I connect mongodb replica set in azure to mongodb replica set in on-premises so that they can start replicating the data. Later I would like to switch off on-premises mongodb and move finally to azure. My question is:

  1. What would be my architecture? Shall I make all the 3 members in azure secondary with hidden:true , priority:0 and add/connect all of them to on-premises?
  2. What configuration changes do I need to make in mongod.conf file both in on-prem and in azure so that communication/replication can be established between the nodes?

Hi @Amanullah_Ashraf1,

Sounds like you are trying to migrate to Atlas.

In this case, the Atlas Live Migration Service is what you need.

You cannot add directly on-prem nodes in Atlas. This would be a security issue and how would Atlas administer / monitor / upgrade these nodes?

See my answer here:

If you want to replicate data, you could manually set up Change Streams and push the write operations from on-prem to Atlas, but this is a lot of work (need monitoring, restart algorithm, etc).

To keep it simple, I would just migrate the service in one shot when you are ready by starting from an empty cluster in Atlas equivalent (in size) to your current on-prem machines (or bigger) and I would migrate in one shot using the Migration tool.

Cheers,
Maxime.

Thanks for your response. I am migrating to AZURE (IaaS) from On-Premises. Not on Atlas. Thanks

Oops. When I saw Azure, my mind immediately switched to Atlas as it’s the easiest way to deploy MongoDB in Azure.

Then if your oplog windows is large enough, I would recreate 3 nodes from scratch using the latest full backup in Azure. Then you just have to add these 3 new nodes in your on-prem RS and it will just catch up using the oplog (if they are still in the oplog window).

This would avoid the 3 initial sync & costly data transfer (in money & time). You can make them hidden:true and p:0 if you want, it’s up to you. Just remember to update the connection strings in your apps.

In the config you will have to add the IP addresses (bind ip).

I don’t know much about Azure without Atlas so I’m not super useful. Sorry for the misunderstanding.

Cheers,
Maxime.

2 Likes

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.