Ready to upgrade to fully managed hosting for MongoDB®? Easily migrate your MongoDB deployments to ScaleGrid and we'll take those time-consuming database management tasks off your plate so you can get back to working on your product.
Here are the things you'll need to set up live migration of your MongoDB deployment to ScaleGrid:
- ScaleGrid MongoDB replica set cluster - Create under our Dedicated or BYOC plans.
- Remote server name
- SSL config
- Remote server username and password
Here are the things you need to ensure before you set up live migration of your MongoDB replica set to ScaleGrid:
- If the source cluster must be a replica set, the destination (ScaleGrid) cluster must be a replica set.
- The destination cluster must be of size Medium or above.
- The destination cluster should be the same or greater version than the source cluster.
- The source cluster must have a minimum of 12 hours replication window.
- The network communication must be properly configured between source and destination clusters.
- Ensure that the destination server IP addresses are whitelisted on the source cluster. You can obtain the IP addresses of the destination cluster from the livesync wizard as well by clicking on Lookup ScaleGrid Server IP’s link.
- If the clusters are within VPC, ensure that security groups are properly configured to allow communication between destination and source cluster.
- The user on the source cluster must have the following minimal roles: backup, clusterMonitor, and read on local database.
In this tutorial, we're going to show you how to live migrate into an existing, newly created cluster at ScaleGrid. To learn how to import your MongoDB data during the cluster creation process, check out these docs based on your plan:
Before starting your live migration into your newly created MongoDB cluster at ScaleGrid, verify that there is no data in this cluster so that any existing data isn't overwritten. If you'd like to override your existing data in the import, first create a backup to ensure your existing data is preserved.
- Log into your ScaleGrid account, or start a free 30-day trial.
- Go to your MongoDB dashboard, and select the cluster you'd like to migrate to.
- Under the Overview tab, click Import Data -> Live sync:
- Stay on the Remote Server tab, and enter your server name and port.
- Next, enter the username and password for your remote server.
- Check the 'Yes' box if the remote server has SSL enabled.
- Review the information entered is correct, and click 'Start live sync'.
- We will perform the required validations to the remote server once you click start live sync, and upon successful validation, the live sync job will begin.
Your MongoDB live sync has now begun!
Your data will be in sync once the replication lag is 0, and the time will vary based on the size of your data.
The first step of the live migration process is the initial import. This step involves taking a full dump of the source data using mongodump and will be restored on destination cluster using mongorestore. Once the initial import is complete, ScaleGrid system will advance to the next step for performing live sync.
Once the initial import step is complete, the destination cluster is kept in sync with the source using oplog tailing. The replication lag is displayed in the UI. Once the destination cluster has caught up with the source and the replication lag is within the threshold, ScaleGrid system will advance the workflow to next step.
This is the final step of the live migration and your cluster is ready for switchover. At this point, you can get ready to complete the migration and point your application to the destination cluster.
Here are the steps to be followed
- Stop all writes to the source cluster. Wait for at least 30 seconds for all the writes to get replicated.
- Ensure the replication sync lag is 0. This indicates that both clusters are in sync.
- Change the connection string to point to the ScaleGrid cluster. The credentials and connection string are available under the Overview tab in the cluster details page.
- Click the Complete live sync button to complete the live migration process.
After the migration is complete, make sure to also confirm the following:
- Data size and details match your imported cluster.
- Your MongoDB cluster is connected to your application.
- Your backup schedule is configured.
Updated about 1 month ago