Migrate from mLab to MongoDB Atlas¶
Author: MongoDB Documentation Team
mLab is now a part of MongoDB, Inc.
The procedure to migrate from mLab to MongoDB Atlas will be further streamlined in the future. If you are looking to migrate immediately, use the following procedure to migrate your data using the Atlas Live Migration Service.
The MongoDB Atlas Live Migration Service helps you migrate MongoDB databases to our fully managed cloud database, MongoDB Atlas, quickly and securely. It works by connecting to your existing MongoDB database and synchronizing it with a cluster running in Atlas all while your application continues to function normally. Once the data between the two clusters has been synchronized, you can simply update the database connection string in your application to cut over to your cluster in Atlas.
This guide will walk you through how to use the Atlas Live Migration Service to migrate data from mLab to MongoDB Atlas.
Time required: 20 minutes
What You’ll Need¶
mLab MongoDB deployment¶
The type of migration from mLab you’ll be able to perform depends on the the service level of your mLab deployment. Instructions for the various service levels can be found below.
Check Your Environment¶
Check your mLab Network Access Mode¶
Log in to your mLab account and navigate to your cluster console. Select the Networking tab. Your mLab deployment may be in one of three Network Access Modes: Public, Private (Dual Access) or Private. If your deployment is Private, no external access is allowed, so you will need to switch to one of the other two modes before proceeding with migration.
It will be helpful during the migration process to keep one browser window open on your mLab cluster console and one window open on your Atlas console.
Create an oplog user on your admin database¶
To perform the migration process, you need a database user with
permission to read the oplog on your
To create an oplog user:
- Select Databases
- Under System Databases, select the admin database
- Select the Users tab
- Click the Add oplog user button and name the user oplog-reader
Begin the Atlas Live Migration process¶
Navigate to your Atlas cluster. Click the ellipsis (…) button and select Migrate Data to this Cluster.
Review migration steps¶
Read through the overview of migration steps in the Live Migration dialog window, then click the green I’m ready to migrate button.
Add allowable IP address ranges to your mLab deployment¶
For this step you’ll need to have browser tabs open with both the Atlas Live Migration dialog (from step 4) and your mLab cluster console.
From your mLab cluster console:
- Select the Networking tab
- Click the Add IP address range rule(s) button
- Add all four of the IP address granges listed in the Atlas Migration Service dialog from step 5
- Optional: Add a Description for your IP range
- Click the blue Add button when you’re finished
You should now see all the Atlas IP ranges listed in the Inbound allow rules section. Click the Apply security changes button to finish the operation.
Your IP address ranges may be different from those shown here.
Add the hostname and port of your mLab cluster primary to the Atlas Live Migration dialog¶
Find the hostname and port number of your mLab cluster primary node in your mLab cluster console and add it to the Atlas Live Migration dialog.
If your mLab cluster is running in the Private (Dual Access) networking mode, you will need to use the public hostname of the primary. If you provide the public hostname of a secondary, Live Migration will not be able to automatically detect the primary and the migration will fail.
To get the primary’s public hostname, append
-external to the
string to the left of the first period in the primary’s hostname.
For example, the public hostname for
Enter the oplog user’s credentials in the Live Migration dialog¶
Enter the username and password for oplog-reader in the Atlas Live Migration dialog window.
Specify if Live Migration should use SSL to connect to your mLab cluster¶
Dedicated mLab clusters deploy with the
preferSSL by default. This allows the cluster to accept both
TLS/SSL and non-TLS/non-SSL connections.
If you wish to connect to your mLab cluster using TLS/SSL, toggle Is SSL enabled? to Yes.
You do not need to fill in the Upload CA File section that appears on the form after SSL is enabled when migrating from an mLab cluster.
Validate your Live Migration form¶
Your Atlas Live Migration form should now look like this:
Click the Validate button to check that all your form fields are valid and everything is ready to go. When your form is validated, click the Start Migration button.
When the migration process begins, the Live Migration dialog window closes and you are returned to the Atlas cluster overview page. A progress bar shows the progess of your migration.
Once the migration is complete, you can begin to update your client applications to use the new Atlas connection string.
Start your cutover¶
Your mLab cluster and your Atlas cluster are now in sync. Atlas will maintain this synchronized state for 72 hours. If you need more time, syncing can be extended for another 24 hours.
Click the green Start cutover button and follow the instructions listed in the dialog window.
You created an Atlas cluster, migrated data from your old mLab cluster, and updated your applications to use the new Atlas cluster. Congratulations and welcome to MongoDB Atlas!