Docs Menu
Docs Home
/ /

Restart Mongosync

To restart a migration, you must first stop the ongoing mongosync process. During the migration process, mongosync creates databases with your data ("user databases") and the mongosync_reserved_for_internal_use system database on the destination cluster. You must remove those databases before restarting mongosync.

Follow these steps to restart your mongosync migration.

1

Stop the ongoing mongosync process. You can do this by using Ctrl-C or by calling the /pause endpoint.

2

Connect to the destination cluster with mongosh. If the destination is a sharded cluster, connect to the mongos instance. If the destination is a replica set, connect to the primary mongod instance.

If you already have mongosh installed, run the following command to connect to your cluster:

mongosh "mongodb+srv://<my-connection-string>"

3

Use the mongosh setUserWriteBlockMode database command to disable write-blocking on your destination cluster:

db.adminCommand( {
setUserWriteBlockMode: 1,
global: false
} )
4

In mongosh, drop the mongosync_reserved_for_internal_use system database:

use mongosync_reserved_for_internal_use
db.dropDatabase()
5

Remove any user databases created on the destination cluster by mongosync during the previous migration.

  1. Use mongosh to list all databases on the destination cluster:

    show dbs
  2. Remove user databases. The admin, local, and config databases are system databases. Do not edit these system databases without instructions from MongoDB support.

    If the show databases command lists any user databases on the destination cluster, you must remove them.

    Repeat this step for each user database listed by show databases:

    use <user database name>
    db.dropDatabase()
  3. Run show databases again to ensure that all databases have been successfully dropped.

6

If you want to completely stop the migration, you can re-enable the balancer on the source and destination clusters by running the balancerStart command in mongosh on each cluster.

The preceding instructions used mongosh to connect to the destination cluster. To enable the balancer on your source cluster, use mongosh to connect to your source cluster and run the following command:

db.adminCommand(
{
balancerStart: 1
}
)
7
  1. Run mongosync to reconnect to the source and destination clusters.

  2. Use the /start API end point to start syncing.

Back

Migrate Persistent Query Settings

On this page