Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions menu/navigation.json
Original file line number Diff line number Diff line change
Expand Up @@ -2429,6 +2429,10 @@
{
"label": "Back up and restore MongoDB® Databases",
"slug": "backup-and-restore"
},
{
"label": "Migrating data with mongosync",
"slug": "cluster-to-cluster-sync"
}
],
"label": "API/CLI",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ The migration processes described below are defined by the expected downtime. Yo
| Downtime tolerance | Recommended migration method | Benefits |
| --- | --- | --- |
| Can afford downtime | [Classic mongodump/mongorestore workflow](/managed-mongodb-databases/api-cli/backup-and-restore/) | Easy, straightforward |
| Cannot afford downtime | MongoDB® Cluster-to-Cluster sync tool (`mongosync` binary) | Zero downtime, real-time data sync, flexible migration windows, easy rollback. Refer to the official PostgreSQL documentation for a list of the tool's [limitations](https://www.mongodb.com/docs/cluster-to-cluster-sync/current/reference/limitations/#std-label-c2c-limitationsl) |
| Cannot afford downtime | [MongoDB® Cluster-to-Cluster sync tool](/managed-mongodb-databases/api-cli/cluster-to-cluster-sync) (`mongosync` binary) | Zero downtime, real-time data sync, flexible migration windows, easy rollback. Refer to the official PostgreSQL documentation for a list of the tool's [limitations](https://www.mongodb.com/docs/cluster-to-cluster-sync/current/reference/limitations/#std-label-c2c-limitationsl) |
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
meta:
title: Migrating data with mongosync
description: This page shows you how to migrate data using MongoDB®'s Cluster-to-Cluster tool
content:
h1: Migrating data with mongosync
paragraph: This page provides a guide on how to migrate data using MongoDB®'s Cluster-to-Cluster tool
tags: databases mongodb migration mongosync data-synchronization
categories:
- managed-databases
- mongodb
---

Scaleway Managed MongoDB® is compatible with the [MongoDB® Cluster-to-Cluster tool](https://www.mongodb.com/docs/cluster-to-cluster-sync/current/quickstart/#std-label-c2c-quickstart).

Cluster-to-Cluster sync helps you migrate data from one cluster to another without downtime through synchronization. Until the sync is finalized, the tool replicates and writes data from one cluster to another.


<Message type="important">
Refer to the official PostgreSQL documentation for a list of Cluster-to-Cluster sync's [limitations](https://www.mongodb.com/docs/cluster-to-cluster-sync/current/reference/limitations/#std-label-c2c-limitationsl)
</Message>

<Macro id="requirements" />

- A Scaleway account logged into the [console](https://console.scaleway.com)
- A [MongoDB® Database Instance](/managed-mongodb-databases/how-to/create-a-database-instance/)
- Installed a [MongoDB®-compatible client](https://www.mongodb.com/try/download/shell)
- Set up your [environment variables](/scaleway-cli/reference-content/environment-variables/#reserved-environment-variables) for the Scaleway API

1. Create a user in your MongoDB® Instance. Make sure you replace `<user-name>`, `<password>` and `{instance_id}` with the user name of the user, its password and the MongoDB® Instance UUID, respectively.

```
curl -X POST \
-H "X-Auth-Token: $SCW_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"<user-name>","password":"<password>"}' \
"https://api.scaleway.com/mongodb/v1/regions/fr-par/instances/{instance_id}/users"
```

2. [Apply the `sync` role to the user](/managed-mongodb-databases/how-to/manage-users/#how-to-apply-a-role-to-a-user). The `db_admin`role also allows you to sync.
3. [Download and install `mongosync` for your host system](https://www.mongodb.com/docs/cluster-to-cluster-sync/current/quickstart/#download-and-install-mongosync).

<Message type="tip">
If the database you want to sync is bigger than 100GB, we recommend you use a [Scaleway Instance](/instances/how-to/create-an-instance) to sync.
</Message>

3. [Connect the clusters](https://www.mongodb.com/docs/cluster-to-cluster-sync/current/quickstart/#connect-the-clusters).

4. [Migrate data between clusters](https://www.mongodb.com/docs/cluster-to-cluster-sync/current/quickstart/#migrate-data-between-clusters).

5. [Finalize the cut-over process](https://www.mongodb.com/docs/cluster-to-cluster-sync/current/quickstart/#finalize-cutover-process).