Yandex Cloud
Search
Contact UsTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
  • Marketplace
    • Featured
    • Infrastructure & Network
    • Data Platform
    • AI for business
    • Security
    • DevOps tools
    • Serverless
    • Monitoring & Resources
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
    • Price calculator
    • Pricing plans
  • Customer Stories
  • Documentation
  • Blog
© 2026 Direct Cursus Technology L.L.C.
Yandex StoreDoc
  • Getting started
    • All tutorials
    • Sharding collections
    • Migrating data to Yandex StoreDoc
    • Migrating Yandex StoreDoc cluster from version 4.4 to 6.0
    • Migrating collections from a third-party Yandex StoreDoc cluster
    • Yandex StoreDoc performance analysis and tuning
    • Delivering data from Yandex Managed Service for Apache Kafka® using Yandex Data Transfer
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Public materials
  • Release notes

In this article:

  • Required paid resources
  • Getting started
  • Prepare the source cluster
  • Prepare the target cluster
  • Set up the transfers
  • Activate the transfers
  • Test the transfer
  • Delete the resources you created
  1. Tutorials
  2. Migrating Yandex StoreDoc cluster from version 4.4 to 6.0

Migrating a Yandex StoreDoc cluster from version 4.4 to 6.0 using Yandex Data Transfer

Written by
Yandex Cloud
Updated at April 13, 2026
  • Required paid resources
  • Getting started
  • Prepare the source cluster
  • Prepare the target cluster
  • Set up the transfers
  • Activate the transfers
  • Test the transfer
  • Delete the resources you created

You can migrate a sharded production database under load from a Yandex StoreDoc cluster version 4.4 to version 6.0.

To transfer data:

  1. Prepare the source cluster.
  2. Prepare the target cluster.
  3. Set up the transfers.
  4. Activate the transfers.
  5. Test the transfer.

If you no longer need the resources you created, delete them.

Required paid resourcesRequired 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).
  • Per transfer: Computing resources used and the number of data rows transferred (see Data Transfer pricing).

Getting startedGetting started

Create a Yandex StoreDoc target cluster running version 6.0, identical to the version 4.4 cluster.

Manually
Using Terraform
  1. Create a Yandex StoreDoc (Managed Service for MongoDB) target cluster identical to the source cluster with the following settings:

    • Cluster version: 6.0.
    • Database name: db1.
    • Username: user1.
    • Access to cluster hosts: Public.

    Note

    Public access to cluster hosts is required if you plan to connect to the cluster via the internet. This connection option is simpler and is recommended for the purposes of this guide. You can connect to non-public hosts as well but only from Yandex Cloud virtual machines located in the same cloud network as the cluster.

  2. If you are using security groups in a cluster, make sure they are configured correctly and allow connections to it.

  3. Grant the readWrite role on the database db1 to user1.

  4. Enable cluster sharding and add the required number of shards.

  1. If you do not have Terraform yet, install it.

  2. Get the authentication credentials. You can add them to environment variables or specify them later in the provider configuration file.

  3. Configure and initialize a provider. There is no need to create a provider configuration file manually, you can download it.

  4. Place the configuration file in a separate working directory and specify the parameter values. If you did not add the authentication credentials to environment variables, specify them in the configuration file.

  5. In your current working directory, create a .tf file with the following contents:

    resource "yandex_mdb_mongodb_cluster" "old" { }
    
  6. Save the Yandex StoreDoc cluster ID for version 4.4 to an environment variable:

    export MONGODB_CLUSTER_ID=<cluster_ID>
    

    You can get the cluster ID from the list of clusters in your folder.

  7. Import the Yandex StoreDoc cluster settings for version 4.4 into the Terraform configuration:

    terraform import yandex_mdb_mongodb_cluster.old ${MONGODB_CLUSTER_ID}
    
  8. Get the imported configuration:

    terraform show
    
  9. Copy it from your terminal and paste it into the .tf file.

  10. Create a new directory imported-cluster and move your configuration file there.

  11. Modify the configuration so that you can use it to create a new cluster:

    • Specify the new cluster name in the resource string and in the name argument.
    • Set version to 6.0.
    • Delete the created_at, health, id, sharded, and status arguments.
    • In the host sections, delete the health and name arguments.
    • If the maintenance_window section contains type = "ANYTIME", delete the hour argument.
    • Delete all user sections. Use yandex_mdb_mongodb_user resource to add database users.
    • Delete all database sections. You can add databases using a separate yandex_mdb_mongodb_database resource.
    • Optionally, you can customize the configuration further as needed.
  12. Add the database resource to the configuration file:

    resource "yandex_mdb_mongodb_database" "db1" {
      cluster_id = yandex_mdb_mongodb_cluster.<cluster_name>.id
      name       = "db1"
    }
    

    Where <cluster_name> is the name of your new cluster as specified in the yandex_mdb_mongodb_cluster resource.

  13. Add the resource for creating a user named user1 to the configuration file:

    resource "yandex_mdb_mongodb_user" "user1" {
      cluster_id = yandex_mdb_mongodb_cluster.<cluster_name>.id
      name       = "user1"
      password   = "<user_password>"
      permission {
        database_name = "db1"
        roles         = ["readWrite"]
      }
      depends_on = [
        yandex_mdb_mongodb_database.db1
      ]
    }
    

    Where <cluster_name> is the name of your new cluster as specified in the yandex_mdb_mongodb_cluster resource.

  14. Navigate to the imported-cluster directory and get the authentication credentials.

  15. In the same directory, configure and initialize the provider. Instead of manually creating the provider configuration file, you can download it.

  16. Move the configuration file to the imported-cluster directory and specify the arguments. If you have not added the authentication credentials to environment variables, specify them in the configuration file.

  17. Validate your Terraform configuration:

    terraform validate
    

    Terraform will display any configuration errors detected in your files.

  18. Create the required infrastructure:

    1. Run this command to view the planned changes:

      terraform plan
      

      If you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.

    2. If everything looks correct, apply the changes:

      1. Run this command:

        terraform apply
        
      2. Confirm updating the resources.

      3. Wait for the operation to complete.

    All the required resources will be created in the specified folder. You can check resource availability and their settings in the management console.

Timeouts

The Terraform provider sets the following timeouts for Yandex StoreDoc cluster operations:

  • Creating a cluster, including by restoring one from a backup: 30 minutes.
  • Editing a cluster: 60 minutes.

Operations exceeding the set timeout are interrupted.

How do I change these limits?

Add the timeouts block to the cluster description, for example:

resource "yandex_mdb_mongodb_cluster" "<cluster_name>" {
  ...
  timeouts {
    create = "1h30m" # An hour and a half
    update = "2h"    # Two hours
  }
}

Prepare the source clusterPrepare the source cluster

  1. Create a user with the readWrite role for the source database you want to replicate.

  2. Delete unused collections from the database.

  3. Disable the unique constraints of indexes in the collections. They will be automatically reenabled after data migration.

  4. Evaluate your database workload. If it exceeds 10,000 writes per second, schedule multiple transfers.

    1. Identify collections under high load.
    2. Distribute your collections across multiple transfers.
  5. Allocate oplog storage with a 15-20% margin over the cluster disk size. This will allow Data Transfer to read changes from the source cluster throughout the data copy process.

Prepare the target clusterPrepare the target cluster

If the source database has sharded collections, prepare the target database. Do not enable unique constraints for indexes.

Set up the transfersSet up the transfers

  1. Create source endpoints for each scheduled transfer and specify their settings:

    • Database type: MongoDB.

    • Connection type: Yandex StoreDoc cluster.

    • Yandex StoreDoc cluster: <Yandex_StoreDoc_source_cluster_name> from the drop-down list.

    • Authentication source: <source_cluster_database_name>.

    • User: <username>.

    • Password: <password>.

    • Included collections: For each endpoint, specify the list of included collections according to your transfer distribution plan.

    • Excluded collections: Specify Time Series collections if your database has any. Data Transfer does not support migration of such collections.

  2. Create target endpoints for each scheduled transfer and specify their settings:

    • Database type: MongoDB.

    • Connection type: Yandex StoreDoc cluster.

    • Yandex StoreDoc cluster: <Yandex_StoreDoc_target_cluster_name> from the drop-down list.

    • Authentication source: db1.

    • User: user1.

    • Password: <password>.

    • Database: db1.

    If your target database contains sharded collections, select either the Do not clean or TRUNCATE cleanup policy.

    Selecting the DROP policy will result in the service deleting all the data from the target database, including sharded collections, and replacing them with new unsharded ones when a transfer is activated.

  3. Create Snapshot and replication-type transfers configured to use the previously created endpoints.

    To speed up copying of large collections (over 1 GB), enable parallel copy in the transfer settings:

    • Number of workers: 5 or more
    • Number of threads: 8 or more

    The collection will be split into the specified number of parts that will be copied concurrently.

    For parallel copy to work properly, the data type of the _id field must be the same for all documents in the same collection. If a transfer detects a type mismatch, the collection will not be split but transferred in a single thread instead. If needed, remove documents with mismatched data types from the collection prior to transfer.

    Note

    If a document with a different data type is added to the collection after the transfer starts, the transfer will migrate it at the replication stage after parallel copying. However, when reactivated, the transfer will not be able to split the collection into parts because the _id field type requirement will not be met for some of the documents in the collection.

Activate the transfersActivate the transfers

  1. Activate the transfers.
  2. Wait for the transfer status to change to Replicating.
  3. Switch the source cluster to read-only mode.
  4. If you disabled unique constraints for indexes in the source database, enable them in the target database.
  5. Transfer the workload over to the target cluster.
  6. On the transfer monitoring page, wait for the Maximum data transfer delay metric to drop to zero for each transfer. This indicates that the target cluster now contains all changes made in the source cluster after the data copy completed.
  7. Deactivate the transfers and wait for their status to change to Stopped.

Test the transferTest the transfer

  1. Connect to the database db1 in the Yandex StoreDoc target cluster.

  2. Verify that the data collections have appeared in the db1 database:

    show collections
    db.<collection_name>.find()
    

Delete the resources you createdDelete the resources you created

To minimize resource consumption, delete the resources you no longer need:

  1. Delete the transfer.

  2. Delete the endpoints.

  3. Delete the Yandex StoreDoc cluster version 6.0 applying the same method used for its creation:

    Manually
    Using Terraform

    Delete the Yandex StoreDoc cluster.

    1. In the terminal window, go to the directory containing the infrastructure plan.

      Warning

      Make sure the directory has no Terraform manifests with the resources you want to keep. Terraform deletes all resources that were created using the manifests in the current directory.

    2. Delete resources:

      1. Run this command:

        terraform destroy
        
      2. Confirm deleting the resources and wait for the operation to complete.

      All the resources described in the Terraform manifests will be deleted.

Was the article helpful?

Previous
Migrating data to Yandex StoreDoc
Next
Migrating collections from a third-party Yandex StoreDoc cluster
© 2026 Direct Cursus Technology L.L.C.