Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
  • Blog
  • Pricing
  • Documentation
Yandex project
© 2025 Yandex.Cloud LLC
Tutorials
    • All tutorials
    • Deploying the Apache Kafka® web interface
    • Migrating a database from a third-party Apache Kafka® cluster to Managed Service for Apache Kafka®
    • Moving data between Managed Service for Apache Kafka® clusters using Data Transfer
    • Delivering data from Managed Service for MySQL® to Managed Service for Apache Kafka® using Data Transfer
    • Delivering data from Managed Service for MySQL® to Managed Service for Apache Kafka® using Debezium
    • Delivering data from Managed Service for PostgreSQL to Managed Service for Apache Kafka® using Data Transfer
    • Delivering data from Managed Service for PostgreSQL to Managed Service for Apache Kafka® using Debezium
    • Delivering data from Managed Service for YDB to Managed Service for Apache Kafka® using Data Transfer
    • Delivering data from Managed Service for Apache Kafka® to Managed Service for ClickHouse® using Data Transfer
    • Delivering data from Managed Service for Apache Kafka® to Managed Service for Greenplum® using Data Transfer
    • Delivering data from Managed Service for Apache Kafka® to Managed Service for MongoDB using Data Transfer
    • Delivering data from Managed Service for Apache Kafka® to Managed Service for MySQL® using Data Transfer
    • Delivering data from Managed Service for Apache Kafka® to Managed Service for OpenSearch using Data Transfer
    • Delivering data from Managed Service for Apache Kafka® to Managed Service for PostgreSQL using Data Transfer
    • Delivering data from Managed Service for Apache Kafka® to Managed Service for YDB using Data Transfer
    • Delivering data from Managed Service for Apache Kafka® to Data Streams using Data Transfer
    • Delivering data from Data Streams to Managed Service for YDB using Data Transfer
    • Delivering data from Data Streams to Managed Service for Apache Kafka® using Data Transfer
    • YDB change data capture and delivery to YDS
    • Configuring Kafka Connect to work with a Managed Service for Apache Kafka® cluster
    • Automating Query tasks with Managed Service for Apache Airflow™
    • Sending requests to the Yandex Cloud API via the Yandex Cloud Python SDK
    • Configuring an SMTP server to send e-mail notifications
    • Adding data to a ClickHouse® DB
    • Migrating data to Managed Service for ClickHouse® using Data Transfer
    • Delivering data from Managed Service for MySQL® to Managed Service for ClickHouse® using Data Transfer
    • Asynchronously replicating data from PostgreSQL to ClickHouse®
    • Exchanging data between Managed Service for ClickHouse® and Yandex Data Processing
    • Configuring Managed Service for ClickHouse® for Graphite
    • Fetching data from Managed Service for Apache Kafka® to Managed Service for ClickHouse®
    • Fetching data from Managed Service for Apache Kafka® to ksqlDB
    • Fetching data from RabbitMQ to Managed Service for ClickHouse®
    • Saving a Data Streams data stream in Managed Service for ClickHouse®
    • Asynchronous replication of data from Yandex Metrica to ClickHouse® using Data Transfer
    • Using hybrid storage in Managed Service for ClickHouse®
    • Sharding Managed Service for ClickHouse® tables
    • Data resharding in a Managed Service for ClickHouse® cluster
    • Loading data from Yandex Direct to a data mart enabled by Managed Service for ClickHouse® using Cloud Functions, Object Storage, and Data Transfer
    • Loading data from Object Storage to Managed Service for ClickHouse® using Data Transfer
    • Migrating data with change of storage from Managed Service for OpenSearch to Managed Service for ClickHouse® using Data Transfer
    • Loading data from Managed Service for YDB to Managed Service for ClickHouse® using Data Transfer
    • Migrating databases from Google BigQuery to Managed Service for ClickHouse®
    • Configuring Cloud DNS to access a Managed Service for ClickHouse® cluster from other cloud networks
    • Migrating a Yandex Data Processing HDFS cluster to a different availability zone
    • Importing data from Managed Service for MySQL® to Yandex Data Processing using Sqoop
    • Importing data from Managed Service for PostgreSQL to Yandex Data Processing using Sqoop
    • Mounting Object Storage buckets to the file system of Yandex Data Processing hosts
    • Working with Apache Kafka® topics using Yandex Data Processing
    • Automating operations with Yandex Data Processing using Managed Service for Apache Airflow™
    • Shared use of Yandex Data Processing tables through Metastore
    • Transferring metadata between Yandex Data Processing clusters using Metastore
    • Importing data from Object Storage, processing and exporting to Managed Service for ClickHouse®
    • Migrating to Managed Service for Elasticsearch using snapshots
    • Migrating collections from a third-party MongoDB cluster to Managed Service for MongoDB
    • Migrating data to Managed Service for MongoDB
    • Migrating Managed Service for MongoDB cluster from 4.4 to 6.0
    • Sharding MongoDB collections
    • MongoDB performance analysis and tuning
    • Migrating a database from a third-party MySQL® cluster to a Managed Service for MySQL® cluster
    • Managed Service for MySQL® performance analysis and tuning
    • Syncing data from a third-party MySQL® cluster to Managed Service for MySQL® using Data Transfer
    • Migrating a database from Managed Service for MySQL® to a third-party MySQL® cluster
    • Migrating a database from Managed Service for MySQL® to Object Storage using Data Transfer
    • Migrating data from Object Storage to Managed Service for MySQL® using Data Transfer
    • Delivering data from Managed Service for MySQL® to Managed Service for Apache Kafka® using Data Transfer
    • Delivering data from Managed Service for MySQL® to Managed Service for Apache Kafka® using Debezium
    • Migrating a database from Managed Service for MySQL® to Managed Service for YDB using Data Transfer
    • MySQL® change data capture and delivery to YDS
    • Migrating data from Managed Service for MySQL® to Managed Service for PostgreSQL using Data Transfer
    • Migrating data from AWS RDS for PostgreSQL to Managed Service for PostgreSQL using Data Transfer
    • Migrating data from Managed Service for MySQL® to Managed Service for Greenplum® using Data Transfer
    • Configuring an index policy in Managed Service for OpenSearch
    • Migrating data from Elasticsearch to Managed Service for OpenSearch
    • Migrating data from a third-party OpenSearch cluster to Managed Service for OpenSearch using Data Transfer
    • Loading data from Managed Service for OpenSearch to Object Storage using Data Transfer
    • Migrating data from Managed Service for OpenSearch to Managed Service for YDB using Data Transfer
    • Copying data from Managed Service for OpenSearch to Managed Service for Greenplum® using Yandex Data Transfer
    • Migrating data from Managed Service for PostgreSQL to Managed Service for OpenSearch using Data Transfer
    • Authenticating a Managed Service for OpenSearch cluster in OpenSearch Dashboards using Keycloak
    • Using the yandex-lemmer plugin in Managed Service for OpenSearch
    • Creating a PostgreSQL cluster for 1C:Enterprise
    • Searching for the Managed Service for PostgreSQL cluster performance issues
    • Managed Service for PostgreSQL performance analysis and tuning
    • Logical replication PostgreSQL
    • Migrating a database from a third-party PostgreSQL cluster to Managed Service for PostgreSQL
    • Migrating a database from Managed Service for PostgreSQL
    • Delivering data from Managed Service for PostgreSQL to Managed Service for Apache Kafka® using Data Transfer
    • Delivering data from Managed Service for PostgreSQL to Managed Service for Apache Kafka® using Debezium
    • Delivering data from Managed Service for PostgreSQL to Managed Service for YDB using Data Transfer
    • Migrating a database from Managed Service for PostgreSQL to Object Storage
    • Migrating data from Object Storage to Managed Service for PostgreSQL using Data Transfer
    • PostgreSQL change data capture and delivery to YDS
    • Migrating data from Managed Service for PostgreSQL to Managed Service for MySQL® using Data Transfer
    • Migrating data from Managed Service for PostgreSQL to Managed Service for OpenSearch using Data Transfer
    • Troubleshooting string sorting issues in PostgreSQL after upgrading glibc
    • Migrating a database from Greenplum® to ClickHouse®
    • Migrating a database from Greenplum® to PostgreSQL
    • Exporting Greenplum® data to a cold storage in Object Storage
    • Loading data from Object Storage to Managed Service for Greenplum® using Data Transfer
    • Copying data from Managed Service for OpenSearch to Managed Service for Greenplum® using Yandex Data Transfer
    • Creating an external table from a Object Storage bucket table using a configuration file
    • Migrating a database from a third-party Valkey™ cluster to Yandex Managed Service for Valkey™
    • Using a Yandex Managed Service for Valkey™ cluster as a PHP session storage
    • Loading data from Object Storage to Managed Service for YDB using Data Transfer
    • Loading data from Managed Service for YDB to Object Storage using Data Transfer
    • Processing Audit Trails events
    • Processing Cloud Logging logs
    • Processing CDC Debezium streams
    • Analyzing data with Jupyter
    • Processing files with usage details in Yandex Cloud Billing
    • Entering data into storage systems
    • Smart log processing
    • Transferring data within microservice architectures
    • Migrating data to Object Storage using Data Transfer
    • Migrating data from a third-party Greenplum® or PostgreSQL cluster to Managed Service for Greenplum® using Data Transfer
    • Migrating Managed Service for MongoDB clusters
    • Migrating MySQL® clusters
    • Migrating to a third-party MySQL® cluster
    • Migrating PostgreSQL clusters
    • Creating a schema registry to deliver data in Debezium CDC format from Apache Kafka®

In this article:

  • Required paid resources
  • Getting started
  • Prepare the infrastructure
  • Install additional software
  • Connect to the source cluster and create a logical dump
  • (Optional) Upload the dump to the intermediate virtual machine
  • Restore the dump on the target cluster
  • Make sure that the dump is restored completely
  • Delete the resources you created
  1. Building a data platform
  2. Migrating a database from a third-party Valkey™ cluster to Yandex Managed Service for Valkey™

Migrating a database from a third-party Valkey™ cluster to Yandex Managed Service for Valkey™

Written by
Yandex Cloud
Updated at May 5, 2025
  • Required paid resources
  • Getting started
    • Prepare the infrastructure
    • Install additional software
  • Connect to the source cluster and create a logical dump
  • (Optional) Upload the dump to the intermediate virtual machine
  • Restore the dump on the target cluster
  • Make sure that the dump is restored completely
  • Delete the resources you created

For data migration, Valkey™ uses a logical dump: this is a file with a sequence of commands to restore the state of databases in the cluster. There are several ways to create a dump. The following example will use redis-dump-go.

Note

A binary RDB dump cannot be used for migration, because Yandex Managed Service for Valkey™ does not permit accessing file systems on cluster hosts.

To migrate Valkey™ databases from the source cluster to the target cluster:

  1. Connect to the source cluster and create a logical dump.

  2. (Optional) Upload the dump to the intermediate virtual machine.

    You must transfer data to Yandex Compute Cloud using a virtual machine if:

    • Your Yandex Managed Service for Valkey™ cluster is not accessible from the internet.
    • Your hardware or connection to the cluster in Yandex Cloud is not very reliable.
  3. Restore the dump on the target cluster.

  4. Make sure the dump is fully restored.

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

Required paid resourcesRequired paid resources

The support cost includes:

  • Yandex Managed Service for Valkey™ target cluster fee: Using computing resources allocated to hosts, and its disk space (see Valkey™ pricing).
  • Fee for using public IP addresses if public access is enabled for cluster hosts (see Virtual Private Cloud pricing).
  • When creating a VM to download a dump: Fee for using the computing resources, storage, OS (for specific operating systems), and, optionally, public IP address (see Compute Cloud pricing).

Getting startedGetting started

Prepare the infrastructurePrepare the infrastructure

Manually
Terraform
  1. Create a Yandex Managed Service for Valkey™ cluster with any suitable configuration. To connect to a cluster from a user's local machine rather than a Yandex Cloud cloud network, enable TLS support and public host access when creating your cluster.

  2. (Optional) Create an intermediate Linux virtual machine in Yandex Compute Cloud on the same network as the Yandex Managed Service for Valkey™ cluster using the following configuration:

    • Under Boot disk image, select the Ubuntu 20.04 image.

    • Under Network settings:

      • Public IP address: Auto.
      • Internal IPv4 address: Auto.
      • Security groups: Select the same security group as for the Yandex Managed Service for Valkey™ cluster.
  3. If you use Virtual Private Cloud security groups, configure them.

  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. Download the configuration file for the appropriate cluster type to the same working directory:

    • redis-cluster-non-sharded.tf: For an unsharded cluster.
    • redis-cluster-sharded.tf: For a sharded cluster.

    Each file describes the following:

    • Network.
    • Subnet.
    • Default security group and rules required to connect to the cluster and the virtual machine.
    • Yandex Managed Service for Valkey™ cluster with public internet access.
    • (Optional) Virtual machine with public internet access.
  6. Specify the following in the configuration file:

    • Password to access the Yandex Managed Service for Valkey™ cluster.

    • (Optional) VM parameters:

      • Public virtual machine image ID, e.g., for Ubuntu 20.04 LTS.
      • Login and absolute path to the public SSH key for accessing the virtual machine. By default, the specified username is ignored in the Ubuntu 20.04 LTS image. A user with the ubuntu username is created instead. Use it to connect to the VM.
  7. Make sure the Terraform configuration files are correct using this command:

    terraform validate
    

    If there are any errors in the configuration files, Terraform will point them out.

  8. 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.

Install additional softwareInstall additional software

  1. (Optional) Install utilities on the local machine for downloading and uploading files over SSH, such as:

    • WinSCP
    • Putty SCP
  2. Make sure that GNU Screen is installed on the source cluster.

    It might take a long time to create and restore a dump. To keep these processes alive when your SSH session times out, start them using this utility. If your SSH connection breaks while creating or restoring the dump, reconnect and restore the session state using the command:

    screen -R
    

Connect to the source cluster and create a logical dumpConnect to the source cluster and create a logical dump

  1. Connect to the source cluster's master host via SSH.

  2. Download the archive with redis-dump-go from the project page. The examples below use version 0.5.1.

    wget https://github.com/yannh/redis-dump-go/releases/download/v0.5.1/redis-dump-go_0.5.1_linux_amd64.tar.gz
    
  3. Unpack the archive to the current directory:

    tar xf redis-dump-go_0.5.1_linux_amd64.tar.gz
    
  4. Get familiar with the utility launch parameters:

    ./redis-dump-go -h
    
  5. If connecting to the Valkey™ cluster requires a password, enter it in the REDISDUMPGO_AUTH environment variable:

    export REDISDUMPGO_AUTH="<Valkey™_password>"
    
  6. Start an interactive screen session:

    screen
    
  7. Launch the creation of a logical dump:

    ./redis-dump-go \
        -host <master_host_IP_address_or_FQDN_in_Valkey™_cluster> \
        -port <Valkey™_port> > <dump_file>
    

    Tip

    As the dump is created, the number of processed keys is shown on the screen. Remember or write down the last output value: you will need it to check whether the dump has been restored completely in the target cluster.

  8. When the dump has been created, download it to your computer.

  9. Complete the interactive screen session:

    exit
    

(Optional) Upload the dump to the intermediate virtual machine(Optional) Upload the dump to the intermediate virtual machine

  1. Connect to the intermediate VM via SSH.

  2. Upload the dump from your computer to an intermediate virtual machine however is convenient.

Restore the dump on the target clusterRestore the dump on the target cluster

  1. Connect to the cluster and run an interactive screen session:

    screen
    
  2. Start the dump recovery process:

    Connecting without TLS
    Connecting via TLS

    Before connecting, install the dependencies:

    sudo apt update && sudo apt install -y redis-tools
    

    Connecting via Sentinel

    host=$(redis-cli \
      -h <FQDN_of_any_Valkey™_host> \
      -p 26379 \
      sentinel \
      get-master-addr-by-name \
      no-shards-no-tls | head -n 1)
    redis-cli \
      -h ${host} \
      -p 6379 \
      -a <target_cluster_password> \
      --pipe < <dump_file>
    

    Connecting directly to the master host

    redis-cli \
      -h <master_host_FQDN> \
      -p 6379 \
      -a <target_cluster_password> \
      --pipe < <dump_file>
    

    When connecting to a non-sharded cluster, instead of the master host's FQDN, you can use special FQDNs.

    Connecting to a sharded cluster

    1. Create a script containing the dump-loading commands:

      load-dump.sh

      shards=('<FQDN_of_master_host_in_shard_1>' \
              ...
              '<FQDN_of_master_host_in_shard_N>')
      
      for shard in "${shards[@]}" ; do
        redis-cli -h "${shard}" \
                  -p 6379 \
                  -a "<target_cluster_password>" \
                  --pipe < <dump_file>
      done
      
    2. Run the script:

      bash ./load-dump.sh
      

      As you run the script, you will see messages about data insertion errors. This is normal behavior for the redis-cli command, because in a sharded cluster, each shard stores only a certain part of the data. To learn more, see Sharding in Yandex Managed Service for Valkey™.

    Before connecting, install the dependencies:

    Build the redis-tools utility with TLS support in one of two ways:

    • From a repository

      1. Connect a repository:

        sudo apt-add-repository ppa:redislabs/redis
        

        Packages in this repository have already been built with the BUILD_TLS=yes flag.

      2. Install the utility:

        sudo apt update && sudo apt install -y redis-tools
        
    • Manually

      Go to the directory you want to download the distribution to. Download the stable version of the utility, then build and install it:

      wget https://download.redis.io/redis-stable.tar.gz && \
      tar -xzvf redis-stable.tar.gz && \
      cd redis-stable && \
      make BUILD_TLS=yes && \
      sudo make install && \
      sudo cp ./src/redis-cli /usr/bin/
      

    Connecting via Sentinel

    host=$(redis-cli \
           -h <FQDN_of_any_Valkey™_host> \
           -p 26379 \
           sentinel \
           get-master-addr-by-name \
           no-shards-tls | head -n 1)
    redis-cli \
        -h ${host} \
        -p 6380 \
        -a <target_cluster_password> \
        --tls \
        --cacert ~/.redis/YandexInternalRootCA.crt \
        --pipe < <dump_file>
    

    Connecting directly to the master host

    redis-cli \
        -h c-<cluster_ID>.rw.mdb.yandexcloud.net \
        -p 6380 \
        -a <target_cluster_password> \
        --tls \
        --cacert ~/.redis/YandexInternalRootCA.crt \
        --pipe < <dump_file>
    

    When connecting to a non-sharded cluster, instead of the master host's FQDN, you can use special FQDNs.

    Connecting to a sharded cluster

    1. Create a script containing the dump-loading commands:

      load-dump.sh

      shards=('<FQDN_of_master_host_in_shard_1>' \
              ...
              '<FQDN_of_master_host_in_shard_N>')
      
      for shard in "${shards[@]}" ; do
        redis-cli -h "${shard}" \
                  -p 6380 \
                  -a "<target_cluster_password>" \
                  --tls \
                  --cacert ~/.redis/YandexInternalRootCA.crt \
                  --pipe < <dump_file>
      done
      
    2. Run the script:

      bash ./load-dump.sh
      

      As you run the script, you will see messages about data insertion errors. This is normal behavior for the redis-cli command, because in a sharded cluster, each shard stores only a certain part of the data. To learn more, see Sharding in Yandex Managed Service for Valkey™.

  3. Complete the interactive screen session:

    exit
    

Make sure that the dump is restored completelyMake sure that the dump is restored completely

  1. In the management console, go to the folder to restore the cluster in.
  2. From the list of services, select Yandex Managed Service for Valkey™.
  3. Click the cluster name and open the Monitoring tab.

Pay attention to the DB Keys chart showing the number of keys stored in the cluster. If the cluster is sharded, the chart will show the number of keys in each shard. In this case, the number of keys in the cluster is equal to the total number of keys in the shards.

The total number of keys in the cluster must be equal to the number of keys processed by redis-dump-go when creating the dump.

Delete the resources you createdDelete the resources you created

Delete the resources you no longer need to avoid paying for them:

Manually
Terraform
  • Delete the Yandex Managed Service for Valkey™ cluster.
  • If you created an intermediate virtual machine, delete it.
  • If you reserved public static IP addresses, release and delete them.
  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
Creating an external table from a Object Storage bucket table using a configuration file
Next
Using a Yandex Managed Service for Valkey™ cluster as a PHP session storage
Yandex project
© 2025 Yandex.Cloud LLC