Disaster recovery storage method, device and storage medium
By dividing the data center's storage resources into storage units and constructing virtual data stripes, and utilizing non-linearly correlated redundant data for computation, the problem of low data space utilization in disaster recovery storage systems is solved, achieving higher data storage reliability and space utilization.
Patent Information
- Application Number
- CN202611330383.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-28
- Publication Date
- 2026-11-27
AI Technical Summary
Existing disaster recovery storage systems require multiple identical data centers, resulting in low data space utilization and high redundancy. The effective data space utilization of a data center is only 1/N.
The storage resources of each data center are divided into multiple storage units to construct multiple virtual data stripes. Each virtual data stripe contains storage units from multiple data centers. Non-linearly correlated redundant data is generated through redundant data calculation, and the data blocks and redundant data are stored in the respective storage units of the virtual data stripe.
It improves the reliability and space utilization of data storage. Even if any M storage units fail, the original data can still be reconstructed from the remaining data blocks and redundant data. It is suitable for various scenarios and enhances the flexibility of the system.
Smart Images

Figure CN123178170A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data storage technology, and in particular to a disaster recovery storage method, device and storage medium. Background Technology
[0002] Disaster recovery storage systems are generally divided into primary data centers and backup data centers. Each data center serves as a disaster backup for the others. If any one data center fails, it will not affect the reading and storage of data.
[0003] Existing disaster recovery storage solutions require multiple completely identical data centers to achieve data consistency through clustering technology. If a disaster recovery storage system has N data centers and the actual storage capacity is C megabits (MB), then the redundancy of the current disaster recovery system is (N-1)*C, meaning only one data center has valid data, and the data space utilization rate is only 1 / N, resulting in low data space utilization of the disaster recovery storage system. Summary of the Invention
[0004] To address the aforementioned technical problems, this application provides at least one disaster recovery storage method, device, and storage medium.
[0005] The first aspect of this application provides a disaster recovery storage method, which divides the storage resources of each data center into multiple storage units and constructs multiple virtual data stripes. Each virtual data stripe contains storage units from multiple data centers. The method includes: obtaining the number of redundant data M; calculating the difference between the number of storage units in the virtual data stripe and M to obtain the number of data block partitions; partitioning the data to be written according to the number of data block partitions to obtain several data blocks; performing M redundant data calculations on the several data blocks to obtain M redundant data; wherein the redundant data is used to describe the numerical relationship between the several data blocks, and each redundant data is not linearly correlated; and storing the several data blocks and the M redundant data into the respective storage units of the virtual data stripe.
[0006] In one embodiment, a master bitmap and a data center bitmap corresponding to each data center are constructed. The master bitmap is used to store whether the storage unit in each virtual data stripe stores data, and the data center bitmap is used to store whether the storage unit in a single data center stores data. After storing several data blocks and M redundant data into the respective storage units of the virtual data stripe, the method further includes: updating the data storage status of each storage unit of the virtual data stripe in the master bitmap; and updating the data storage status of the storage unit in the data center bitmap in response to the successful storage of a data block by a storage unit in the data center.
[0007] In one embodiment, the method further includes: in response to data center failure recovery, comparing the data center bitmap with the overall bitmap to obtain a comparison result; if the comparison result reflects that there are storage units in the data center with missing data, then the storage units with missing data are designated as units to be recovered; and recovering the missing data of the units to be recovered.
[0008] In one embodiment, recovering missing data of the unit to be recovered includes: checking whether there is a missing data block corresponding to the unit to be recovered in the cache; if so, storing the missing data block in the unit to be recovered; or, determining other storage units belonging to the same virtual data stripe as the unit to be recovered, performing data recovery calculation on the data blocks stored in the other storage units based on the inverse operation corresponding to the redundancy operation algorithm, and storing the recovered data blocks in the unit to be recovered.
[0009] In one embodiment, the method further includes: receiving a data read request, determining the virtual data stripe where the data to be read corresponding to the data read request is located, and obtaining a target data stripe; reading data from the storage locations of the storage units associated with the target data stripe in each data center based on their storage locations in each data center, and obtaining several data read results; and generating feedback data for the data read request based on the several data read results.
[0010] In one embodiment, feedback data for a data read request is generated based on several data read results, including: if all data centers used to store data blocks are successfully read, the several data read results are combined to generate feedback data for the data read request; if a data center used to store data blocks fails to read, and the number of storage units that failed to read is less than or equal to M, data recovery calculation is performed on the several data read results based on the inverse operation corresponding to the redundancy calculation algorithm, and the recovered data block and the several data read results are combined to generate feedback data for the data read request.
[0011] In one embodiment, obtaining the number of redundant data M includes: obtaining the data size of the data to be written and the storage space size of each storage unit in the virtual data stripe; determining the number of storage units required to store the data to be written based on the data size and the storage space size, and obtaining the required number; calculating the difference between the total number of storage units in the virtual data stripe and the required number, and obtaining the number of redundant data M.
[0012] In one embodiment, storing a plurality of data blocks and M redundant data into various storage units of a virtual data stripe includes: obtaining the failure frequency of each data center associated with the virtual data stripe; selecting the M data centers with the highest failure frequencies, using the storage units corresponding to the selected data centers in the virtual data stripe as redundant storage units, and using the storage units corresponding to other data centers in the virtual data stripe as data storage units; storing the M redundant data into the redundant storage units respectively, and storing the plurality of data blocks into the data storage units respectively.
[0013] A second aspect of this application provides a disaster recovery storage device, comprising: a partition quantity determination module, used to obtain the number of redundant data M, calculate the difference between the number of storage units in the virtual data stripe and M, and obtain the number of data block partitions; a data partitioning module, used to partition the data to be written according to the number of data block partitions, to obtain several data blocks; a redundancy calculation module, used to perform M redundancy calculations on the several data blocks respectively, to obtain M redundant data; wherein, the redundant data is used to describe the numerical relationship between the several data blocks, and each redundant data is not linearly correlated; and a data storage module, used to store the several data blocks and the M redundant data into the respective storage units of the virtual data stripe.
[0014] A third aspect of this application provides an electronic device, including a memory and a processor, wherein the processor is configured to execute program instructions stored in the memory to implement the disaster recovery storage method described above.
[0015] The fourth aspect of this application provides a computer-readable storage medium having program instructions stored thereon, which, when executed by a processor, implement the disaster recovery storage method described above.
[0016] The above scheme obtains the number of redundant data M, calculates the difference between the number of storage units in the virtual data stripe and M, and obtains the number of data block divisions. The data to be written is divided according to the number of data block divisions to obtain several data blocks. M redundancy calculations are performed on each of the several data blocks to obtain M redundant data. The redundant data describes the numerical relationship between the several data blocks, and each redundant data is not linearly correlated. The several data blocks and the M redundant data are stored in the various storage units of the virtual data stripe. This allows the data blocks corresponding to the data to be written and the M redundant data to be distributed across different data centers. If any M storage units fail, the original data can be reconstructed using the remaining data blocks and redundant data, achieving higher reliability with less space. Furthermore, the construction method of the virtual data stripe and the value of M can be flexibly adjusted according to actual needs, making it suitable for various scenarios and enhancing system flexibility.
[0017] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this application. Attached Figure Description
[0018] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with this application and, together with the specification, serve to explain the technical solutions of this application.
[0019] Figure 1 This is a schematic diagram of a disaster recovery storage system shown in an example embodiment of this application; Figure 2 This is a flowchart illustrating a disaster recovery storage method in an exemplary embodiment of this application; Figure 3 This is a schematic diagram illustrating data storage in an exemplary embodiment of this application; Figure 4 This is a schematic diagram illustrating data recovery after a data center failure, as shown in an exemplary embodiment of this application. Figure 5 This is a flowchart illustrating data recovery after a data center failure, as shown in an exemplary embodiment of this application; Figure 6 This is a schematic diagram illustrating data reading in an exemplary embodiment of this application; Figure 7 This is a schematic diagram illustrating data reading in another exemplary embodiment of this application; Figure 8 This is a block diagram illustrating a disaster recovery storage device in an exemplary embodiment of this application; Figure 9 This is a schematic diagram of the structure of an electronic device shown in an exemplary embodiment of this application; Figure 10 This is a schematic diagram illustrating the structure of a computer-readable storage medium, as shown in an exemplary embodiment of this application. Detailed Implementation
[0020] The embodiments of this application will now be described in detail with reference to the accompanying drawings.
[0021] In the following description, specific details such as particular system architectures, interfaces, and technologies are presented for illustrative purposes rather than for limiting purposes, in order to provide a thorough understanding of this application.
[0022] In this document, the term "and / or" is merely a description of the association information of related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this document generally indicates that the preceding and following related objects have an "or" relationship. Furthermore, "many" in this document means two or more. Moreover, the term "at least one" in this document means any combination of at least two of any one or more of a plurality of elements. For example, including at least one of A, B, and C can mean including any one or more elements selected from the set consisting of A, B, and C.
[0023] The disaster recovery storage method provided in the embodiments of this application is described below.
[0024] The disaster recovery storage method provided in this application embodiment can be executed by any data center, other electronic devices that are connected to the data center, or by the data center and other electronic devices in interactive cooperation. That is, some steps of the method are executed by the data center and other steps are executed by other electronic devices.
[0025] For example, please refer to Figure 1 , Figure 1 This is a schematic diagram of a disaster recovery storage system shown in an example embodiment of this application, such as... Figure 1 As shown, a data storage management unit is provided. This data storage management unit acts as the execution entity to execute the disaster recovery storage method of this application. Data requests (such as data write requests and data read requests) arrive at the data storage management unit. The data storage management unit manages the data storage, data read and other services of the entire disaster recovery storage system and is responsible for feeding back the corresponding request response results to the requesting end.
[0026] This application divides the storage resources of each data center into multiple storage units and constructs multiple virtual data stripes, with each virtual data stripe containing storage units from multiple data centers.
[0027] For example, continue as follows Figure 1 As shown, the disaster recovery storage system has N data centers. The storage resources of each data center are divided into multiple storage units. Virtual data stripe T0 is allocated one storage unit of each data center, virtual data stripe T1 is also allocated one storage unit of each data center, and so on, creating multiple virtual data stripes so that the storage space of each data center is aligned according to the virtual data stripes.
[0028] Of course, in addition to the example above where each virtual data stripe contains the same number of storage units, each virtual data stripe can also contain a different number of storage units.
[0029] For example, because current disaster recovery storage systems need to store data of various sizes, different types of virtual data stripes are created for different data sizes, and the number of storage units contained in different types of virtual data stripes varies. For example, for data smaller than 10 kilobytes (KB), a first type of virtual data stripe is created, which contains 3 storage units, each of which is 5KB; for data larger than 10KB but smaller than 20KB, a second type of virtual data stripe is created, which contains 5 storage units, each of which is 5KB.
[0030] It should be noted that, for the different storage units of the aforementioned virtual data stripes, the different types of virtual data stripes have corresponding ranges of data sizes that can be adapted. When storing data, it is necessary to determine the matching virtual data stripe type based on the data size range of the data to be written, and then select the corresponding type of virtual data stripe for data storage.
[0031] Preferably, in order to achieve disaster recovery, a data center allocates only one storage unit for a virtual data stripe, so as to ensure that a failure of a single data center will only affect one storage unit in the virtual data stripe.
[0032] Furthermore, to facilitate subsequent storage, the storage space size of each storage unit within a single virtual data stripe should be the same, such as 4KB per storage unit. The specific size of the storage unit can be flexibly determined according to the actual application scenario, and this application does not impose any limitations on it.
[0033] Please see Figure 2 , Figure 2 This is a flowchart illustrating a disaster recovery storage method in an exemplary embodiment of this application, such as... Figure 2 As shown, the disaster recovery storage method includes at least steps S210 to S240, which are described in detail below: Step S210: Obtain the number of redundant data M, calculate the difference between the number of storage units in the virtual data stripe and M, and obtain the number of data block divisions.
[0034] The amount of redundant data M refers to the redundancy of data storage. It limits the number of storage units that can be allowed to fail for the corresponding virtual data stripe. As long as the number of failed storage units is less than or equal to M, it will not affect the storage and access of data.
[0035] M can be a pre-set empirical value, such as M being 1 or 2; M can also be a value flexibly calculated based on the influencing factors associated with the actual application scenario, such as the size of the data to be written, and / or the failure frequency of each data center, and / or the importance of the data to be written, etc. This application does not limit the way M is determined.
[0036] The difference between the number of storage units in the virtual data stripe and M is calculated to obtain the number of data block partitions.
[0037] It should be noted that if the number of storage units in each virtual data stripe is consistent, the difference between the consistent number of storage units and M is directly calculated to obtain the number of data block partitions, and any virtual data stripe that has not yet been used for data storage is selected to perform subsequent data storage. If the number of storage units in each virtual data stripe is inconsistent, it is necessary to first determine the virtual data stripe that matches the data to be written (see the aforementioned embodiment for the specific determination method), calculate the difference between the number of storage units corresponding to the matched virtual data stripe and M to obtain the number of data block partitions, and use the matched virtual data stripe to perform subsequent data storage.
[0038] Step S220: Divide the data to be written into several data blocks according to the number of data blocks to be divided.
[0039] The data to be written can be images, videos, audio, or text, etc. This application does not limit the data type of the data to be written.
[0040] The data to be written is divided into data blocks according to the number of data blocks required.
[0041] For example, if the number of data blocks is 3, then the data B to be written will be divided into 3 data blocks b1, b2, and b3.
[0042] To facilitate redundant data calculation, the data to be written is evenly divided according to the number of data blocks, with each data block being the same size.
[0043] Step S230: Perform M redundant data calculations on several data blocks respectively to obtain M redundant data; wherein, the redundant data is used to describe the numerical relationship between several data blocks, and each redundant data is not linearly correlated.
[0044] Redundant data is calculated to obtain redundant data corresponding to several data blocks. Since the redundant data is used to describe the numerical relationship between several data blocks, the lost data blocks can be obtained by reverse calculation using the redundant data when data blocks are subsequently lost.
[0045] Furthermore, since each redundant data point is not linearly correlated, the more redundant data there is, the more computational relation functions can be constructed, and thus the more data loss can be tolerated.
[0046] Specifically, redundant data calculations can be performed using finite field operations, such as using XOR operations, or using other linear combination functions such as addition, subtraction, multiplication, and division. This application does not limit the scope of the application to these methods.
[0047] If multiple redundant data need to be calculated, the calculation algorithm used for each redundant data calculation is different to ensure that multiple redundant data are obtained without linear correlation.
[0048] Step S240: Store several data blocks and M redundant data into the respective storage units of the virtual data stripe.
[0049] After calculating the redundant data, the divided data blocks and redundant data are stored in the respective storage units of the virtual data stripe.
[0050] For example, the write location of each storage unit in the virtual data stripe in the data center can be obtained so that data blocks and redundant data can be stored in the data center storage units respectively according to the write location.
[0051] For example, with Figure 1 Taking the virtual data stripe construction scenario as an example, the write location generally includes the disk name and offset position. The write location relationship of each storage unit in the virtual data stripe in the data center is shown in Table 1 below.
[0052]
[0053] Table 1 Data blocks and redundant data are stored in the data center's storage units according to the write location of each storage unit in the virtual data stripe.
[0054] To illustrate, M is set to 1. The currently used virtual data stripe T1 contains storage units of 4 data centers. The data to be written is divided into data blocks b1, b2, and b3. Redundant data bp is calculated by XOR operation = b1⊕b2⊕b3, where ⊕ represents the XOR operation.
[0055] Then, the calculated redundant data bp and the actual data to be written, b1, b2, and b3, are written to the respective storage cells of the virtual data stripe T1. For example, please refer to [link to relevant documentation]. Figure 3 , Figure 3 This is a schematic diagram illustrating data storage in an exemplary embodiment of this application, such as... Figure 3As shown, b1 is written to the storage unit of data center 1, b2 is written to the storage unit of data center 2, b3 is written to the storage unit of data center 4, and bp is written to the storage unit of data center 3.
[0056] For example, referring to the aforementioned embodiment, among the four data centers associated with the virtual data stripe T1, the storage units of three data centers are used to store the original data, and the storage unit of one data center is used to store redundant data, achieving an actual data space storage utilization rate of 75%. The data space utilization efficiency will be even higher as the number of data centers N increases.
[0057] This application first divides the storage resources of each data center into multiple storage units, and then combines the storage units of different data centers to obtain a virtual data stripe. The virtual data stripe is used as a storage management unit for a single piece of data to be written. The data block corresponding to the data to be written and M redundant data can be distributed in different data centers. Since the redundant data are not linearly correlated with each other, if any M storage units fail, the original data can be reconstructed from the remaining data blocks and redundant data. Higher reliability is achieved with less space. Moreover, the construction method of the virtual data stripe and the value of M can be flexibly adjusted according to actual needs, making it suitable for various scenarios and enhancing system flexibility.
[0058] The following describes some embodiments of this application in detail.
[0059] In some implementations, obtaining the number of redundant data M in step S210 includes the following steps S211 to S213.
[0060] Step S211: Obtain the data size of the data to be written and the storage space size of each storage unit in the virtual data stripe.
[0061] Step S212: Based on the data size and storage space size, determine the number of storage units required to store the data to be written, and obtain the required quantity.
[0062] For example, you can directly divide the data size by the storage space size and round up to get the number of storage units needed to store the data to be written.
[0063] For example, gradually increase the number of storage units and calculate the accumulated storage space value until the accumulated storage space value is greater than or equal to the size of the data to be written. Then the number of storage units participating in the accumulation is the required number.
[0064] Step S213: Calculate the difference between the total number of storage units in the virtual data stripe and the required number to obtain the amount of redundant data M.
[0065] The difference between the total number of storage units and the required number is calculated to obtain the M value used for subsequent redundant storage.
[0066] For example, a virtual data stripe contains storage units in four different data centers, each storage unit being 4KB. If the data to be written is 9KB, then three storage units are needed, resulting in an M value of 1. If the data to be written is 8KB, then two storage units are needed, resulting in an M value of 2.
[0067] Through the above embodiments, the number of storage units required to completely store the data to be written can be determined based on the actual size of the data to be written and the number of storage resources corresponding to the storage units in the virtual data stripe. This can maximize the value of M, improve system flexibility, and ensure data storage reliability and storage resource utilization.
[0068] Of course, in addition to determining the value of M based on the size of the data to be written, the value of M can also be determined based on the failure frequency of each data center and / or the importance of the data to be written.
[0069] For example, the higher the failure frequency of each data center associated with the virtual data stripe, the lower its storage reliability. Increasing the value of M can improve storage reliability, and conversely, decreasing the value of M can improve resource utilization. Alternatively, the higher the importance of the data to be written, the higher the value of M can improve storage reliability, and conversely, decreasing the value of M can improve resource utilization.
[0070] For example, multiple M values are calculated based on the size of the data to be written, and / or the failure frequency of each data center, and / or the importance of the data to be written. The multiple M values are then weighted and summed to obtain the final M value used. The size of the data to be written is inversely correlated with the M value, the failure frequency is positively correlated with the M value, and the importance of the data to be written is positively correlated with the M value.
[0071] In some implementations, step S240 involves storing several data blocks and M redundant data into the respective storage units of the virtual data stripe, including steps S241 to S243 below.
[0072] Step S241: Obtain the failure frequency of each data center associated with the virtual data stripe.
[0073] Failure frequency refers to the number of times a data center experiences a failure per unit of time. Failures include, but are not limited to, system crashes, power outages, and network outages.
[0074] For example, see continue. Figure 3 For virtual data stripe T1, the failure frequencies of its associated data centers 1, 2, 3, and 4 are obtained respectively.
[0075] Step S242: Select M data centers with the highest failure frequency, use the storage units corresponding to the selected data centers in the virtual data stripe as redundant storage units, and use the storage units corresponding to the other data centers in the virtual data stripe as data storage units.
[0076] Data centers with high failure rates in the virtual data stripe are used as redundant storage units, while the remaining data centers with low failure rates are used as data storage units.
[0077] For example, if the value of M is 1, and the failure frequency of each data center is found to be the highest at the current time, then data center 3 associated with virtual data stripe T1 is used as a redundant storage unit, and data centers 1, 2, and 4 are used as data storage units.
[0078] Step S243: Store M redundant data into redundant storage units respectively, and store several data blocks into data storage units respectively.
[0079] For example, write b1 to the storage unit of data center 1, write b2 to the storage unit of data center 2, write b3 to the storage unit of data center 4, and write bp to the storage unit of data center 3.
[0080] Through the above embodiments, redundant data is stored in data centers with high failure frequencies according to the failure frequency of each data center, thereby reducing the probability of data block loss and reducing the number of data recovery calculations when reading data subsequently.
[0081] In some implementations, the maximum data storage space that the virtual data stripe can provide is obtained. The maximum data storage space refers to the space size that can be provided for the data to be written using the minimum amount of redundant data. The minimum amount of redundant data can be a preset empirical value. For example, if the minimum amount of redundant data is 1, the total number of storage units in the virtual data stripe is N, and each storage unit is 4KB, then the maximum data storage space is (N-1)*4KB.
[0082] If the maximum data storage space provided by a single virtual data stripe is still less than the size of the data to be written, then two or more virtual data stripes need to be obtained to collaboratively store the data to be written in order to ensure that large amounts of data can be stored.
[0083] Taking two virtual data stripes as an example, a portion of the data to be written is stored in one virtual data stripe, and another portion is stored in the other virtual data stripe. When reading data later, it is necessary to read the data content stored in both virtual data stripes simultaneously, and perform data combination and restoration operations respectively. The combined and restored data is then spliced together to obtain the original data.
[0084] Optionally, if multiple virtual data stripes are required to collaboratively store data to be written, and the data centers associated with each virtual data stripe can be different, determine the number of shared data centers between each virtual data stripe, and select the multiple virtual data stripes with the smallest number of shared data centers to collaboratively store data to be written, so as to avoid the failure of a single data center affecting a larger number of storage units due to too many storage units in the same data center.
[0085] In some implementations, an overall bitmap and a data center bitmap corresponding to each data center are constructed. The overall bitmap is used to store whether the storage unit in each virtual data stripe stores data, and the data center bitmap is used to store whether the storage unit in a single data center stores data. After storing several data blocks and M redundant data into the respective storage units of the virtual data stripe, the method further includes: updating the data storage status of each storage unit of the virtual data stripe in the overall bitmap; and updating the data storage status of the storage unit in the data center bitmap in response to the successful storage of a data block by a storage unit in the data center.
[0086] For example, in the overall bitmap and data center bitmap, 0 indicates that the storage unit does not store data, and 1 indicates that the storage unit stores data. By initializing the overall bitmap and each data center bitmap, we can obtain the following Table 2.
[0087]
[0088] Table 2 In Table 2, a stripe refers to each virtual data stripe. If the value corresponding to the overall bitmap and stripe T0 is 0, it means that no data is stored in any of the storage cells within stripe T0; data center bitmap Figure 1 If the value corresponding to stripe T0 is 0, it means that the storage unit associated with data center 1 in stripe T0 does not store data, and so on, to determine the data storage status.
[0089] After data storage, update the overall bitmap and data center bitmap based on the data storage status.
[0090] For example, see continue. Figure 3 If each storage unit in the virtual data stripe T1 completes data storage, the value of the total bitmap at T1 is updated to 1; and if the storage unit of each data center is detected to have successfully stored data blocks, the values of data center 1, data center 2, data center 3, and data center 4 at T1 are updated to 1 respectively. The updated table is shown in Table 3 below.
[0091]
[0092] Table 3 Based on the above description of the bitmap, the verification process for data center failure recovery is described in detail: In response to data center failure recovery, the data center bitmap is compared with the overall bitmap to obtain a comparison result; if the comparison result reflects that there is a storage unit in the data center with missing data, the storage unit with missing data is designated as the unit to be recovered; the missing data of the unit to be recovered is then recovered.
[0093] If a data center fails and is subsequently restored, and new data is written to the disaster recovery storage system during the failure period, then the overall bitmap and the data center bitmap will become inconsistent.
[0094] For example, if data center 2 goes down and new data is written to virtual stripe T2 during the downtime, the bitmap of data center 2 after it comes back online is shown in Table 4 below.
[0095]
[0096] Table 4 The bitmap comparison shows that the storage unit associated with the virtual data stripe T2 in data center 2 has missing data, and this storage unit is designated as the unit to be recovered.
[0097] When recovering missing data in a unit to be recovered, one can either check if there is a missing data block corresponding to the unit to be recovered in the cache, and if so, store the missing data block in the unit to be recovered; or, identify other storage units that belong to the same virtual data stripe as the unit to be recovered, perform data recovery calculations on the data blocks stored in the other storage units based on the inverse operation corresponding to the redundancy operation algorithm, and store the recovered data blocks in the unit to be recovered.
[0098] One approach is to first check if the cache contains the missing data block corresponding to the unit to be recovered. If the cache does not contain the missing data block, then perform the data recovery calculation to save computing resources.
[0099] For example, please see Figure 4 , Figure 4 This is a schematic diagram illustrating data recovery after a data center failure, as shown in an exemplary embodiment of this application. Figure 4 As shown, there is a data missing in the storage unit associated with the virtual data stripe T1 in data center 2. If the missing data block b2 corresponding to the unit to be recovered can be found in the cache, the data block b2 in the cache is directly stored in the corresponding storage unit of data center 2.
[0100] For example, please see Figure 5 , Figure 5 This is a flowchart illustrating data recovery after a data center failure, as shown in an exemplary embodiment of this application. Figure 5 As shown, it includes: Step S501: Data center recovery after failure; Step S502: Obtain the data center bitmap corresponding to the data center that has recovered after the failure; Step S503: Compare whether the data center bitmap and the overall bitmap are consistent. If not, proceed to steps S504 to S505; if yes, proceed to step S506. Step S504: Determine the virtual data stripe associated with the unit to be recovered, read the data of other storage units in the virtual data stripe, and perform data recovery calculations based on the read data; Step S505: Store the recovered data blocks into the unit to be recovered, and update the unit to be recovered; Step S506: Has the data center bitmap corresponding to all data centers recovered after the failure been traversed? If yes, then end; otherwise, continue to step S502.
[0101] By setting up a master bitmap and a data center bitmap separately, the comparison of the bitmaps can effectively detect storage units with missing data, thus solving the problem of data inconsistency in the data center.
[0102] The data reading process will be explained in detail below.
[0103] In some implementations, upon receiving a data read request, the virtual data stripe containing the data to be read corresponding to the data read request is determined to obtain the target data stripe; based on the storage location of the storage unit associated with the target data stripe in each data center, data is read from the storage location in each data center to obtain several data read results; based on the several data read results, feedback data for the data read request is generated.
[0104] It should be noted that when generating feedback data, if there is redundant data in the data reading results, the redundant data needs to be filtered out. Alternatively, each storage unit can be marked as storing a block of original data or redundant data, and the reading of redundant data can be skipped during the reading process, and feedback data can be generated directly based on the data reading results.
[0105] Data reading includes: Scenario 1: If all data centers used to store data blocks are successfully read, the results of several data reads are combined to generate feedback data for the data read request.
[0106] For example, please see Figure 6 , Figure 6 This is a schematic diagram illustrating data reading in an exemplary embodiment of this application, as shown below. Figure 6As shown, data is read from the virtual data strip T1, and the resulting data includes b1, b2, b3, and bp. Redundant data bp is filtered out, and b1, b2, and b3 are concatenated to obtain the original data B, which is then used as the feedback data.
[0107] Scenario 2: If a data center used to store data blocks fails to read data, and the number of storage units that failed to read data is less than or equal to M, then based on the inverse operation corresponding to the redundancy operation algorithm, data recovery calculation is performed on several data read results. The recovered data blocks and several data read results are combined to generate feedback data for the data read request.
[0108] If the number of data centers that fail to read data is less than or equal to M, then data recovery calculations can be performed to recover the missing data without affecting data access.
[0109] For example, please see Figure 7 , Figure 7 This is a schematic diagram illustrating data reading in another exemplary embodiment of this application, such as... Figure 7 As shown, when reading data from virtual data stripe T2, the reading of data b2 fails because data center 2 is in a faulty state. However, according to the inverse operation corresponding to the redundancy operation algorithm, b2 = b1⊕b3⊕bp can be obtained, so the data b2 from the faulty data center 2 can be restored. The successfully read b1, b3 and the restored b2 are spliced together to obtain the original data B, which is then used as feedback data.
[0110] Figure 8 This is a block diagram illustrating a disaster recovery storage device as shown in an exemplary embodiment of this application. Figure 8 As shown, the exemplary disaster recovery storage device 800 includes: The partition quantity determination module 810 is used to obtain the number of redundant data M, calculate the difference between the number of storage units in the virtual data stripe and M, and obtain the number of data block partitions. The data partitioning module 820 is used to partition the data to be written according to the number of data block partitions, resulting in several data blocks; The redundancy calculation module 830 is used to perform M redundancy data calculations on several data blocks respectively to obtain M redundancy data; wherein, the redundancy data is used to describe the numerical relationship between several data blocks, and each redundancy data is not linearly correlated; The data storage module 840 is used to store several data blocks and M redundant data into the respective storage units of the virtual data stripe.
[0111] It should be noted that the disaster recovery storage device and the disaster recovery storage method provided in the above embodiments belong to the same concept. The specific ways in which each module and unit performs operations have been described in detail in the method embodiments and will not be repeated here. In practical applications, the disaster recovery storage device provided in the above embodiments can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. This is not a limitation here.
[0112] Please see Figure 9 , Figure 9 This is a schematic diagram illustrating the structure of an electronic device in an exemplary embodiment of this application. The electronic device 900 includes a memory 910 and a processor 920. The processor 920 executes program instructions stored in the memory 910 to implement the steps in any of the disaster recovery storage method embodiments described above. In a specific implementation scenario, the electronic device 900 may include, but is not limited to, a microcomputer or a server. Furthermore, the electronic device 900 may also include mobile devices such as laptops and tablets, without limitation.
[0113] Specifically, the processor 920 controls itself and the memory 910 to implement the steps in any of the disaster recovery storage method embodiments described above. The processor 920 can also be referred to as a Central Processing Unit (CPU). The processor 920 may be an integrated circuit chip with signal processing capabilities. The processor 920 can also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The general-purpose processor can be a microprocessor or any conventional processor. Furthermore, the processor 920 can be implemented using integrated circuit chips.
[0114] Please see Figure 10 , Figure 10 This is a schematic diagram illustrating the structure of a computer-readable storage medium in an exemplary embodiment of this application. The computer-readable storage medium 1000 stores program instructions 1010 that can be executed by a processor. The program instructions 1010 are used to implement the steps in any of the disaster recovery storage method embodiments described above.
[0115] In some embodiments, the functions or modules of the apparatus provided in this disclosure can be used to perform the methods described in the above method embodiments. The specific implementation can be referred to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.
[0116] The description of the various embodiments above tends to emphasize the differences between the various embodiments. The similarities or similarities between them can be referred to, and for the sake of brevity, they will not be repeated here.
[0117] In the several embodiments provided in this application, it should be understood that the disclosed methods and apparatus can be implemented in other ways. For example, the apparatus implementations described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be electrical, mechanical, or other forms.
[0118] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it 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 includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods 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.
Claims
1. A disaster recovery storage method, characterized in that, The method involves dividing the storage resources of each data center into multiple storage units to construct multiple virtual data stripes, with each virtual data stripe containing storage units from multiple data centers. Obtain the number of redundant data M, calculate the difference between the number of storage units in the virtual data stripe and M, and obtain the number of data block divisions; The data to be written is divided according to the number of data blocks to be divided, resulting in several data blocks; M redundant data calculations are performed on the plurality of data blocks respectively to obtain M redundant data; wherein, the redundant data is used to describe the numerical relationship between the plurality of data blocks, and each redundant data is not linearly correlated; The plurality of data blocks and M redundant data are respectively stored in the storage units of the virtual data stripe.
2. The method according to claim 1, characterized in that, A general bitmap and a data center bitmap corresponding to each data center are constructed. The general bitmap is used to store whether the storage unit in each virtual data stripe stores data, and the data center bitmap is used to store whether the storage unit in a single data center stores data. After storing the plurality of data blocks and M redundant data into the respective storage units of the virtual data stripe, the method further includes: Update the data storage status of each storage unit in the virtual data stripe in the overall bitmap; In addition, in response to the successful storage of a data block by a storage unit in the data center, the data storage status of the storage unit in the data center bitmap is updated.
3. The method according to claim 2, characterized in that, The method further includes: In response to the recovery after the data center failure, the data center bitmap is compared with the overall bitmap to obtain the comparison result; If the comparison results indicate that a storage unit in the data center has data loss, then the storage unit with data loss will be designated as a unit to be recovered. The missing data of the unit to be recovered is recovered.
4. The method according to claim 3, characterized in that, The recovery of missing data in the unit to be recovered includes: Check if the missing data block corresponding to the unit to be recovered exists in the cache. If it exists, store the missing data block in the unit to be recovered. Alternatively, other storage units belonging to the same virtual data stripe as the unit to be recovered can be identified, and data recovery calculations can be performed on the data blocks stored in the other storage units based on the inverse operation corresponding to the redundancy calculation algorithm, and the recovered data blocks can be stored in the unit to be recovered.
5. The method according to claim 1, characterized in that, The method further includes: Upon receiving a data read request, determine the virtual data stripe where the data to be read corresponds to the data read request is located, and obtain the target data stripe; Based on the storage location of the storage unit associated with the target data stripe in each data center, data is read from the storage location in each data center to obtain several data reading results; Based on the aforementioned data reading results, feedback data for the data reading request is generated.
6. The method according to claim 5, characterized in that, The step of generating feedback data for the data reading request based on the plurality of data reading results includes: If all data centers used to store data blocks are successfully read, the data read results are combined to generate feedback data for the data read request. If a data center reading for storing a data block fails, and the number of storage units that failed to read the data is less than or equal to M, then based on the inverse operation corresponding to the redundancy calculation algorithm, data recovery calculation is performed on the several data reading results, and the recovered data block and the several data reading results are combined to generate the feedback data for the data reading request.
7. The method according to claim 1, characterized in that, The acquisition of the number M of redundant data includes: Obtain the size of the data to be written and the storage space size of each storage unit in the virtual data stripe; Based on the data size and the storage space size, determine the number of storage units needed to store the data to be written, and obtain the required quantity; The difference between the total number of storage units in the virtual data stripe and the required number is calculated to obtain the amount of redundant data M.
8. The method according to claim 1, characterized in that, The step of storing the plurality of data blocks and M redundant data into the respective storage units of the virtual data stripe includes: Obtain the failure frequency of each data center associated with the virtual data stripe; Select M data centers with the highest failure frequency, and use the storage units corresponding to the selected data centers in the virtual data stripe as redundant storage units; use the storage units corresponding to the other data centers in the virtual data stripe as data storage units. M redundant data are stored in the redundant storage unit, and the plurality of data blocks are stored in the data storage unit.
9. An electronic device, characterized in that, The electronic device includes a memory and a processor, the processor being configured to execute program instructions stored in the memory to implement the steps of the method as described in any one of claims 1-8.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores program instructions that can be executed by a processor to implement the steps of the method as described in any one of claims 1-8.
