Migrate from mLab to MongoDB Atlas

Deployment Type:

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

1

MongoDB Atlas account

If you don’t have an Atlas account, create one now.

2

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

Free (Sandbox) and Shared Plan Migration

Due to limitations on mLab Sandbox and Shared plan database access, the only way to migrate data to Atlas is to pipe mongodump to mongorestore.

It is possible to upgrade an mLab Sandbox deployment to a Dedicated deployment, but database downtime is required. You can upgrade a Shared deployment to a Dedicated deployment with no downtime by using a rolling upgrade procedure, as described in the mLab documentation.

Dedicated Plan Migration

You can migrate data in an mLab Dedicated deployment to Atlas with no database downtime by using the Atlas Live Migration Service. The following procedure will help you prepare your data for migration.

Procedure

1

Create an Atlas deployment

If you don’t already have an Atlas deployment, create one now. You’ll need a cluster tier of M10 or larger to perform Live Migration.

2

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.

../../_images/mlab-network-access-mode.png

Note

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.

3

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 admin database.

To create an oplog user:

  1. Select Databases
  2. Under System Databases, select the admin database
  3. Select the Users tab
  4. Click the Add oplog user button and name the user oplog-reader
../../_images/add-oplog-user.png
4

Begin the Atlas Live Migration process

Navigate to your Atlas cluster. Click the ellipsis () button and select Migrate Data to this Cluster.

../../_images/atlas-deployment.png
5

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.

6

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:

  1. Select the Networking tab
  2. Click the Add IP address range rule(s) button
  3. Add all four of the IP address granges listed in the Atlas Migration Service dialog from step 5
  4. Optional: Add a Description for your IP range
  5. Click the blue Add button when you’re finished
../../_images/add-ip-ranges.png

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.

Note

Your IP address ranges may be different from those shown here.

7

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.

Important

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 ds012345-a0.mlab.com:12345 is ds012345-a0-external.mlab.com:12345.

8

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.

9

Specify if Live Migration should use SSL to connect to your mLab cluster

Dedicated mLab clusters deploy with the net.ssl.mode set to 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.

Note

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.

10

Validate your Live Migration form

Your Atlas Live Migration form should now look like this:

../../_images/live-migration-full.png

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.

11

Start migration

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.

../../_images/migration-complete.png
12

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.

Summary

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!

What’s Next