Adiom | Documentation
HomeContactDownload
  • Adiom
  • Getting Started
    • Quickstart
      • From Cosmos DB to MongoDB
      • From Cosmos DB to /dev/null
      • From on-premise MongoDB to Cosmos DB
      • From DynamoDB to Cosmos DB NoSQL
    • What is supported
  • Data Migration
    • Step By Step
  • Basics
    • Features
    • How it works
      • Sync
      • Glossary
    • Limitations
    • FAQs
  • Implementation Details
    • Architecture
    • Verification
    • Resumability
Powered by GitBook
On this page
  • Step 1: Download dsync
  • Step 2: Prepare the source MongoDB instance
  • Step 3: Prepare the destination Cosmos DB instance
  • Step 3: Start dsync
  • Step 4: Check the data
  1. Getting Started
  2. Quickstart

From on-premise MongoDB to Cosmos DB

Follow these simple instructions to get dsync up and running and perform a migration from your on-premise MongoDB to an Azure Cosmos DB destination.

PreviousFrom Cosmos DB to /dev/nullNextFrom DynamoDB to Cosmos DB NoSQL

Last updated 6 months ago

Dsync is currently in beta and is undergoing active development and testing.

Step 1: Download dsync

Download the latest release from the GitHub Releases page. Note that on Mac devices you may need to configure a security exception to execute the binary by following these steps.

Alternatively, you can build dsync from the source code.

git clone https://github.com/adiom-data/dsync.git
cd dsync
go build

Step 2: Prepare the source MongoDB instance

If you already have the desired source MongoDB instance up and running, you can skip this step.

  1. Install MongoDB

  2. Start a local MongoDB instance

  3. Load sample data

# Start a new mongod instance on localhost:27017 with dbpath ~/temp/data_d

mkdir ~/temp
cd ~/temp
mkdir data_d
mongod --dbpath data_d --logpath mongod_d.log --fork --port 27017

# Load sample data
git clone https://github.com/mcampo2/mongodb-sample-databases
cd mongodb-sample-databases
mongorestore dump/sample_mflix

Step 3: Prepare the destination Cosmos DB instance

If you already have the desired source Cosmos DB instance up and running, you can skip this step.

Follow official Azure documentation to set up a Cosmos DB instance. For example, these are the instructions for setting up a Cosmos DB vCore for MongoDB instance using Azure Portal: https://learn.microsoft.com/en-us/azure/cosmos-db/mongodb/vcore/quickstart-portal

Make sure to note the Cosmos DB cluster MongoDB connection string: https://learn.microsoft.com/en-us/azure/cosmos-db/mongodb/vcore/quickstart-portal#get-cluster-credentials


Step 3: Start dsync

# Use the read-write connection string from the Azure Portal
export COSMOS_DEST=

# Feel free to use your own MongoDB connection string
export MDB_SRC='mongodb://localhost:27017' 

./dsync --progress --logfile dsync.log $MDB_SRC $COSMOS_DEST 

Now Dsync should be running! Feel free to interrupt the sync process (via Ctrl+C) it once the initial sync is done. The demo database has a few million records and the resources are shared - allow 5-10 minutes for the process to complete.


Step 4: Check the data

mongosh $COSMOS_DEST

Congratulations! You should be able to access the 'sample_mflix' database and see the collections in it that were migrated from the local MongoDB instance.