Pre-Migration Setup
Steps:
Below is an example of what the migration wizard looks like when migrating from a mLab Sandbox database to an Atlas M0 cluster.
In order to use the migration tool that was custom-built for migrations from mLab to Atlas, you’ll need to create a connection between your mLab account and your new Atlas organization.
Steps:
Enter a value in the “Project Name” field (e.g., “Nightscout”) and then click on the green “Confirm Project and Continue” button. You will be able to change the name of the project later.
Step 2. Import database user(s)
Click on the green “Import Database Users and Continue” button.
Step 3. Configure an IP whitelist
Check the checkbox to allow all IP addresses and then click on the green “Allow All and Continue” button.
Note! |
You will receive an email from MongoDB Atlas with the subject of ‘You’ve added “Allow access from anywhere (0.0.0.0/0)” to your IP Whitelist’. This is expected. |
Step 4. Create the target Atlas cluster
Select “Create most equivalent new cluster” from the drop-down menu. This will expand the modal into a larger screen.
Scroll down and click the green “Confirm Target and Continue” button to create a free Atlas database (M0 tier). It will take about 7-9 minutes for the Atlas database to be created.
Warning! |
Unlike mLab, the Atlas M0 (free) tier does not include backups. If backups are important to you, you will need to manually take your own backups (email <a href="mailto:support@mlab.com">support@mlab.com</a> for help) or migrate to the Atlas M2 tier which is approximately $9 per month and includes a free daily backup. |
Step 5. Confirm the source and target
Review your info about the source and target to confirm that you’re migrating from and to the correct deployments. If everything looks good, click on the green “Confirm and Continue” button.
Note! |
Ensure that you see MO on here if you want to migrate to a free Atlas Cluster. |
Click on the green “Begin Test Run” button.
Note that:
Assuming you have reviewed the Migration Prerequisites, you can skip the instructions in this step and click on the green “Confirm and Continue” button.
Step 8. Ensure independence from the Heroku add-on’s config var
Nightscout users can skip this step completely because the Nightscout code already looks for the existence of a different config var, MONGO_CONNECTION, which we will be creating later. Click on “Confirm and Continue”.
Warning! |
This step is the real migration! Clicking “Begin Migration” will change the role of the database user(s) which exist on the source mLab deployment to be read-only. If an unexpected error occurs, and you want to abort the migration process and start using your source mLab deployment again, you will need to recreate the database user(s) on your source mLab deployment through milab’s management portal. Performing a test migration ahead of time will help avoid the need to do this. If you do rollback to mLab, note that any writes that are made to the target Atlas cluster will not exist on the source mLab deployment and will be deleted if you attempt another migration later. You should not start another migration; instead please email support@mlab.com with a link to your Atlas organization or project for help. |
At this point the import of data and indexes from your source mLab database to the target Atlas cluster is complete.
You can now restart your Nightscout application with the connection string for your Atlas cluster:
Step 11. Delete mLab deployment (instructions only)
To delete the source mLab deployment, you will need to delete the Heroku mLab add-on via Heroku’s interface. Once you have deleted the add-on, verify again that your Nightscout app is still working.
This most likely means that you have multiple mLab databases, and you migrated the wrong one. However, this error can occur for a number of other reasons - please see the last question on this page on how to get help.
This means that you did not update your Nightscout site to the latest version (Step 1 of the Migration Prerequisites).
If you did update to the latest Nightscout version, please double-check that you completed Step 12 (the last step) of these version update instructions. This step is important because it will ensure that you have deployed the updated Nightscout version to your Heroku Nightscout application.
Steps to confirm which Nightscout version your app is running:
~ $ npm ls | grep nightscout
… then press on the return/enter button on our keyboard. The response will include a string like:
nightscout@13.0.1 / app
In this example, the version of Nightscout deployed to your app is 13.0.1.
For more help, see the next question.
The mLab Support team is here to help! Please email support@mlab.com with: