Yandex Cloud
  • Services
  • Solutions
  • Why Yandex Cloud
  • Blog
  • Pricing
  • Documentation
  • Contact us
Get started
Language / Region
Yandex project
© 2023 Yandex.Cloud LLC
Yandex Data Transfer
  • Available transfers
  • Getting started
  • Step-by-step guide
  • Practical guidelines
    • All tutorials
    • Data migration
      • Migrating data between Yandex Managed Service for Apache Kafka® clusters
      • Migrating data to Yandex Managed Service for ClickHouse
      • Migrating data to Yandex Managed Service for Greenplum®
      • Migrating data to Yandex Managed Service for MongoDB
      • Migrating data to Yandex Managed Service for MySQL
      • Migrating data from Yandex Managed Service for MySQL to MySQL
      • Migrating data to Yandex Managed Service for PostgreSQL
    • Data delivery
    • Asynchronous replication of data
    • Saving data streams
  • Concepts
  • Troubleshooting
  • Access management
  • Pricing policy
  • API reference
  • Questions and answers
  1. Practical guidelines
  2. Data migration
  3. Migrating data to Yandex Managed Service for MongoDB

Migrating data to Yandex Managed Service for MongoDB

Written by
Yandex Cloud
  • Before you begin
  • Transferring data
  • See also

To migrate your database to Managed Service for MongoDB, you need to directly transfer the data, acquire a write lock for the old database, and switch over the load to the database cluster in Yandex Cloud.

Performing migration with Data Transfer lets you:

  • Migrate the database without interrupting user service.
  • Migrate from older MongoDB versions to newer versions.
  • Go without creating an intermediate VM or granting online access to your Managed Service for MongoDB target cluster.

For more information, see What tasks is Yandex Data Transfer used for?.

To use this migration method, allow connecting to the source cluster from the internet.

Before you begin

Create a Managed Service for MongoDB target cluster with the computing capacity and storage size appropriate for the environment where the migrated database is deployed.

The database name in the target cluster must be the same as the source database name.

Transferring data

  1. Prepare the source cluster.

  2. Prepare the target cluster.

  3. Create a source endpoint with the following parameters:

    • Database type: MongoDB.

    • Endpoint parameters → Connection settings: Custom installation.

      Specify the parameters for connecting to the source cluster.

  4. Create a target endpoint with the following parameters:

    • Database type: MongoDB.

    • Endpoint parameters → Connection settings: MDB cluster.

      Specify the ID of the target cluster.

  5. Create a transfer of the Snapshot and increment type that will use the created endpoints.

    To make large collections (over 1 GB) copy more quickly, enable sharding in the transfer settings: Runtime environment → Yandex Cloud → Sharded copying parameters → Number of instances. Specify a value of 2 or more. The collection will split into the specified number of parts that will be copied concurrently.

    For sharding to work, the data type in the _id field should be the same for all documents in a collection. If a transfer discovers a type mismatch, the collection will not be partitioned but transferred in a single thread instead. If required, 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 copying operation is sharded. However, when re-enabled, the transfer will not be able to partition a collection because the requirement on the _id field will not be met for some of the collection's documents.

  6. Activate the transfer.

  7. Wait for the transfer status to change to Replicating.

  8. Switch the source cluster to read-only mode and switch the load to the target cluster.

  9. On the transfer monitoring page, wait for the Maximum lag on delivery 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.

  10. Deactivate the transfer and wait for its status to change to Stopped.

    For more information about transfer statuses, see Transfer lifecycle.

  11. Delete the stopped transfer.

  12. Delete endpoints for the source and target.

See also

For other migration methods, see the Yandex Managed Service for MongoDB documentation.

Was the article helpful?

Language / Region
Yandex project
© 2023 Yandex.Cloud LLC
In this article:
  • Before you begin
  • Transferring data
  • See also