A method and apparatus for recovering copy data, and a medium
By dividing storage resources into data objects and using replicas with the same sequence number for synchronous recovery, the resource consumption problem when replica data is lost or corrupted in hyperconverged storage is solved, and efficient data recovery is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-21
- Publication Date
- 2026-03-24
AI Technical Summary
In hyperconverged storage, existing technologies require a new copy of the data to be created for recovery when the copy is lost or corrupted, which increases the workload of data recovery unnecessarily and consumes too much cluster resources.
By adopting an object management approach, storage resources are divided into data objects, and data is synchronized through other replicas with the same sequence number. Recovery is performed only on the data objects to be recovered, reducing the amount of data recovery.
When the disk is disconnected from the cluster, data recovery is performed only when necessary, reducing the workload of data recovery and improving recovery efficiency and resource utilization.
Smart Images

Figure CN115617576B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of distributed storage, in particular to a replica data recovery method and device and medium. BACKGROUND
[0002] With the development and popularization of cloud computing technology, more and more users will choose hyper-converged infrastructure. Hyper-converged storage adopts a software-defined manner, and software-defined storage (SDS) virtualizes storage resources in nodes and shares them among all nodes in a cluster, thereby creating a large storage pool, and the essence of its implementation is distributed storage. During user use, user business data loss often occurs due to some human or non-human failure factors such as power failure.
[0003] In order to enable the cluster to have good read-write performance while effectively protecting user business data, hyper-converged storage often adopts data multi-copy technology, that is, user data is copied into multiple data copies that are exactly the same. When a fault causes the replica data to be lost or damaged, the replica often needs to be recovered by reconstruction. Although the principle of the re-copying replica saving method is simple, it increases unnecessary data recovery workload.
[0004] Therefore, it is a technical problem that needs to be solved by those skilled in the art to recover the lost or damaged data while occupying as few cluster resources as possible. SUMMARY
[0005] The purpose of the present application is to provide a replica data recovery method, device and medium for recovering lost or damaged data while occupying as few cluster resources as possible.
[0006] To solve the above technical problems, the present application provides a replica data recovery method, comprising:
[0007] In the case where it is determined that the disk is disconnected from the cluster, it is judged whether the disk and the cluster are in a connection recovery state within a preset time;
[0008] If not, determine the data object to be recovered, the replica of the data object to be recovered, and the serial number of the data object to be recovered; wherein the data object is obtained by dividing the storage resource;
[0009] Obtain a target data object from a replica other than the replica of the data object to be recovered; wherein the serial number of the target data object is the same as the serial number of the data object to be recovered;
[0010] Synchronize the data object to be recovered according to the target data object.
[0011] Preferably, in the case that it is determined that the disk is disconnected from the cluster, the method further comprises:
[0012] updating configuration information of the disk in the cluster to obtain first configuration information;
[0013] Correspondingly, in the case that it is determined that the disk is in the connection recovery state with the cluster within the preset time, the method further comprises:
[0014] updating the first configuration information to obtain the second configuration information;
[0015] performing data consistency check on each of the replicas of the storage resource;
[0016] if the check result is that the data of each of the replicas is inconsistent, entering the step of determining the data object to be recovered, the replica of the data object to be recovered, and the sequence number of the data object to be recovered;
[0017] if the check result is that the data of each of the replicas is consistent, ending.
[0018] Preferably, before obtaining the target data object from the replica other than the replica of the data object to be recovered, the method further comprises:
[0019] in the case that the disk is in the connection state with the cluster, obtaining total data capacity of the cluster;
[0020] in the case that it is determined that the disk is disconnected from the cluster, obtaining current actual total capacity occupied by the cluster;
[0021] determining the number of data objects to be recovered according to the difference between the total data capacity and the current actual total capacity, and the preset size of the data object;
[0022] obtaining the number of data objects recorded in the first configuration information;
[0023] in the case that the number of data objects to be recovered is the same as the number of data objects recorded in the first configuration information, entering the step of obtaining the target data object from the replica other than the replica of the data object to be recovered.
[0024] Preferably, in the case that the number of data objects to be recovered is different from the number of data objects recorded in the first configuration information, the method further comprises:
[0025] Traverse the remaining data objects in the cluster and obtain the sequence number of the lost data object as the data object to be recovered;
[0026] Then proceed to the step of obtaining the target data object from a copy other than the copy of the data object to be restored.
[0027] Preferably, synchronizing the data object to be recovered based on the target data object includes:
[0028] The data objects to be restored are pre-completed;
[0029] Detect whether there is currently any write I / O in the target data object of the copy other than the copy of the data object to be recovered;
[0030] If not, then synchronize the data object to be restored according to the target data object;
[0031] If so, the write I / O is sent to the data object to be recovered in order to synchronize the data to be recovered.
[0032] Preferably, during the synchronization of the data object to be recovered, the method further includes:
[0033] If a write I / O is detected in a copy of the target data object other than the copy of the data object to be recovered, then synchronization of the data object to be recovered is stopped; if the write I / O is completed, synchronization of the data object to be recovered is performed.
[0034] Preferably, after synchronizing the data object to be recovered according to the target data object, the method further includes:
[0035] Perform the data consistency check on each of the replicas of the storage resource;
[0036] If the verification result shows that the data of each copy is consistent, then the data object to be recovered is marked as recovered.
[0037] To address the aforementioned technical problems, this application also provides a device for recovering copy data, comprising:
[0038] The determination module is used to determine whether the disk and the cluster are in a connection recovery state within a preset time when it is determined that the disk and the cluster are in a disconnected state; if not, the determination module is triggered.
[0039] The determining module is used to determine the data object to be recovered, a copy of the data object to be recovered, and the sequence number of the data object to be recovered; wherein, the data object is obtained by partitioning storage resources;
[0040] The acquisition module is configured to acquire a target data object from a copy other than the copy of the data object to be recovered; wherein the sequence number of the target data object is the same as the sequence number of the data object to be recovered;
[0041] The synchronization module is used to synchronize the data object to be recovered based on the target data object.
[0042] To address the aforementioned technical problems, this application also provides a device for recovering copy data, comprising:
[0043] Memory, used to store computer programs;
[0044] A processor is configured to implement the steps of the above-described method for restoring the copied data when executing the computer program.
[0045] To address the aforementioned technical problems, this application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the aforementioned method for restoring copied data.
[0046] The data recovery method provided in this application includes: when it is determined that the disk and cluster are disconnected, determining whether the disk and cluster are in a connection recovery state within a preset time; if not, determining the data object to be recovered, a copy of the data object to be recovered, and the sequence number of the data object to be recovered; wherein, the data object is obtained by partitioning storage resources; obtaining the target data object from the copies other than the copy of the data object to be recovered; wherein, the sequence number of the target data object is the same as the sequence number of the data object to be recovered; synchronizing the data object to be recovered based on the target data object. Compared with the previous method of copying and saving a new copy, the method of this application divides the storage resources into multiple data objects, and then recovers the data object to be recovered based on the data objects in other copies with the same sequence number as the data object. Since only the data object to be recovered is recovered, the amount of data to be recovered is greatly reduced; in addition, the method of this application only recovers the data object to be recovered when it is determined that the disk and cluster are disconnected and the disk and cluster are not in a connection recovery state within a preset time. If the preset disk and cluster are in a connection recovery state, there are no data objects to be recovered. That is, it is not necessary to obtain the data objects to be recovered, copies of the data objects to be recovered, and the sequence numbers of the data objects to be recovered, thereby greatly reducing the workload of data recovery and improving the efficiency of data recovery.
[0047] In addition, this application also provides a device for recovering copy data and a computer-readable storage medium, which have the same or corresponding technical features as the aforementioned method for recovering copy data, and have the same effect. Attached Figure Description
[0048] To more clearly illustrate the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0049] Figure 1 A flowchart illustrating a method for restoring copy data provided in this application embodiment;
[0050] Figure 2 This application provides a schematic diagram of a single copy data partitioning method.
[0051] Figure 3 A structural diagram of a data recovery apparatus provided in one embodiment of this application;
[0052] Figure 4 A structural diagram of a data recovery apparatus provided in another embodiment of this application;
[0053] Figure 5 This is an overall flowchart of a method for restoring copy data provided in an embodiment of this application. Detailed Implementation
[0054] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of this application.
[0055] The core of this application is to provide a method, apparatus, and medium for recovering duplicate data, which can recover lost or damaged data while consuming as few cluster resources as possible.
[0056] Hyperconverged storage (HFS) employs a software-defined approach, where SDS virtualizes storage resources within nodes and shares them across all nodes in the cluster, creating a large storage pool. Essentially, it's distributed storage. It utilizes data replication technology, copying user data into multiple identical replicas. When a failure causes data loss or corruption, reconstruction and recovery are often necessary. While simply copying a new replica is theoretically simple, it increases the workload of data recovery. Therefore, this application uses object management to divide storage resources into data objects, which is not only convenient to manage but also highly scalable. When user business data replicas are lost or corrupted, the lost data objects can be quickly identified through comparison and checking, minimizing cluster resource consumption, and the lost data objects can be recovered on healthy nodes. It should be noted that the data objects to be recovered in this application can be either lost or corrupted data objects.
[0057] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments. Figure 1 A flowchart of a method for restoring copy data provided in an embodiment of this application is shown below. Figure 1 As shown, the method includes:
[0058] S10: If it is determined that the disk and the cluster are disconnected, determine whether the disk and the cluster are in a connection recovery state within a preset time; if not, proceed to step S11.
[0059] S11: Determine the data object to be recovered, the copy of the data object to be recovered, and the sequence number of the data object to be recovered; where the data object is obtained by partitioning storage resources.
[0060] The cluster first saves data object information to the database. Upper-layer storage resources (LUNs) are divided into data objects based on a 4MB size. Through the Object Manager service, each LUN, its replica number, and the corresponding data object are assigned a sequence number during generation, ordered in ascending order of positive integers (1 -> positive infinity). The sequence number of the data object with the largest sequence number indicates the number of data objects corresponding to a single replica of each LUN. The LUN sequence number is unique across the entire cluster, and the data object sequence number is unique within a single replica of a single LUN. Simultaneously, each data object is calculated using its assigned sequence number, replica number, and LUN sequence number to generate a unique identity document (ID). This information, including the data object's ID, node and disk location, sequence number, and corresponding replica number, is stored in the database. The data object's ID is unique within the database. Figure 2 This is a schematic diagram illustrating a single copy data partitioning method provided in an embodiment of this application. For example... Figure 2 As shown, this single copy is divided into 4 data objects, and the data objects are numbered sequentially.
[0061] The Cluster Manager service monitors and checks the connection status of disks, nodes, and the cluster. If a disk is found to be disconnected from the cluster, it determines whether the connection is restored within a preset timeframe; the preset timeframe is not fixed. If the connection is restored within the preset timeframe (i.e., the disk comes online), the disk is considered an old disk, and data loss checking and data object recovery are unnecessary. If the connection is not restored within the preset timeframe, data object recovery is performed. During the recovery process, the data object to be recovered needs to be obtained, along with its sequence number. Furthermore, since data synchronization is performed based on data objects with the same sequence number from other replicas, the replica number of the data object to be recovered also needs to be obtained.
[0062] S12: Obtain the target data object from a copy other than the copy of the data object to be recovered; wherein the sequence number of the target data object is the same as the sequence number of the data object to be recovered.
[0063] S13: Synchronize the data objects to be restored based on the target data object.
[0064] In a storage system, if there are a total of 3 replicas, and the replica number of the data object to be restored is 1, and the sequence number of the data object to be restored in replica number 1 is 2, then the data to be restored can be synchronized based on the data object with the sequence number 2 in replica number 2 or replica number 3.
[0065] The data recovery method provided in this embodiment includes: when it is determined that the disk and the cluster are disconnected, determining whether the disk and the cluster are in a connection recovery state within a preset time; if not, determining the data object to be recovered, a copy of the data object to be recovered, and the sequence number of the data object to be recovered; wherein, the data object is obtained by partitioning storage resources; obtaining the target data object from the copies other than the copy of the data object to be recovered; wherein, the sequence number of the target data object is the same as the sequence number of the data object to be recovered; synchronizing the data object to be recovered according to the target data object. Compared with the previous method of copying and saving a new copy, the method in this embodiment divides the storage resources into multiple data objects, and then recovers the data object to be recovered according to the data objects in other copies with the same sequence number as the data object. Since only the data object to be recovered is recovered, the amount of data to be recovered is greatly reduced; in addition, the method in this embodiment only recovers the data object to be recovered when it is determined that the disk and the cluster are disconnected and the disk and the cluster are not in a connection recovery state within a preset time. If the preset disk and cluster are in a connection recovery state, there are no data objects to be recovered. That is, it is not necessary to obtain the data objects to be recovered, copies of the data objects to be recovered, and the sequence numbers of the data objects to be recovered, thereby greatly reducing the workload of data recovery and improving the efficiency of data recovery.
[0066] To quickly obtain information about the data to be recovered, and considering that in practice, even if the connection is restored within a preset time after determining that the disk and cluster are disconnected, data loss or corruption may still occur, a preferred implementation method, when it is determined that the disk and cluster are disconnected, further includes the following steps for recovering the replica data:
[0067] Update the disk configuration information in the cluster and obtain the initial configuration information;
[0068] Correspondingly, if it is determined that the disk and cluster are in a connection recovery state within a preset time, the method for recovering replica data also includes:
[0069] Update the first configuration information in order to obtain the second configuration information;
[0070] Perform data consistency checks on each replica of the storage resources;
[0071] If the verification result shows that the data of each copy is inconsistent, then proceed to the step of determining the data object to be recovered, the copy of the data object to be recovered, and the sequence number of the data object to be recovered;
[0072] If the verification result shows that the data of each copy is consistent, the process ends.
[0073] When the disk and cluster connection is determined to be disconnected, the cluster records the corresponding disk departure event, updates the cluster disk-related configuration information, and initiates a replica data loss check. If the data object loss check is in progress, and the disk connection is restored (disk online), the cluster records the disk online event, cancels the data loss check, updates the cluster disk-related configuration, and verifies the consistency of the replica data. If the verification result is inconsistent, there are data objects to be recovered, and the process returns to determine the data objects to be recovered, their replicas, and their sequence numbers, and then recovers the data objects to be recovered. If the verification result is consistent, there are no data objects to be recovered, and therefore no data object recovery is required.
[0074] In the method provided in this embodiment, information about the data object to be recovered can be obtained by recording disk events; and even when it is determined that the disk is disconnected from the cluster, although the connection is restored within a preset time, the data is still verified and recovered, so as to ensure the accuracy and integrity of the data as much as possible.
[0075] In the process of restoring the data object to be recovered, the first step is to identify the data object to be recovered, i.e., to perform data loss checks. To ensure that all data to be recovered is identified, a preferred implementation method includes, before retrieving the target data object from copies other than the copy of the data object to be recovered, the method for restoring the copy data further includes:
[0076] With the disk connected to the cluster, obtain the total data capacity of the cluster.
[0077] If it is determined that the disk is disconnected from the cluster, obtain the total capacity currently actually used by the cluster.
[0078] The number of data objects to be recovered is determined based on the difference between the total data capacity and the current actual total capacity occupied, and the preset size of the data objects.
[0079] Get the number of data objects recorded in the first configuration information;
[0080] If the number of data objects to be recovered is the same as the number of data objects recorded in the first configuration information, then proceed to the step of obtaining the target data object from the copies other than the copies of the data objects to be recovered.
[0081] Taking a preset data object size of 4M as an example, when the disk is offline, the ClusterManager service first obtains the total capacity currently actually occupied by the cluster, calculates the total number of lost data blocks A based on the difference between the original total data volume and 4M, queries the database for the number of data objects recorded on the offline disk B, compares whether the values of A and B are equal, and if they are equal, finds the data object with the corresponding sequence number in other replicas based on the sequence number of the lost data object in the database record, and performs the next step of data recovery.
[0082] The method provided in this embodiment, which compares the calculated number of data objects to be recovered with the number of recorded data objects and recovers the data objects when they are equal, can ensure that all data objects to be recovered can be recovered as much as possible.
[0083] In the above embodiments, the number of data objects to be recovered calculated is the same as the number of recorded data objects, i.e., A and B are the same. In practice, there may be cases where A and B are not equal. In order to determine the data objects to be recovered, a preferred embodiment is that, when the number of data objects to be recovered is different from the number of data objects recorded in the first configuration information, the method for recovering the copy data further includes:
[0084] Iterate through the remaining data objects in the cluster and obtain the sequence number of the lost data object as the data object to be recovered;
[0085] Then proceed to the step of retrieving the target data object from a copy other than the copy of the data object to be restored.
[0086] In the method provided in this embodiment, by traversing the sequence numbers of the remaining data objects in the cluster, the missing sequence number is found, and the corresponding data object is determined to be lost. This method can accurately and completely identify the data objects to be recovered.
[0087] When performing data recovery based on other replicas of the data object to be recovered, these other replicas may currently be experiencing write I / O. A preferred implementation involves synchronizing the data object to be recovered based on the target data object, including:
[0088] Pre-complete the data objects to be restored;
[0089] Check if there is currently any write I / O on the target data object of the replicas other than the one to be recovered;
[0090] If not, then synchronize the data objects to be restored based on the target data object;
[0091] If so, write IO is sent to the data object to be restored in order to synchronize the data to be restored.
[0092] After data loss checks are completed, blank data objects (without actual data) are pre-generated on the disks of healthy nodes in the cluster, using a pre-filling method. Once the data objects are generated, they are marked as pending (init) and data synchronization is performed. During synchronization, it is checked whether there is any write I / O on the corresponding replicas of the data objects (read I / O does not affect data synchronization).
[0093] If no write I / O is performed, the data is synchronized to the new data object;
[0094] If write I / O is performed, the write I / O is directly sent to the new data object, and the data is synchronized when the write I / O stops.
[0095] The method provided in this embodiment, which pre-completes data objects and performs subsequent data write IO checks, can reduce the amount of cluster resources consumed, improve data recovery performance, and enable rapid recovery of user business copy data.
[0096] Based on the above embodiments, in practice, during the data synchronization process, other replicas may experience write I / O. A preferred implementation method further includes, during the synchronization of the data object to be recovered, the method for restoring replica data:
[0097] If write I / O is detected on the target data object of a copy other than the one to be restored, synchronization of the data object to be restored is stopped; if the write I / O is completed, synchronization of the data object to be restored is performed.
[0098] In the process of synchronizing data, this embodiment prioritizes write I / O when other replicas are experiencing write I / O, thus ensuring the normal operation of the system as much as possible.
[0099] After the data to be restored is synchronized and restored, in order to verify the accuracy of the data, the preferred implementation method is that, after synchronizing the data object to be restored according to the target data object, the method for restoring the copy data further includes:
[0100] Perform data consistency checks on each replica of the storage resources;
[0101] If the verification results show that the data in each copy is consistent, then the data object to be restored is marked as restored.
[0102] The method provided in this embodiment for verifying the consistency of the copy data and marking new data objects as complete verifies the accuracy of the data, and allows users to intuitively understand the data recovery process based on the marked status.
[0103] In the above embodiments, the method for restoring copy data has been described in detail. This application also provides embodiments corresponding to the copy data restoration apparatus. It should be noted that this application describes the apparatus embodiments from two perspectives: one based on functional modules and the other based on hardware.
[0104] Figure 3 A structural diagram of a data recovery apparatus provided according to an embodiment of this application. This embodiment, based on functional modules, includes:
[0105] The determination module 10 is used to determine whether the disk and cluster are in a connection recovery state within a preset time when it is determined that the disk and cluster are in a disconnected state; if not, the determination module 11 is triggered.
[0106] The determination module 11 is used to determine the data object to be recovered, the copy of the data object to be recovered, and the sequence number of the data object to be recovered; wherein, the data object is obtained by partitioning storage resources.
[0107] The acquisition module 12 is used to acquire the target data object from copies other than the copy of the data object to be recovered; wherein the sequence number of the target data object is the same as the sequence number of the data object to be recovered;
[0108] Synchronization module 13 is used to synchronize the data objects to be restored based on the target data object.
[0109] Since the embodiments of the apparatus and the embodiments of the method correspond to each other, please refer to the description of the embodiments of the method for the embodiments of the apparatus, which will not be repeated here.
[0110] The data recovery device provided in this embodiment has the same technical features as the data recovery method mentioned above, and the effect is the same.
[0111] Figure 4 This is a structural diagram of a data recovery apparatus for another embodiment of this application. This embodiment is based on a hardware perspective, such as… Figure 4 As shown, the data recovery device includes:
[0112] Memory 20 is used to store computer programs;
[0113] The processor 21 is configured to implement the steps of the method for restoring copy data as described in the above embodiments when executing a computer program.
[0114] The data recovery device provided in this embodiment may include, but is not limited to, smartphones, tablets, laptops, or desktop computers.
[0115] The processor 21 may include one or more processing cores, such as a quad-core processor or an octa-core processor. The processor 21 may be implemented using at least one of the following hardware forms: Digital Signal Processor (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 21 may also include a main processor and a coprocessor. The main processor, also known as the Central Processing Unit (CPU), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the processor 21 may integrate a Graphics Processing Unit (GPU), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, the processor 21 may also include an Artificial Intelligence (AI) processor, which is used to handle computational operations related to machine learning.
[0116] The memory 20 may include one or more computer-readable storage media, which may be non-transitory. The memory 20 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In this embodiment, the memory 20 is used to store at least the following computer program 201, which, after being loaded and executed by the processor 21, is capable of implementing the relevant steps of the copy data recovery method disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 20 may also include an operating system 202 and data 203, and the storage method may be temporary or permanent storage. The operating system 202 may include Windows, Unix, Linux, etc. The data 203 may include, but is not limited to, the data involved in the aforementioned copy data recovery method.
[0117] In some embodiments, the data recovery device may further include a display screen 22, an input / output interface 23, a communication interface 24, a power supply 25, and a communication bus 26.
[0118] Those skilled in the art will understand that Figure 4 The structure shown does not constitute a limitation on the device for restoring copy data and may include more or fewer components than illustrated.
[0119] The data recovery apparatus provided in this application includes a memory and a processor. When the processor executes the program stored in the memory, it can implement the following method: data recovery method, with the same effect as above.
[0120] This application also provides an embodiment corresponding to a computer-readable storage medium. The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps described in the above method embodiments.
[0121] It is understood that if the methods in the above embodiments are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and executes all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0122] The computer-readable storage medium provided in this application includes the aforementioned method for recovering copy data, and has the same effect.
[0123] To enable those skilled in the art to better understand the present application, the following description is provided in conjunction with the appendix. Figure 5 The present application will be further described in detail with reference to specific embodiments. Figure 5 This is an overall flowchart of a method for restoring copy data provided in an embodiment of this application. Figure 5 As shown, the method includes:
[0124] S14: Disk event log;
[0125] S15: Data loss check;
[0126] S16: Data recovery processing.
[0127] In step S14, the cluster records the corresponding disk departure event, updates the cluster disk-related configuration information, and initiates a replica data loss check. If the data object loss check phase is in progress, and the disk connection is restored (disk online), the cluster records the disk online event, cancels the data loss check, updates the cluster disk-related configuration, and verifies the consistency of the replica data. If the data recovery phase is in progress, and the disk connection is restored (disk online), the cluster records the disk online event, treats it as a new disk, and data recovery proceeds normally, updating the cluster disk-related configuration.
[0128] The implementation methods for steps S15 and S16 have been described in detail above and will not be repeated here.
[0129] In the method provided in this embodiment, when a user data copy is lost or damaged, the cluster records the corresponding disk leave event, updates the cluster disk configuration information, and enters the data loss check phase. If the disk connection is restored normally at different stages, the cluster will record the disk come online event again, update the cluster disk configuration information, and make corresponding adjustments to subsequent processing, optimizing the process and reducing unnecessary workload. After obtaining the number and information of lost data objects based on the relevant information of the remaining data objects, the data loss check pre-generates new data objects (actually empty) on the disks of the intact nodes in the cluster. After the data object is generated, it is marked as pending. At this time, data synchronization is performed, and simultaneously, it is monitored and checked whether there is write IO (read IO does not affect synchronized data) on the data objects of other copies corresponding to the newly generated data object. The subsequent recovery processing steps for the data object are determined. When the data object is synchronized and passes the copy data consistency check, it is marked as completed. When all newly generated data objects are marked as completed, data recovery is complete. By pre-completing data objects and subsequent data write IO checks, the cluster resource consumption is reduced, the data recovery performance is improved, and the rapid recovery of user business copy data is achieved.
[0130] The foregoing has provided a detailed description of a method, apparatus, and medium for recovering copied data provided in this application. The various embodiments in the specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section. It should be noted that those skilled in the art can make several improvements and modifications to this application without departing from the principles of this application, and these improvements and modifications also fall within the protection scope of the claims of this application.
[0131] It should also be noted that, in this specification, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
Claims
1. A method for recovering copied data, characterized in that, include: If it is determined that the disk and the cluster are disconnected, determine whether the disk and the cluster are in a connection recovery state within a preset time. If not, then determine the data object to be recovered, a copy of the data object to be recovered, and the sequence number of the data object to be recovered; wherein, the data object is obtained by partitioning storage resources; Obtain the target data object from a copy other than the copy of the data object to be recovered; wherein the sequence number of the target data object is the same as the sequence number of the data object to be recovered; Synchronize the data object to be recovered based on the target data object; Before retrieving the target data object from a copy other than the copy of the data object to be recovered, the method further includes: With the disk connected to the cluster, obtain the total data capacity of the cluster; If it is determined that the disk is disconnected from the cluster, obtain the total capacity currently actually occupied by the cluster; The number of data objects to be recovered is determined based on the difference between the total data capacity and the current actual total capacity occupied, and the preset size of the data objects. Obtain the number of data objects recorded in the first configuration information; If the number of data objects to be recovered is the same as the number of data objects recorded in the first configuration information, then proceed to the step of obtaining the target data object from a copy other than the copy of the data object to be recovered; If the number of data objects to be recovered differs from the number of data objects recorded in the first configuration information, the method further includes: Traverse the remaining data objects in the cluster and obtain the sequence number of the lost data object as the data object to be recovered; Then proceed to the step of obtaining the target data object from a copy other than the copy of the data object to be restored.
2. The method for restoring copy data according to claim 1, characterized in that, If it is determined that the disk is disconnected from the cluster, the method further includes: Update the configuration information of the disks in the cluster and obtain the first configuration information; Correspondingly, if it is determined that the disk and the cluster are in a connection recovery state within the preset time period, the method further includes: Update the first configuration information in order to obtain the second configuration information; Perform data consistency verification on each replica of the storage resource; If the verification result shows that the data of each copy is inconsistent, then proceed to the step of determining the data object to be recovered, the copy of the data object to be recovered, and the sequence number of the data object to be recovered; If the verification result shows that the data of each copy is consistent, then the process ends.
3. The method for restoring copy data according to claim 1, characterized in that, The step of synchronizing the data object to be recovered based on the target data object includes: The data objects to be restored are pre-completed; Detect whether there is currently any write I / O in the target data object of the copy other than the copy of the data object to be recovered; If not, then synchronize the data object to be restored according to the target data object; If so, the write I / O is sent to the data object to be recovered in order to synchronize the data to be recovered.
4. The method for restoring copy data according to claim 3, characterized in that, During the synchronization of the data object to be recovered, the method further includes: If a write I / O is detected in a copy of the target data object other than the copy of the data object to be recovered, then synchronization of the data object to be recovered is stopped; if the write I / O is completed, synchronization of the data object to be recovered is performed.
5. The method for recovering copy data according to any one of claims 1 to 4, characterized in that, After synchronizing the data object to be recovered based on the target data object, the method further includes: Perform the data consistency check on each of the replicas of the storage resource; If the verification result shows that the data of each copy is consistent, then the data object to be recovered is marked as recovered.
6. A device for restoring copied data, characterized in that, include: The judgment module is used to determine whether the disk and the cluster are in a connection recovery state within a preset time when it is determined that the disk and the cluster are in a disconnected state. If not, then trigger the confirmation module; The determining module is used to determine the data object to be recovered, a copy of the data object to be recovered, and the sequence number of the data object to be recovered; wherein, the data object is obtained by partitioning storage resources; The acquisition module is configured to acquire a target data object from a copy other than the copy of the data object to be recovered; wherein the sequence number of the target data object is the same as the sequence number of the data object to be recovered; The synchronization module is used to synchronize the data object to be recovered based on the target data object; Before retrieving the target data object from a copy other than the copy of the data object to be recovered, the method further includes: With the disk connected to the cluster, obtain the total data capacity of the cluster; If it is determined that the disk is disconnected from the cluster, obtain the total capacity currently actually occupied by the cluster; The number of data objects to be recovered is determined based on the difference between the total data capacity and the current actual total capacity occupied, and the preset size of the data objects. Obtain the number of data objects recorded in the first configuration information; If the number of data objects to be recovered is the same as the number of data objects recorded in the first configuration information, then proceed to the step of obtaining the target data object from a copy other than the copy of the data object to be recovered; If the number of data objects to be recovered differs from the number of data objects recorded in the first configuration information, the method further includes: Traverse the remaining data objects in the cluster and obtain the sequence number of the lost data object as the data object to be recovered; Then proceed to the step of obtaining the target data object from a copy other than the copy of the data object to be restored.
7. A device for restoring copied data, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the method for restoring copy data as described in any one of claims 1 to 5 when executing the computer program.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the method for restoring copy data as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Data recovery method, device, and copy management server
CN108664353A
Method and device for recovering data in distributed block storage system
CN111581020A