Migrating MongoDB clusters
To migrate your MongoDB database to Yandex StoreDoc, you need to transfer the actual data, write-lock the old database, and transfer the load to the Yandex Cloud DB cluster.
Performing migration with Data Transfer allows you to:
- Migrate the database without interrupting user service.
- Migrate from older MongoDB versions to newer versions.
- Eliminate the need for an intermediate VM or public internet access to your Yandex StoreDoc target cluster.
For more information, see Problems addressed by Yandex Data Transfer.
To use this migration method, allow connecting to the source cluster from the internet.
Required paid resources
- Yandex StoreDoc cluster: Computing resources allocated to hosts, storage and backup size (see Yandex StoreDoc pricing).
- Public IP addresses if public access is enabled for cluster hosts (see Virtual Private Cloud pricing).
- Each transfer: Use of computing resources and number of transferred data rows (see Data Transfer pricing).
Getting started
Create a Yandex StoreDoc target cluster whose computing and storage capacity match those of the source database environment.
The source and target database names must be the same.
Transferring data
-
Create a source endpoint with the following parameters:
-
Database type:
MongoDB. -
Endpoint parameters → Connection settings:
Custom installation.Configure the source cluster connection settings.
Note
Transferring of
Time Seriescollections is not supported, so you should exclude such collections in the endpoint settings. -
-
Create a target endpoint with the following parameters:
-
Database type:
MongoDB. -
Endpoint parameters → Connection settings:
Yandex StoreDoc cluster.Specify the ID of the target cluster.
-
-
Create a Snapshot and increment-type transfer and configure it to use the previously created endpoints.
To make large collections (over 1 GB) copy more quickly, enable parallel copy in the transfer settings. Specify two or more workers. The collection will be split into the specified number of parts that will be copied concurrently.
For parallel copy to work, the
_idfield data type must be the same for all documents in the same collection. If a transfer discovers a type mismatch, the collection will not be partitioned but transferred in a single thread instead. If needed, remove documents with mismatched data types from the collection before starting a transfer.Note
If a document with a different data type is added to a collection after a transfer starts, the transfer will move it at the replication stage after the parallel copy operation is completed. However, when re-activated, the transfer will not be able to partition a collection because the
_idfield type requirement will not be met for some of the documents in the collection. -
Wait for the transfer status to change to Replicating.
-
Switch the source cluster to "read-only" mode and transfer the load to the target cluster.
-
On the transfer monitoring page, wait for the Maximum data transfer delay metric to decrease to zero. This means that all changes that occurred in the source cluster after data copying was completed are transferred to the target cluster.
-
Deactivate the transfer and wait for its status to change to Stopped.
For more information about transfer statuses, see Transfer lifecycle.
See also
For other migration methods, see the Yandex StoreDoc documentation.