Migrating a database can be quite a challenge, right?
At Galaxy, we truly understand how stressful technical tasks can be and are here to make things easier for you. That’s why we created this step-by-step tutorial to help you migrate your MongoDB database to Galaxy Hosting.
This guide is intended for databases up to 15GB and does not support sharded MongoDB clusters. This migration process involves downtime. If you need a zero-downtime solution or have a larger/more complex database, contact our support team.
Requirements
To complete this tutorial, you’ll need Docker installed, because it simplifies the process by running a pre-configured container, avoiding complex installations or dependencies.
Step 1: Install Docker
Download and install Docker from the official site: https://www.docker.com/products/docker-desktop/
Step 2: Prepare Your Database Details
You’ll need:
- Your source database connection string
- Your Galaxy database connection string
Example Galaxy connection string:
docker run --rm --name mongo-migration-tool -d \
-e SOURCE_URI="your_source_uri" \
-e TARGET_URI="your_target_uri" \
-e DB_NAME="example_db_name" \
meteor/galaxy-mongodb-migrate:202409101534
Step 3: Stop Your Application
To prevent inconsistent data, you must stop your app before beginning the migration.
Step 4: Run the Migration
Run the command below in your terminal (replace the placeholders):
docker run --rm --name mongo-migration-tool -d \
-e SOURCE_URI="your_source_uri" \
-e TARGET_URI="your_target_uri" \
-e DB_NAME="example_db_name" \
meteor/galaxy-mongodb-migrate:202409101534
This will:
- Dump your source database
- Restore it into your Galaxy-hosted destination
To verify the container is running:
docker ps | grep mongo-migration-tool
To check logs and monitor progress:
docker logs mongo-migration-tool
Once the migration is done, the container will stop and be removed automatically.
Step 5: Verify & Secure
Inspect the Data:
Use MongoDB Compass to confirm everything was migrated properly.Create New Users:
Strengthen security by creating dedicated DB users within Galaxy.
Limitations & Notes
Database Size:
For databases over 15GB, reach out to support for a more appropriate strategy.Sharded Clusters:
This method is not compatible with sharded MongoDB clusters.
Step 6: Reconnect Your Application
Update your app’s configuration to use your new Galaxy connection string, then restart your app.
Wrapping Up
Migrating your MongoDB database to Galaxy Hosting is a great way to take advantage of our reliable, scalable cloud platform.
Need help or migrating a more complex setup? Reach out via the support chat in your Galaxy account!
Don’t have a Galaxy account yet?
Now’s the perfect time! Start with our free plan and host Meteor, Node.js, and (soon) even more frameworks — no hassle.
Create your account and explore: https://www.meteor.com/hosting
Happy migrating!