top of page

Migrating MongoDB Data to FerretDB with dsync

12 minutes ago

2 min read

0

1

0

This is a slightly modified version of the article on FerretDB's blog.

Adiom's dsync enables seamless database migrations from MongoDB to FerretDB

FerretDB is an open-source alternative and a drop-in replacement for MongoDB. FerretDB implements MongoDB's wire protocol as a proxy layer over PostgreSQL with DocumentDB extension as the backend. You can read more about it in the GitHub repo.


For users looking to migrate data from MongoDB to FerretDB, ensuring a smooth transition is crucial.


Traditional migration workflows often rely on static dumps and manual restoration steps, which can often lead to complications. Skipped collections. Metadata mismatches. Data loss. And worst of all – no clue where things went wrong.


dsync by Adiom is a tool that connects directly to both the source and destination of MongoDB-compatible services and streams data in real time. It seamlessly handles both the initial sync and live replication, continuously monitoring for any changes and updating the destination database accordingly. Using dsync, users can easily migrate their data from MongoDB to FerretDB - as easy as running a command in the terminal.


In this post, we'll review how to use dsync to migrate the data from MongoDB to a running FerretDB instance.


Prerequisites

​

Make sure to have the following ready before you start:


Download dsync

​

Download the latest release of dsync from the GitHub Releases page. For Mac users, 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

Run dsync to migrate into FerretDB

​

To migrate data from your local MongoDB instance to FerretDB, simply specify the source and destination connection strings.


For example:


Set the following environment variables for the source and destination connection strings and run dsync to migrate all data:

export MDB_SRC='mongodb://localhost:27018/'
export FERRETDB_DEST='mongodb://<username>:<password>@localhost:27017/'
./dsync --progress --logfile dsync.log "$MDB_SRC" "$FERRETDB_DEST"

Replace <username> and <password> with your FerretDB credentials. When running FerretDB without authentication enabled, they can be omitted.


When dsync is running, it opens a live-change monitoring session in the terminal to track the progress of the migration.

Dsync Progress Report : ChangeStream
Time Elapsed: 00:12:50        1/1 Namespaces synced
Processing change stream events

The session will remain open for as long as dsync is running. So even if new data is added to the source MongoDB instance, dsync will keep track of it and replicate it to FerretDB.


Lastly, confirm that the data has been migrated successfully by connecting to the FerretDB instance and checking the data, or running dsync with the verify option.


Have any questions about the migration process? Contact us – we're happy to help.

12 minutes ago

2 min read

0

1

0

Comments

Share Your ThoughtsBe the first to write a comment.
Adiom
Adiom is an official MongoDB partner for migrations from Azure Cosmos DB

Official partner

Discord-Symbol-Black_edited.png
GitHub
  • LinkedIn

info [at] adiom.io

San Francisco, CA, USA

bottom of page