Monday, February 10, 2025
HomeJavaScriptMigrate your MongoDB Database to Galaxy Internet hosting | by David Amaral...

Migrate your MongoDB Database to Galaxy Internet hosting | by David Amaral | Jan, 2025


Migrating a database could be fairly a problem, proper?

At Galaxy, we actually perceive how annoying technical duties could be and are right here to make issues simpler for you. Therefore, we created this follow-up article to facilitate your first MongoDB database migration to our Galaxy cloud. These steps are really useful for databases as much as 15GB in measurement and unsuitable for MongoDB clusters in sharded mode.

Please observe that this process can have downtime. If it’s worthwhile to migrate a bigger database or advanced construction with out downtime, please contact our specialists through our assist chat.

Get your setting prepared!

To finish this tutorial, we solely want Docker, because it runs the container for all migration steps put in.

Why Docker?

Docker simplifies migrations by working pre-configured containers, avoiding handbook installations and dependencies.

Set up Docker:

Obtain and set up Docker from docker.com. It’s fast and helps all main working techniques.

Be sure to have your connection strings out of your supply and vacation spot databases. This instance exhibits a connection string for Galaxy internet hosting:

mongodb://admin:passwordEncodedb@user_testcluster-01.mongodb.galaxy-cloud.io:30010,user_testcluster-02.mongodb.galaxy-cloud.io:30010,user_testcluster-03.mongodb.galaxy-cloud.io:30010/admin?replicaSet=test_replicaset

We don’t need inconsistent knowledge, proper?
So, at this step, we have to cease our software in order that it doesn’t write any knowledge to our database. After a whole cease, we are able to proceed with the migration.

When prepared, begin the migration course of by executing the next command:

docker run - rm –identify mongo-migration-tool -d 
-e SOURCE_URI=""
-e TARGET_URI=""
-e DB_NAME="example_db_name"
meteor/galaxy-mongodb-migrate:202409101534

This can begin a container that can dump the supply database and restore this dump within the vacation spot database.

You’ll be able to confirm if the container is working by executing the command:

# docker ps | grep mongo-migration-tool

Additionally, you possibly can confirm the backup progress by analyzing the logs of this container with the command:

# docker logs mongo-migration-tool

After it’s full, the container is stopped and eliminated. Now you can see all the information in your vacation spot database.

Examine the Information:

Use instruments like MongoDB Compass to verify profitable migration.

Create New Customers:

Improve safety by creating devoted database customers in Galaxy.

Limitations and Suggestions

Database Measurement: For databases over 15GB, different strategies could also be more practical.
Sharded Mode: This course of doesn’t assist sharded MongoDB configurations.

After a profitable migration, you possibly can change your app’s configuration and restart it to make use of the information in your database situated on our Galaxy MongoDB internet hosting.

Migrating your MongoDB database to Galaxy Internet hosting is a necessary step in leveraging the complete potential of our dependable and scalable cloud platform.

Keep in mind, this information is tailor-made for databases as much as 15GB and non-sharded configurations. In case your necessities fall exterior these parameters otherwise you desire a migration with no downtime, don’t hesitate to contact our assist workforce utilizing the chat button in your Galaxy account. We’re right here to help you each step of the best way. Additionally, you possibly can overview the official Galaxy documentation for extra info.

In case you haven’t created a Galaxy account but, now’s the proper time to take action and you’ll try it out with a free plan! It lets you effortlessly host a wide range of purposes, together with Node and Meteor, with much more choices coming quickly. Don’t miss out on this chance, create your account now!!

Completely satisfied migrating!

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments