How To Achieve Mongo Replication on Docker
I noticed the lack of tutorials of setting up Mongo replication on Docker containers and wanted to fill this gap along with some tests to see how a Mongo cluster behaves on specific scenarios.
To improve our production database and solve the identified limitations, our most clear objectives at this point were:
Upgrading Mongo v3.4 and v3.6 instances to v4.2 (all community edition);
Evolving Mongo data backup strategy from mongodump/mongorestore on a mirror server to Mongo Replication (active working backup server);
Merging Mongo Docker containers into a single container and Mongo Docker volumes into a single volume.
1. Prepare Applications for Mongo Connection String Change. When our applications were developed, there was no need to pass the Mongo connection …
2. Generate and Deploy Keyfiles.
3. Deploy Existing Containers With the replSet Argument.
4. Define Ports.5. Assemble a Cluster Composed of 3 Servers in Different Data centers and Regions.
Sharing this story about our database migration will hopefully help the community — especially those not taking full benefits from MongoDB already — to start seeing MongoDB in a more mature and reliable way.Even though this is not a regular MongoDB replication “how-to” tutorial, this story shows important details about MongoDB’s internal features, our struggle to not leave any details behind, and, again, the benefits of such technology. That’s what I believe technology is for — helping humans with their needs.
We are(Jaiinfoway) a global software development company with thousands of completed projects, hundreds of happy customers and industry wide solutions.