Mongodb in replica / kubernetes

Hi,

I currently have MongoDB as a replica on 3 Docker containers on Machine_1. All is running great.
But, I wish to create a Production environment running on Machine_2. It will be the same architecture, so using a replica of MongoDB and running in 3 containers. It will be my master DB.

So Machine_1 with its replica will remain a copy to Machine_2 (Production).

I would love to have both replicas to be synchronised (Machine_1 replica and Machine_2 replica).
My Machine_1 is my laptop where I develop an App, so it updates the MongoDB replica on that machine (1) as a local DB.
On Machine_2, there is a production App running, which will also update the local MongoDB replica on that machine (2)
I wish them to sync if connected in the same network or if seeing each other.

What would you suggest doing?
Run Kubernetes Cluster with two nodes (Machine_1, Machine_2), and in each node runs MongoDB replicas.
But then, how do they sync?

The IP of the machines can change; there is no DNS as of now.

Thanks, Jakub

Hi @Jakub_Polec and welcome to MongoDB community forums!!

As I understand from your requirements, you have two mongoDB deployments in your local and in a production environment and you wish to sync the two databases.

If yes, could you help me understand a few things regarding the deployments.

By replica, are you referring to a replica set ? or is the local database a copy of production database in terms of schema and architecture?

Could you help me understand why would you want the local database where development is ongoing to be synced with the production environment?

  1. What is the MongoDB version you are using ?

In addition, you could also explore the Cluster to Cluster Sync feature of MongoDB if the databases are deployed on Atlas with 6.0 version or above.

Regards
Aasawari