MongoDB Exports

The export tool moves the data from the current MongoDB database into another MongoDB database.

📘

Export to IBM Cloud

The export tool will only move data to an IBM Cloud Databases for MongoDB deployment. A complete walkthrough of the process to get set up on IBM Cloud and export your data is in the blog.

The Export Tab lives in the MongoDB Data Browser of your MongoDB deployment. Exports run at a database-level. If you have multiple databases you would like to move, you have to export each database individually. Click on the database that you want to export.

Exporting Your Data

Click New Export to set up an export of your data.

27142714

The New Export page.

The Source database is the current database on your deployment. The Destination database is specified by providing the Connection String in the specified format in the field.

🚧

Note - users and database names

You will need to recreate the users on the databases you export. User data is not carried over in the export.

The database_name does need to be specified, so if you want your database to have the same name after export, you need to fill it in here.

(Optional) If you want to keep your application running while you migrate, enable Tailing. Tailing will push changes to the source database to the new database after the import of existing data is finished. Once the Tailing has finished, you can then switch your application to connect to your new database.

Otherwise you can do your export in one operation, without Tailing enabled.

Click on Export Database to begin the export.

Tailing

Tailing takes changes to the source database and replicates them to the current database after the export of existing data is finished.

📘

Tailing and the Oplog

Tailing replicates changes by reading your deployment's Oplog. In order to enable tailing, you will need to provision Oplog access on your deployment. Instructions on how to do so are on the Oplog Access Setup page.

When, the export starts up and the status will say "Starting". While the export is running, you can keep your applications writing to your old deployment and the status is updated to "Running".

Then, when the export is complete and tailing starts, the status is updated to "Tailing". You can stop connections on your old deployment and switch your apps to use the new deployment when there is a convenient window for your applications.

Tailing will run until you stop it or for 3 days. Once you stop the tailing, or if it times out after the 3 days, the status will be "Cancelled".

Getting Set Up in IBM Cloud

Since the export only works to move data to a Databases for MongoDB deployment running on IBM Cloud, here's a quick overview to help get you started. First, go to https://cloud.ibm.com/registration and create a new account.

Once the account is setup and you can sign-in, you can create a new Databases for MongoDB deployment from its catalog page.

Name the deployment then choose a region and group, as well as the amount of disk space and memory for your new deployment. Then, click on Create.

🚧

MongoDB Versions

The default major version on IBM Cloud is MongoDB 4.x. You CAN use the export tool migrate and upgrade to version 4.x, but you should ensure that your application is compatible before doing so. Otherwise, you can provision version 3.x on IBM Cloud.

While the deployment is being provisioned, you will see your Resource List. This is a page that lists everything that you have provisioned in IBM Cloud. A Databases for MongoDB deployment will be under the Services heading.

Once the deployment is available, you will want to set its admin password. Then you can retrieve your new connection string. Copy the string and fill it in with the admin username and password and the database name for your database.

27182718

A new Databases for MongoDB deployment

Differences between Databases for MongoDB and Compose

  • Databases for MongoDB does NOT autoscale. You will have to monitor your resources and scale to your usage.
  • The Databases for MongoDB connection string uses a format with two endpoints and a replica set name. You should check that your application's driver can use this format, as some application drivers need the replica set name passed in separately.
  • Databases for MongoDB deployments use a self-signed certificate. You can configure your application driver or certificate store to use the certificate to verify the connection to the deployment.
  • The default database for a Databases for MongoDB deployment is ibmclouddb. If you did not change the database name in the connection string when you copied it into the export's Destination field, your data is in the ibmclouddb database.

How It Works

All Exports are hosted on AWS. This means that Compose provisions a custom service that reads from your source database and writes to your destination database. This service is stateless and will terminate when the migration is complete.

If tailing is enabled, then the migration service will persist a transaction log on disk. This log guarantees a reliable migration that will successfully resume in the event of an interruption. The transaction log lasts the duration of the migration and then is deleted.

If you have concerns about this please contact [email protected].