Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Self-Hosted Redis Cluster Migration with redis-shake (RDB)

Updated on 2024-12-16 GMT+08:00

redis-shake is an open-source tool for migrating data online or offline (by importing backup files) between Redis Clusters. Data can be migrated to DCS Redis Cluster instances seamlessly because DCS Redis Cluster inherits the native Redis Cluster design.

The following describes how to use Linux redis-shake to migrate self-hosted Redis Cluster to a DCS Redis Cluster instance offline.

NOTE:

If the source Redis and the target Redis cannot be connected, or the source Redis is deployed on other clouds, you can migrate data by importing backup files.

Notes and Constraints

To migrate to an instance with SSL enabled, disable the SSL setting first. For details, see Transmitting DCS Redis Data with Encryption Using SSL.

Prerequisites

  • A DCS Redis Cluster instance has been created. For details about how to create one, see Buying a DCS Redis Instance.

    The memory of the target Redis instance cannot be smaller than that of the source Redis.

  • An Elastic Cloud Server (ECS) has been created. For details about how to create an ECS, see Purchasing and Using an ECS. Select the same VPC, subnet, and security group as the DCS Redis Cluster instance.

Obtaining Information of the Source and Target Redis Nodes

  1. Connect to the source and target Redis instances, respectively. Connect to Redis by referring to redis-cli.
  2. In online migration of Redis Clusters, the migration must be performed node by node. Run the following command to query the IP addresses and ports of all nodes in both the source and target Redis Clusters.
    redis-cli -h {redis_address} -p {redis_port} -a {redis_password} cluster nodes

    {redis_address} indicates the Redis connection address, {redis_port} indicates the Redis port, and {redis_password} indicates the Redis connection password.

    In the command output similar to the following, obtain the IP addresses and ports of all masters.

Installing RedisShake

  1. Log in to the ECS.
  2. Run the following command on the ECS to download the redis-shake: This section uses v2.1.2 as an example. You can also download other redis-shake versions as required.
    wget https://github.com/tair-opensource/RedisShake/releases/download/release-v2.1.2-20220329/release-v2.1.2-20220329.tar.gz
  3. Decompress the redis-shake file.
    tar -xvf redis-shake-v2.1.2.tar.gz

NOTE:

If the source cluster is deployed in the data center intranet, install redis-shake on the intranet server. Export the source cluster backup file by referring to Exporting the Backup File. Upload the backup to the cloud server as instructed by the following steps

Exporting the Backup File

  1. Go to the redis-shake directory.
    cd redis-shake-v2.0.3
  2. Edit the redis-shake.conf file by providing the following information about all the masters of the source:
    vim redis-shake.conf
    The modification is as follows:
    source.type = cluster
    # If there is no password, skip the following parameter.
    source.password_raw = {source_redis_password}
    # IP addresses and port numbers of all masters of the source Redis Cluster, which are separated by semicolons (;).
    source.address = {master1_ip}:{master1_port};{master2_ip}:{master2_port}...{masterN_ip}:{masterN_port}

    Press Esc to exit the editing mode and enter :wq!. Press Enter to save the configuration and exit the editing interface.

  3. Run the following command to export the RDB file:
    ./redis-shake -type dump -conf redis-shake.conf

    If the following information is displayed in the execution log, the backup file is exported successfully:

    execute runner[*run.CmdDump] finished!

Importing the Backup File

  1. Import the RDB file (or files) to the cloud server. The cloud server must be connected to the target DCS instance.
  2. Edit the redis-shake.conf file by providing the following information about all the masters of the target:
    vim redis-shake.conf
    The modification is as follows:
    target.type = cluster
    # If there is no password, skip the following parameter.
    target.password_raw = {target_redis_password}
    # IP addresses and port numbers of all masters of the target instance, which are separated by semicolons (;).
    target.address = {master1_ip}:{master1_port};{master2_ip}:{master2_port}...{masterN_ip}:{masterN_port}
    # List the RDB files to be imported, separated by semicolons (;).
    rdb.input = {local_dump.0};{local_dump.1};{local_dump.2};{local_dump.3}

    Press Esc to exit the editing mode and enter :wq!. Press Enter to save the configuration and exit the editing interface.

  3. Run the following command to import the RDB file to the target instance:
    ./redis-shake -type restore -conf redis-shake.conf

    If the following information is displayed in the execution log, the backup file is imported successfully:

    Enabled http stats, set status (incr), and wait forever.

Verifying the Migration

  1. After the data synchronization, connect to the Redis Cluster DCS instance by referring to redis-cli.
  2. Run the info command to check whether the data has been successfully imported as required.

    If the data has not been fully imported, run the flushall or flushdb command to clear the cached data in the target instance, and migrate data again.

  3. After the verification is complete, delete the redis shake configuration file.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback