This content originally appeared on DEV Community and was authored by Sibelius Seraphini
I gave a talk on how Woovi migrated from the cloud to our servers, here are the slides: https://speakerdeck.com/sibelius/no-cloud-how-woovi-moved-from-aws-to-its-own-servers
In this article, we are going to cover three approaches to migrating a MongoDB cluster from one cloud to another. The concepts would also apply to other databases.
Mongodump and Mongorestore
The first approach we tried was to stop server activity to stop modifying the database, then do a mongodump followed by a mongorestore in our servers.
This works well if your database size is small, otherwise it will take a lot of time.
In our case, it was taking 4 hours.
Four hours of downtime is very risky.
We didn't go if this approach
Mongosync
Another approach was to use mongosync which enables you to sync two clusters.
This looks like a good approach but it is missing some data and indexes in the sync.
Because of these errors we also avoid this approach.
Adding new cluster nodes in the same replica set
The approach that did work well and that we used in production to migrate from the cloud was to add new nodes in the new cluster in the same existing replica set.
We created some scripts to validate that they had the same data count and same indexes.
After the sync was done, we stopped the cloud servers, let the data sync the remaining activity, and started the new servers in our hardware.
After that, we removed the cloud MongoDB nodes from the replicaset.
The downtime of this approach was 5 minutes in the dawn.
In Conclusion
Migrating services and data from one cloud to another cloud or its own servers can be very risky. At Woovi we tested a lot of approaches to make sure the migration would be a success.
I hope this article help you when you decide to migrate from the cloud to #nocloud.
Woovi is an innovative startup revolutionizing the payment landscape. With Woovi, shoppers can enjoy the freedom to pay however they prefer. Our cutting-edge platform provides instant payment solutions, empowering merchants to accept orders and enhance their customer experience seamlessly.
If you're interested in joining our team, we're hiring! Check out our job openings at Woovi Careers.
Photo by Amélie Mourichon on Unsplash
This content originally appeared on DEV Community and was authored by Sibelius Seraphini
Sibelius Seraphini | Sciencx (2024-06-25T13:37:51+00:00) MongoDB database cloud migration. Retrieved from https://www.scien.cx/2024/06/25/mongodb-database-cloud-migration/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.