Redis Cluster Cloning and Replication Method, Device, Medium, and Equipment

By generating snapshot files in a cloud computing environment and creating target Redis cluster instances on the cloud platform using backup and recovery programs, the cumbersome operations and data integrity problems of Redis cluster cloning and replication in the existing technology are solved, and fast and complete cluster cloning and replication are achieved.

CN116166470BActive Publication Date: 2025-08-05SHANGHAI INSPUR CLOUD COMPUTING SERVICE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211099611.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-09
Publication Date
2025-08-05
Estimated Expiration
2042-09-09

AI Technical Summary

Technical Problem

In the context of cloud computing and big data, it is difficult for the existing technology to achieve rapid and complete cloning and replication of source Redis cluster data to target Redis clusters, especially in public cloud environments. Manual operations are cumbersome and data integrity cannot be guaranteed.

Method used

By judging the status of the source Redis cluster, generating snapshot files and uploading them to the distributed storage system, creating resource orchestration files, using backup and recovery programs to create target Redis cluster instances on the cloud platform, and restoring the snapshot files into source files through concurrent writes to achieve rapid cloning and replication.

Benefits of technology

The instance replication process is simplified, and the rapid cloning and replication of the same source Redis cluster to multiple target Redis clusters is realized, ensuring data integrity and consistency and avoiding the tedious steps of manual operation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116166470B_ABST
    Figure CN116166470B_ABST
Patent Text Reader

Abstract

The embodiments of this specification provide a Redis cluster cloning and replication method, apparatus, medium, and device. The method includes determining whether the cluster status of the source Redis cluster instance is normal; if the cluster status of the source Redis cluster instance is normal, sending a backup command to the backup recovery program so that the backup recovery program generates a snapshot file from the current full data in the source Redis cluster instance and uploads the snapshot file to the distributed storage system; creating a resource orchestration file; sending the resource orchestration file to the cloud platform so that the cloud platform creates at least one target Redis cluster instance of the version and specification according to the resource creation step, and calling the backup recovery program according to the instance cloning step so that the backup recovery program downloads the snapshot file from the distributed storage system, restores the snapshot file to the source file, and writes the source file to at least one target Redis cluster instance by concurrent writing. The embodiments of the present invention can realize the rapid cloning and replication of the Redis cluster.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] One or more embodiments of this specification relate to the field of cache database technology, and in particular to a Redis cluster cloning and replication method, apparatus, medium, and device. Background Art

[0002] In the context of cloud computing and big data, cache databases are increasingly used in public cloud environments, which creates a need to clone data from a source Redis cluster to one or more target Redis clusters. Summary of the Invention

[0003] To solve at least one of the above problems, the embodiments of this specification describe a Redis cluster cloning and replication method, apparatus, medium, and device.

[0004] According to a first aspect, a Redis cluster cloning and replication method is provided, comprising:

[0005] Determine whether the cluster status of the source Redis cluster instance is normal;

[0006] If the cluster status of the source Redis cluster instance is normal, a backup command is sent to the backup and recovery program, so that the backup and recovery program generates a snapshot file from the current full data in the source Redis cluster instance, and uploads the snapshot file to the distributed storage system;

[0007] Create a resource orchestration file; wherein the resource orchestration file includes the version and specifications corresponding to the source Redis cluster instance, resource creation steps, and instance cloning steps;

[0008] The resource orchestration file is sent to the cloud platform, so that the cloud platform creates at least one target Redis cluster instance of the version and the specification according to the resource creation step, and calls the backup and recovery program according to the instance cloning step, so that the backup and recovery program downloads the snapshot file from the distributed storage system, restores the snapshot file to the source file, and writes the source file to the at least one target Redis cluster instance through concurrent writing.

[0009] According to a second aspect, a Redis cluster cloning and replication device is provided, comprising:

[0010] The status judgment module is used to determine whether the cluster status of the source Redis cluster instance is normal;

[0011] A backup upload module is configured to, if the cluster status of the source Redis cluster instance is normal, send a backup command to a backup recovery program, so that the backup recovery program generates a snapshot file from the current full data in the source Redis cluster instance and uploads the snapshot file to a distributed storage system;

[0012] A file creation module is used to create a resource orchestration file; wherein the resource orchestration file includes the version and specifications corresponding to the source Redis cluster instance, resource creation steps, and instance cloning steps;

[0013] The download and recovery module is used to send the resource orchestration file to the cloud platform, so that the cloud platform creates at least one target Redis cluster instance of the version and the specification according to the resource creation step, and calls the backup and recovery program according to the instance cloning step, so that the backup and recovery program downloads the snapshot file from the distributed storage system, restores the snapshot file to the source file, and writes the source file to the at least one target Redis cluster instance through concurrent writing.

[0014] According to a third aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed in a computer, the computer is caused to execute the method provided in the first aspect.

[0015] According to a fourth aspect, a computing device is provided, comprising a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method provided in the first aspect is implemented.

[0016] The Redis cluster cloning and replication method, apparatus, medium, and equipment provided in the embodiments of this specification, when the cluster status of the source Redis cluster instance is normal, generates a snapshot file of the current full data in the source Redis cluster instance through the backup and recovery program, and uploads the snapshot file to the distributed storage system to achieve backup and upload. Create a resource orchestration file so that the cloud platform creates a target Redis cluster instance of the same version and specification according to the resource creation steps therein, calls the backup and recovery program according to the instance cloning steps, and then downloads the snapshot file from the distributed storage system through the backup and recovery program, restores the snapshot file to the source file, and writes the source file to the at least one target Redis cluster instance through concurrent writing. It can be seen that the method provided in the embodiments of the present invention is based on the fast cloning and replication of the cluster realized by the backup and recovery program and the resource orchestration file, which can realize the cloning and replication of the same source Redis cluster to multiple target Redis clusters without manual operation, that is, it overcomes the shortcomings of the tedious operation of manually creating instances and synchronizing data, while ensuring the integrity of the backup data, thereby simplifying the instance replication process. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the embodiments of this specification or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0018] Figure 1 This is a flowchart of a Redis cluster cloning and replication method in one embodiment of this specification. DETAILED DESCRIPTION

[0019] The solution provided in this specification is described below in conjunction with the accompanying drawings.

[0020] In a first aspect, an embodiment of the present invention provides a Redis cluster cloning and replication method.

[0021] The method is executed by a management system outside the source Redis cluster instance and the target Redis cluster instance in the public cloud environment. Figure 1 The method includes the following steps S110 to S140:

[0022] S110: Determine whether the cluster status of the source Redis cluster instance is normal;

[0023] The source Redis cluster instance, that is, the source Redis cluster is taken as an instance. In this way, when cloning, not only the data stored in the source Redis cluster itself can be copied, but also the corresponding instance resource information, such as memory size, number of clusters, disk size, CPU size, and other resource information.

[0024] In one embodiment, S110 may specifically include: determining whether each node in the source Redis cluster instance is in a connected state and in a normal working state; if each node is in a connected state and in a normal working state, the cluster state of the source Redis cluster instance is normal; otherwise, the cluster state of the source Redis cluster instance is abnormal.

[0025] For example, by looping through each node in the source Redis cluster instance, including the master and slave nodes, to determine whether each node is connected and whether each node is providing services normally, if all nodes are connected and all nodes are providing services normally, it can be determined that the source Redis cluster instance is in a normal state and the following steps can be continued. If the cluster state of the source Redis cluster instance is determined to be abnormal, the subsequent steps such as backup, upload, target Redis cluster instance creation, and restoration are terminated.

[0026] S120: If the cluster status of the source Redis cluster instance is normal, send a backup command to the backup and recovery program, so that the backup and recovery program generates a snapshot file from the current full data in the source Redis cluster instance, and uploads the snapshot file to the distributed storage system;

[0027] Specifically, if the cluster status of the source Redis cluster instance is normal, then a backup command is sent to the backup recovery program. After the backup recovery program receives the backup command, the backup recovery program sends a backup command to the source Redis cluster instance. The source Redis cluster instance that receives the backup command generates snapshot files corresponding to each current shard, that is, one snapshot file is generated for each shard. For example, the full data of the source Redis cluster instance is divided into three shards, and each shard has its own master node and slave node. The data stored on the master node and the slave node are the same, so the master node or the slave node can generate a snapshot file for its own shard data, and then send the snapshot file to the backup recovery program. After the backup recovery program receives the snapshot files corresponding to each shard, it uploads each snapshot file to the distributed storage system, thereby realizing the data backup of the source Redis cluster instance.

[0028] That is to say, the management system sends a backup command to the backup and recovery program, so that the backup and recovery program sends a backup command to the source Redis cluster instance; wherein, the source Redis cluster instance that receives the backup command generates a snapshot file corresponding to each current shard, and pushes the snapshot file corresponding to each shard to the backup and recovery program, so that the backup and recovery program uploads the snapshot file corresponding to each shard to the distributed storage system, thereby realizing data backup of the source Redis cluster instance.

[0029] Among them, the distributed storage system can adopt the Swift distributed storage system.

[0030] It is understandable that the backup and recovery program directly uploads the snapshot file after the data is backed up, thereby achieving the goal of not writing the backup data to the disk, saving local storage resources, and effectively reducing storage resource utilization.

[0031] In one embodiment, the backup and recovery program may control the generation of corresponding snapshot files from the full data in the slave node corresponding to each shard in the source Redis cluster instance.

[0032] That is to say, the snapshot file is generated by the slave node instead of the master node, which will not affect the normal operation of the master node and prevent the backup operation from affecting the normal services provided by the master node.

[0033] S130: Create a resource orchestration file; wherein the resource orchestration file includes the version and specifications corresponding to the source Redis cluster instance, resource creation steps, and instance cloning steps;

[0034] Specifically, after the source Redis cluster instance is successfully backed up, the management system can generate a cloning instruction that specifies the storage address of each snapshot file completed in this backup. It then obtains the database version and database specifications of the source Redis cluster instance and generates a resource orchestration file based on the version and specifications. The resource orchestration file includes the aforementioned specifications and versions, as well as resource creation steps and instance cloning steps. The resource creation step is the detailed steps for creating the target Redis cluster instance on the cloud platform, and the instance cloning step is the detailed steps for cloning the source files corresponding to the snapshot files to the target Redis cluster after the target Redis cluster instance is created.

[0035] S140: Send the resource orchestration file to the cloud platform, so that the cloud platform creates at least one target Redis cluster instance of the version and the specification according to the resource creation step, and calls the backup and recovery program according to the instance cloning step, so that the backup and recovery program downloads the snapshot file from the distributed storage system, restores the snapshot file to the source file, and writes the source file to the at least one target Redis cluster instance through concurrent writing.

[0036] In other words, once the resource orchestration file is sent to the cloud platform, the cloud platform will create a target Redis Cluster instance with the same version and specifications as the source Redis Cluster instance in the resource orchestration file. This means that the target Redis Cluster instance will have the same database version and specifications as the source Redis Cluster instance. For details on how to create a target Redis Cluster instance, refer to the resource creation steps in the resource orchestration file.

[0037] In one embodiment, during the process of the cloud platform creating at least one target Redis cluster instance of the version and specification according to the resource creation step, the cloud platform can detect whether each node in the target Redis cluster instance is successfully created and connected through a ping packet.

[0038] In other words, during the creation of the target Redis cluster instance, you can continuously ping the nodes to determine whether they have been created successfully and whether all nodes are connected. If all nodes are created successfully and connected, the target Redis cluster instance has been created successfully, and the cloud platform will then send a successful creation notification to the management system. If the creation fails, the cloud platform will also send a failure notification to the management system.

[0039] After the target Redis cluster instance is successfully created, the cloud platform continues to execute the resource orchestration file, specifically the instance cloning step. This step triggers or invokes the backup and recovery program, which downloads the snapshot file from the distributed storage system and restores it to the data in the source Redis cluster instance, effectively restoring the snapshot file to the source file. The source files are then written to the target Redis cluster instance using concurrent writes. Downloading the snapshot file actually pulls the snapshot file from the distributed storage system.

[0040] To achieve fast cloning and replication, you can download snapshot files while restoring already downloaded snapshot files, ensuring that snapshot data is not written to disk. The aforementioned concurrent write method is a batch write method. Specifically, multiple write commands can be generated, so that the backup and recovery program can simulate multiple Redis clients to perform Redis write operations, thereby writing the restored source files in batches to the target Redis cluster instance.

[0041] That is to say, during the process of downloading the snapshot file, the backup and recovery program can restore the downloaded snapshot file to the corresponding source file; generate multiple write commands, and write the restored source files in batches to the at least one target Redis cluster instance through the multiple write commands.

[0042] During the execution of the above operations, the backup and recovery program can also create a new thread to confirm the write operation to ensure that data is not lost, thereby ensuring the correctness and integrity of the snapshot file cloned to the target Redis cluster instance.

[0043] Of course, the backup and recovery program can also use a monitoring script to monitor the progress of snapshot file recovery in real time. If an error occurs during the recovery process, the monitoring script promptly notifies the management system of the error and performs a rollback. The management system is notified when the snapshot file is successfully restored. Using a monitoring script for real-time monitoring allows the program to execute asynchronously, preventing program timeouts caused by excessive waiting times and program exceptions caused by excessive waiting processes.

[0044] In one embodiment, the backup and recovery program controls the source file to be written into the master node of the at least one target Redis cluster instance.

[0045] In other words, you only need to write the recovered source file to the master node of the target Redis Cluster instance, and the master node will automatically share the written source file with the slave nodes. However, if you write the recovered source file directly to the slave node of the target Redis Cluster instance, the slave node will not automatically share the written source file with the master node. Therefore, writing the source file to the master node of the target Redis Cluster instance takes advantage of the master node's automatic sharing function, which can reduce subsequent steps.

[0046] Redis is currently the mainstream cache database. It's an open-source, in-memory data structure storage system that can be used as a database, cache, and message middleware. It's a cross-platform, non-relational, network-enabled, in-memory, distributed, and optionally persistent key-value store. Redis Cluster is a server sharding technology, officially available since version 3.0. It implements distributed storage for Redis, dividing the data in a Redis cluster instance into multiple shards, each of which is stored using a master node and slave nodes.

[0047] Among them, in the public cloud environment, the Openstack Swift distributed storage system provides storage services with large storage capacity, long storage time and high availability, which can solve the storage space problem of snapshot files and the problem of limited local disk space.

[0048] The backup and recovery program is implemented based on the improved Redis-shake. Redis-shake is Alibaba Cloud's open source Redis data transmission tool that supports parsing, recovery, backup, and synchronization of Redis data. It is easy to deploy, flexible, and efficient. The backup and recovery program supports Swift backup storage methods.

[0049] It can be seen that the embodiment of the present invention can perform a backup upload operation on the slave node of the source Redis cluster instance and perform a pull write operation on the master node of the target Redis cluster instance.

[0050] It is understandable that the Swift feature is utilized for distributed storage in the embodiment of the present invention, which enables efficient and fast data storage for large amounts of data for a long time, solves the shortcomings of slow disk access and small storage capacity, and achieves the effect of high-speed file transfer between networks.

[0051] It is understood that the embodiments of the present invention, targeting source Redis cluster instances deployed in a public cloud environment, implement rapid cluster cloning and replication based on backup and recovery procedures and resource orchestration files. This allows for cloning and replicating the same source Redis cluster to multiple target Redis clusters, making it easy to replicate instances in a public cloud environment. It can also be used to replicate the same instance data to different regions. The method provided by the embodiments of the present invention can be used to test instance setup and rapid data replication, overcoming the tedious manual creation of instances and data synchronization, as well as the inability to ensure the integrity of replicated data, thereby simplifying the instance replication process.

[0052] The backup and recovery program plays a crucial role in the aforementioned cloning process. First, it controls the source Redis cluster instance to generate a snapshot file and then uploads the snapshot file to the distributed storage system. This ensures that data is not lost during the entire process and that the backup data is fully backed up. During the subsequent file recovery process, the backup and recovery program downloads and restores the snapshot file, ensuring that the downloaded data does not end up on the data disk.

[0053] Among them, the resource orchestration file adopts the design concept of Infrastructure as Code (I.e., Infrastructure as Code) to realize the management of cloud platform resources using code. There is no need to manually create multiple resources. One-click deployment is performed using templates. The management system generates a resource orchestration file based on information such as the version and specifications of the source Redis cluster instance, and uses this resource orchestration file to deploy the target Redis cluster instance with the same version and specifications as the source Redis cluster instance.

[0054] It is understandable that during the cloning and replication process, the primary guarantee is the integrity of the backup data and the data integrity of the recovery process. Because a backup and recovery program is used, it simulates the Redis master-slave synchronization model. The master here refers to the primary instance, which refers to the source Redis cluster instance, and the slave refers to the target Redis cluster instance. The backup and recovery program sends a backup command to the primary instance. After receiving the command, the primary instance generates a snapshot file of the current data and pushes the snapshot file to the backup and recovery program. The backup and recovery program uploads the received snapshot file to the distributed storage system to complete the backup. During the recovery process, the backup and recovery program downloads and restores the snapshot file to obtain the source file, and concurrently writes the source file to the slave instance. When generating the snapshot file, the primary instance generates the corresponding snapshot file for the full data at the current point in time. This can prevent serious consequences such as incomplete data or data loss caused by obtaining historical snapshot files.

[0055] It is understandable that the backup and recovery program also opens a dedicated thread to check the results of the write command to ensure that the data of the write operation is not lost, and performs a full data check after the write is completed to reconfirm the integrity of the written data.

[0056] It is understandable that the method provided in the embodiment of the present invention can be executed on the premise that: the source Redis cluster instance deployed in the public cloud environment can operate normally, the environment where the source Redis cluster instance is located is interconnected with the distributed storage system, and the environment where the target Redis cluster instance is located is interconnected with the distributed storage system.

[0057] It is understandable that the embodiment of the present invention modifies and adds the Swift distributed storage system as a tool to quickly clone and copy the source Redis cluster instance based on the open source Redis-shake, that is, to use the backup and recovery program to perform fast cloning and copying.

[0058] It is understandable that, under the normal operating conditions of the source Redis cluster instance, the embodiment of the present invention uses a backup and recovery program to back up the current full data in the source Redis cluster, and forms independent snapshot files for each shard, which are uploaded to the Swift distributed storage system for storage. A target Redis cluster instance of the same specifications and version is established on the cloud platform, and then the snapshot files of the full data of the source Redis cluster instance are accessed and pulled from the Swift distributed storage system, and each independent snapshot file is restored to the source file, and the source file is written to the different shards of the target Redis cluster instance. This method performs a full backup on the slave node of the source Redis cluster instance without affecting the service of the source Redis cluster instance. Each shard is backed up and uploaded at the same time, and pulled and restored at the same time, realizing the requirement of fast cloning and copying clusters on the cloud.

[0059] Among them, the resource orchestration file is an instruction set used by the cloud platform to perform a series of related actions. It can enable the cloud platform to automatically create the target Redis cluster instance and trigger the backup and recovery program to pull the snapshot file in the distributed storage system for recovery operations.

[0060] In a second aspect, an embodiment of the present invention provides a Redis cluster cloning and replication device, comprising:

[0061] The status judgment module is used to determine whether the cluster status of the source Redis cluster instance is normal;

[0062] A backup upload module is configured to, if the cluster status of the source Redis cluster instance is normal, send a backup command to a backup recovery program, so that the backup recovery program generates a snapshot file from the current full data in the source Redis cluster instance and uploads the snapshot file to a distributed storage system;

[0063] A file creation module is used to create a resource orchestration file; wherein the resource orchestration file includes the version and specifications corresponding to the source Redis cluster instance, resource creation steps, and instance cloning steps;

[0064] The download and recovery module is used to send the resource orchestration file to the cloud platform, so that the cloud platform creates at least one target Redis cluster instance of the version and the specification according to the resource creation step, and calls the backup and recovery program according to the instance cloning step, so that the backup and recovery program downloads the snapshot file from the distributed storage system, restores the snapshot file to the source file, and writes the source file to the at least one target Redis cluster instance through concurrent writing.

[0065] In one embodiment, the step of "sending a backup command to a backup recovery program so that the backup recovery program generates a snapshot file for the current full data in the source Redis cluster instance and uploads the snapshot file to a distributed storage system" performed by the backup upload module includes: sending a backup command to the backup recovery program so that the backup recovery program sends a backup command to the source Redis cluster instance; wherein, the source Redis cluster instance that receives the backup command generates a snapshot file corresponding to each current shard, and pushes the snapshot file corresponding to each shard to the backup recovery program so that the backup recovery program uploads the snapshot file corresponding to each shard to the distributed storage system to realize data backup of the source Redis cluster instance.

[0066] In one embodiment, the backup and recovery program is specifically used to control the generation of corresponding snapshot files from the full data in the slave node corresponding to each shard in the source Redis cluster instance.

[0067] In one embodiment, the backup and recovery program is specifically used to control the writing of the source file into the master node of the at least one target Redis cluster instance.

[0068] In one embodiment, the status judgment module is specifically used to: judge whether each node in the source Redis cluster instance is in a connected state and in a normal working state; if each node is in a connected state and in a normal working state, the cluster state of the source Redis cluster instance is normal; otherwise, the cluster state of the source Redis cluster instance is abnormal.

[0069] In one embodiment, when the cloud platform creates at least one target Redis cluster instance of the version and specification according to the resource creation step, the cloud platform detects through a ping packet whether each node in the target Redis cluster instance is successfully created and connected.

[0070] In one embodiment, the backup and recovery program downloads the snapshot file from the distributed storage system, restores the snapshot file to the source file, and writes the source file to the at least one target Redis cluster instance through concurrent writing, specifically including: during the process of downloading the snapshot file, the backup and recovery program restores the downloaded snapshot file to the corresponding source file; generates multiple write commands, and writes the restored source files in batches to the at least one target Redis cluster instance through the multiple write commands.

[0071] In a third aspect, an embodiment of this specification provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed in a computer, the computer is caused to execute the method in any one of the embodiments in the specification.

[0072] In a fourth aspect, an embodiment of this specification provides a computing device, comprising a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, it implements the method in any one of the embodiments in the specification.

[0073] It should be understood that the structures illustrated in the embodiments of this specification do not constitute specific limitations on the devices of the embodiments of this specification. In other embodiments of the specification, the above-mentioned devices may include more or fewer components than shown in the figure, or combine or separate certain components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0074] The information interaction, execution process, etc. between the modules in the above-mentioned devices and systems are based on the same concept as the method embodiments of this specification. For specific contents, please refer to the description in the method embodiments of this specification and will not be repeated here.

[0075] The various embodiments in this specification are described in a progressive manner. Similar parts between the various embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences from other embodiments. In particular, the device embodiments are generally similar to the method embodiments, so the description is relatively simple. For relevant parts, refer to the description of the method embodiments.

[0076] Those skilled in the art will appreciate that in one or more of the above examples, the functions described in the present invention may be implemented using hardware, software, widgets, or any combination thereof. When implemented using software, these functions may be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium.

[0077] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent replacements, improvements, etc. made on the basis of the technical solution of the present invention should be included in the scope of protection of the present invention.

Claims

1. A Redis cluster cloning and replication method, characterized in that: include: Determine whether the cluster status of the source Redis cluster instance is normal; If the cluster status of the source Redis cluster instance is normal, a backup command is sent to the backup and recovery program, so that the backup and recovery program generates a snapshot file from the current full data in the source Redis cluster instance, and uploads the snapshot file to the distributed storage system; Create a resource orchestration file; wherein the resource orchestration file includes the version and specifications corresponding to the source Redis cluster instance, resource creation steps, and instance cloning steps; The resource creation steps are the detailed steps for creating a target Redis cluster instance on the cloud platform. The instance cloning steps are the detailed steps for cloning the source files corresponding to the snapshot files to the target Redis cluster after the target Redis cluster instance is created. The resource orchestration file is sent to the cloud platform, so that the cloud platform creates at least one target Redis cluster instance of the version and the specification according to the resource creation step, and calls the backup and recovery program according to the instance cloning step, so that the backup and recovery program downloads the snapshot file from the distributed storage system, restores the snapshot file to the source file, and writes the source file to the at least one target Redis cluster instance through concurrent writing.

2. The method according to claim 1, characterized in that The sending of the backup command to the backup recovery program so that the backup recovery program generates a snapshot file from the current full data in the source Redis cluster instance and uploads the snapshot file to the distributed storage system includes: Send a backup command to the backup and recovery program, so that the backup and recovery program sends a backup command to the source Redis cluster instance; wherein, the source Redis cluster instance that receives the backup command generates a snapshot file corresponding to each current shard, and pushes the snapshot file corresponding to each shard to the backup and recovery program, so that the backup and recovery program uploads the snapshot file corresponding to each shard to the distributed storage system, thereby realizing data backup of the source Redis cluster instance.

3. The method according to claim 2, characterized in that The backup and recovery program controls the full amount of data in the slave node corresponding to each shard in the source Redis cluster instance to generate a corresponding snapshot file.

4. The method according to claim 1, wherein The backup and recovery program controls the source file to be written into the master node of the at least one target Redis cluster instance.

5. The method according to claim 1, wherein Determining whether the cluster status of the source Redis cluster instance is normal includes: Determine whether each node in the source Redis cluster instance is connected and in normal working condition; if each node is connected and in normal working condition, the cluster state of the source Redis cluster instance is normal; otherwise, the cluster state of the source Redis cluster instance is abnormal.

6. The method according to claim 1, characterized in that During the process of the cloud platform creating at least one target Redis cluster instance of the version and the specification according to the resource creation step, the cloud platform detects through a ping packet whether each node in the target Redis cluster instance is successfully created and connected.

7. The method according to claim 1, characterized in that The backup and recovery program downloads the snapshot file from the distributed storage system, restores the snapshot file to the source file, and writes the source file to the at least one target Redis cluster instance through concurrent writing, including: during the process of downloading the snapshot file, the backup and recovery program restores the downloaded snapshot file to the corresponding source file; generates multiple write commands, and writes the restored source files in batches to the at least one target Redis cluster instance through the multiple write commands.

8. A Redis cluster cloning and replication device, characterized in that: include: The status judgment module is used to determine whether the cluster status of the source Redis cluster instance is normal; A backup upload module is configured to, if the cluster status of the source Redis cluster instance is normal, send a backup command to a backup recovery program, so that the backup recovery program generates a snapshot file from the current full data in the source Redis cluster instance and uploads the snapshot file to a distributed storage system; A file creation module is used to create a resource orchestration file; wherein the resource orchestration file includes the version and specifications corresponding to the source Redis cluster instance, resource creation steps, and instance cloning steps; The resource creation steps are the detailed steps for creating a target Redis cluster instance on the cloud platform. The instance cloning steps are the detailed steps for cloning the source files corresponding to the snapshot files to the target Redis cluster after the target Redis cluster instance is created. The download and recovery module is used to send the resource orchestration file to the cloud platform, so that the cloud platform creates at least one target Redis cluster instance of the version and the specification according to the resource creation step, and calls the backup and recovery program according to the instance cloning step, so that the backup and recovery program downloads the snapshot file from the distributed storage system, restores the snapshot file to the source file, and writes the source file to the at least one target Redis cluster instance through concurrent writing.

9. A computer-readable storage medium, characterized in that A computer program is stored thereon, and when the computer program is executed in a computer, the computer is caused to execute the method according to any one of claims 1 to 7.

10. A computing device, characterized in that The method comprises a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Storage cluster data backup method and device, equipment and storage medium

    CN114996054A

  • Implementing Containers For A Stateful Application In A Distributed Computing System

    US20190213086A1