CN115630003B - Mirror image method, device, equipment and medium for cache data - Google Patents

Mirror image method, device, equipment and medium for cache data Download PDF

Info

Publication number
CN115630003B
CN115630003B CN202211433681.1A CN202211433681A CN115630003B CN 115630003 B CN115630003 B CN 115630003B CN 202211433681 A CN202211433681 A CN 202211433681A CN 115630003 B CN115630003 B CN 115630003B
Authority
CN
China
Prior art keywords
node
nodes
storage system
mirror
recombined
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202211433681.1A
Other languages
Chinese (zh)
Other versions
CN115630003A (en
Inventor
孟祥坤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Inspur Intelligent Technology Co Ltd
Original Assignee
Suzhou Inspur Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Suzhou Inspur Intelligent Technology Co Ltd filed Critical Suzhou Inspur Intelligent Technology Co Ltd
Priority to CN202211433681.1A priority Critical patent/CN115630003B/en
Publication of CN115630003A publication Critical patent/CN115630003A/en
Application granted granted Critical
Publication of CN115630003B publication Critical patent/CN115630003B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0877Cache access modes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/06Addressing a physical block of locations, e.g. base addressing, module addressing, memory dedication
    • G06F12/0646Configuration or reconfiguration
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The application discloses a mirroring method, device, equipment and medium for caching data, which belong to the technical field of data caching, and the method comprises the following steps: setting corresponding identification numbers for all nodes in a plurality of cabinets, and forming a target sequence; mirroring the cache data of the target node to nodes adjacent to the target node, and mirroring the cache data of the node corresponding to the last identification number in the target sequence to the node corresponding to the first identification number in the target sequence to obtain a plurality of mirror pairs with the same number as the nodes in the storage system; if abnormal nodes appear in the storage system, determining nodes which are subjected to mirror pairing with the abnormal nodes, and obtaining nodes to be recombined; and recombining and pairing the nodes to be recombined and the nodes in the normal state in the mirror image pairs to reconstruct the mirror image pairs, and enabling each mirror image pair of the storage system to only contain two nodes. The method can further improve the overall reliability of the storage system formed by multiple cabinets in the use process.

Description

Mirror image method, device, equipment and medium for cache data
Technical Field
The present invention relates to the field of data caching technologies, and in particular, to a method, an apparatus, a device, and a medium for mirroring cached data.
Background
In the prior art, all mirrored cache policies are based on cache mirroring between nodes within a single enclosure. Even with multiple enclosures in a storage system, cache mirroring is performed between nodes of a single enclosure. Under the caching mechanism, once a certain cabinet in the storage system fails, the cached data in the storage system is at risk of losing, so that the overall reliability of the storage system in the use process cannot be ensured. Currently, there is no more effective solution to this technical problem.
Disclosure of Invention
Therefore, the present invention aims to provide a method, apparatus, device and medium for mirroring cache data, so as to further improve the overall reliability of a storage system formed by multiple cabinets in the use process. The specific scheme is as follows:
a method of mirroring cached data, comprising:
setting corresponding identification numbers for all nodes in a plurality of cabinets in a storage system, and forming a target sequence by the identification numbers corresponding to all the nodes;
mirroring the cache data of the target node to nodes adjacent to the target node according to the arrangement sequence of the target sequence, and mirroring the cache data of the node corresponding to the last identification number in the target sequence to the node corresponding to the first identification number in the target sequence to obtain a plurality of mirror pairs with the same number as the nodes in the storage system; the target node is a node corresponding to any one of the other identification numbers except the tail identification number in the target sequence;
If abnormal nodes appear in the storage system, determining nodes which are subjected to mirror pairing with the abnormal nodes, and obtaining nodes to be recombined;
and recombining and pairing the nodes to be recombined and the nodes in the normal state in the mirror image pairs to reconstruct the mirror image pairs, wherein each mirror image pair of the storage system only contains two nodes.
Preferably, the method further comprises:
if abnormal nodes continuously appear in the storage system and only one first node in a normal state remains in the storage system, the first node is controlled to execute writing operation by using a write-back mode at a first appointed time, and the first node is controlled to execute writing operation by using a write-through mode at a second appointed time.
Preferably, the method further comprises:
if a second node which is in a normal state is in the storage system, recombining and pairing the second node and the first node, and mirroring the cache data of the first node to the second node;
and when the cache data of the first node is successfully mirrored to the second node, controlling the second node and the first node to execute write operation by utilizing the write-back mode.
Preferably, the method further comprises:
if a third node which is in a normal state is in the abnormal nodes, recombining and pairing the third node and the nodes in the normal state in the plurality of mirror pairs to obtain a recombined mirror pair;
and updating the recombined mirror image pair so that the recombined mirror image pair only contains two nodes.
Preferably, the process of reorganizing and pairing the node to be reorganized and the nodes in the normal state in the plurality of mirror pairs includes:
when the node to be recombined is to be recombined with a fourth node in a normal state in a plurality of mirror pairs, judging whether the cache data in the fourth node is effective cache data or not;
and if so, recombining and pairing the node to be recombined and the fourth node.
Preferably, the process of reorganizing and pairing the node to be reorganized and the nodes in the normal state in the plurality of mirror pairs includes:
if the fifth node in the storage system is always in an online state, determining a mirror image pair where the fifth node is located, and obtaining an original mirror image pair;
and recombining and pairing the nodes to be recombined and the nodes in the normal state in the mirror image pairs according to the principle that the original mirror image pair is kept unchanged.
Preferably, the process of reorganizing and pairing the node to be reorganized and the node in a normal state in the storage system to reorganize and pair the mirrors includes:
if the number of the nodes to be recombined is greater than one, carrying out recombination pairing on the target nodes to be recombined and the nodes in a normal state in the storage system so as to reconstruct a mirror image pair; the target node to be recombined is any node in the nodes to be recombined;
when the target node to be recombined forms mirror pairs again, judging whether each mirror pair of the storage system contains nodes for effectively caching data or not;
if yes, continuing to execute the step of recombining and pairing the target node to be recombined with the node in the normal state in the storage system to reconstruct the mirror image pair until the number of the nodes to be recombined is zero.
Preferably, the process of continuing to perform the step of recombining the target node to be recombined with the node in the normal state in the storage system to reconstruct the mirror image pair includes:
when the target node to be recombined forms a mirror image pair again, starting timing by using a timer, and judging whether the timing time of the timer reaches the preset time or not;
If yes, the step of continuing to execute the reorganization pairing of the target node to be reorganized and the node in the normal state in the storage system so as to reorganize the mirror image pair is carried out.
Preferably, after the process of determining whether the timing time of the timer reaches the preset time, the method further includes:
and if not, prohibiting the step of continuing to execute the reorganization pairing of the target node to be reorganized and the node in the normal state in the storage system so as to reorganize the mirror image pair.
Preferably, after the process of starting timing by using the timer when the target node to be reorganized reorganizes the mirror pair, the method further includes:
judging whether a seventh node which is recovered to normal exists in the storage system or not;
if the seventh node exists, judging whether the timing time of the timer reaches the preset time or not;
if the timing time of the timer reaches the preset time, recombining and pairing the seventh node and nodes in a normal state in a plurality of mirror pairs to recombine the mirror pairs;
and if the timing time of the timer does not reach the preset time, forbidding the reconstruction pairing of the seventh node and the nodes in the normal state in the mirror image pairs.
Preferably, the process of reorganizing and pairing the node to be reorganized and the nodes in the normal state in the plurality of mirror pairs to reorganize the mirror pairs includes:
judging whether nodes with effective cache data exist in the target mirror image pair or not; wherein the target mirror pair is any one of the mirror pairs in the storage system;
and if not, forbidding pairing the node to be recombined and the node in the target mirror image pair.
Preferably, after the process of reorganizing the node to be reorganized and the nodes in the normal state in the plurality of mirror pairs to reorganize the mirror pairs and make each mirror pair of the storage system only contain two nodes, the method further includes:
judging whether the times of mirroring the cache data in each node in the storage system are equal or not;
if not, recombining and pairing the nodes in the normal state in the plurality of mirror pairs, and executing the step of judging whether the times of mirroring the cache data in each node in the storage system are equal again until the times of mirroring the cache data in each node in the storage system are equal.
Correspondingly, the invention also discloses a mirror image device for caching data, which comprises:
the label setting module is used for setting corresponding identification numbers for all nodes in a plurality of cabinets in the storage system and forming target sequences by the identification numbers corresponding to all the nodes;
the mirror image pair generating module is used for mirroring the cache data of the target node to the nodes adjacent to the target node according to the arrangement sequence of the target sequence, and mirroring the cache data of the node corresponding to the tail identification number in the target sequence to the node corresponding to the first identification number in the target sequence so as to obtain a plurality of mirror image pairs with the same number as the nodes in the storage system; the target node is a node corresponding to any one of the other identification numbers except the tail identification number in the target sequence;
the node determining module is used for determining nodes which are subjected to mirror pairing with the abnormal nodes if the abnormal nodes appear in the storage system, so as to obtain nodes to be recombined;
and the mirror image pair reorganizing module is used for reorganizing and pairing the nodes to be reorganized and the nodes in the normal state in the plurality of mirror image pairs so as to reorganize the mirror image pairs, and each mirror image pair of the storage system only contains two nodes.
Correspondingly, the invention also discloses mirror image equipment for caching data, which comprises:
a memory for storing a computer program;
a processor for implementing the steps of a method of mirroring cached data as disclosed above when executing said computer program.
Correspondingly, the invention also discloses a computer readable storage medium, wherein the computer readable storage medium is stored with a computer program, and the computer program realizes the steps of a data caching mirroring method disclosed in the previous step when being executed by a processor.
It can be seen that in the present invention, firstly, corresponding identification numbers are set for each node in a plurality of cabinets in a storage system, and identification numbers corresponding to all nodes in the storage system are formed into a target sequence; then, mirroring the cache data of the target node to the nodes adjacent to the target node according to the arrangement sequence of the target sequence, and mirroring the cache data of the node corresponding to the last identification number in the target sequence to the node corresponding to the first identification number in the target sequence to obtain a plurality of mirror pairs with the same number as the nodes in the storage system; the target node is a node corresponding to any one of the other identification numbers except the tail identification number in the target sequence; if abnormal nodes appear in the storage system, determining nodes which are subjected to mirror pairing with the abnormal nodes, and obtaining nodes to be recombined; and recombining and pairing the nodes to be recombined and the nodes in the normal state in the mirror image pairs to reconstruct the mirror image pairs, and enabling each mirror image pair of the storage system to only contain two nodes. Compared with the prior art, the cache strategy used by the invention dispersedly stores all cache data in the storage system to nodes of different cabinets in the storage system, so that even if one cabinet in the storage system fails, the cache strategy can quickly restore the cache data in the storage system, thereby further improving the overall reliability of the storage system formed by multiple cabinets in the use process. Correspondingly, the mirror device and the mirror medium for caching data have the beneficial effects.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present invention, and that other drawings can be obtained according to the provided drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flowchart of a method for mirroring cached data according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a storage system having 4 mirror pairs;
FIG. 3 is a schematic diagram of a reorganizing mirror pair performed by other nodes in the storage system when an abnormality occurs in the node 1 in the storage system shown in FIG. 2;
FIG. 4 is a schematic diagram of a first application scenario in reorganizing and pairing nodes in mirror pairs in a storage system;
FIG. 5 is a schematic diagram of a second application scenario in reorganizing and pairing nodes in mirror pairs in a storage system;
FIG. 6 is a schematic diagram of an online node in a storage system forming a stable mirror pair;
FIG. 7 is a schematic diagram of a third application scenario in reorganizing and pairing nodes in mirror pairs in a storage system;
FIG. 8 is a schematic diagram of a fourth application scenario in reorganizing and pairing nodes in mirror pairs in a storage system;
FIG. 9 is a schematic diagram of a storage system in which nodes 1, 2, 3 and 4 are paired in a mirror image pair;
FIG. 10 is a block diagram of a mirroring device for caching data according to an embodiment of the present invention;
fig. 11 is a block diagram of a mirroring device for caching data according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Referring to fig. 1, fig. 1 is a flowchart of a method for mirroring cached data according to an embodiment of the present invention, where the method includes:
step S11: setting corresponding identification numbers for all nodes in a plurality of cabinets in a storage system, and forming a target sequence by the identification numbers corresponding to all the nodes;
Step S12: mirroring the cache data of the target node to nodes adjacent to the target node according to the arrangement sequence of the target sequence, and mirroring the cache data of the node corresponding to the last identification number in the target sequence to the node corresponding to the first identification number in the target sequence to obtain a plurality of mirror pairs with the same number as the nodes in the storage system; the target node is a node corresponding to any one of the other identification numbers except the tail identification number in the target sequence;
step S13: if abnormal nodes appear in the storage system, determining nodes which are subjected to mirror pairing with the abnormal nodes, and obtaining nodes to be recombined;
step S14: and recombining and pairing the nodes to be recombined and the nodes in the normal state in the mirror image pairs to reconstruct the mirror image pairs, and enabling each mirror image pair of the storage system to only contain two nodes.
In this embodiment, a method for mirroring cached data is provided, by which the overall reliability of a storage system formed by multiple cabinets in the use process can be further improved. Specifically, when a plurality of cabinets are provided in the storage system, corresponding identification numbers are set for each node in the plurality of cabinets in the storage system, and the identification numbers corresponding to each node in all the cabinets are formed into a target sequence.
In the actual operation process, in order to improve convenience when the identification numbers are set for each node, corresponding identification numbers can be set for the nodes in a plurality of cabinets in the storage system in sequence according to the sequence from low to high of the natural number, and the identification numbers corresponding to the nodes form a target sequence.
After the identification numbers corresponding to the nodes in the cabinets in the storage system are formed into the target sequence, the cache data of the target node are mirrored to the adjacent nodes of the target node according to the arrangement sequence of the target sequence, the cache data corresponding to the last identification number in the target sequence is mirrored to the node corresponding to the first identification number in the target sequence, and a plurality of mirror pairs with the number equal to that of the nodes in the storage system are obtained. The target node refers to a node corresponding to any one of the other identification numbers except the end identification number in the target sequence.
Assuming that there are M cabinets in the storage system, where the M cabinets include N nodes, when the N nodes are set with corresponding identification numbers, the identification number of the 1 st node in the N nodes may be set to 1, the identification number of the 2 nd node may be set to 2, the identification number of the 3 rd node may be set to 3, the identification number of the 4 th node may be set to 4, … …, and so on, and the identification number of the N-1 st node may be set to N-1, and the identification number of the N node may be set to N. In this case, when the mirror pairs corresponding to the N nodes in the storage system are formed, the cache data on the node with the identification number 1 may be mirrored to the node with the identification number 2, the cache data on the node with the identification number 2 may be mirrored to the node with the identification number 3, the cache data on the node with the identification number 3 may be mirrored to the node with the identification number 4, … …, and so on, and the cache data on the node with the identification number N-1 may be mirrored to the node with the identification number N, and the cache data on the node with the identification number N may be mirrored to the node with the identification number 1.
In actual operation, the above mirroring process of the cached data may be represented by mirror pairs (1, 2), (2, 3), (3, 4) … … (N-1, N) and (N, 1). It is conceivable that by such an arrangement, N nodes in the storage system may be formed into N mirror pairs, and the cache data on each node in the storage system may be stored in a decentralized manner on the nodes of different cabinets in the storage system.
After a plurality of mirror pairs with the same number as the nodes in the storage system are obtained, if abnormal nodes appear in the storage system, determining the nodes which are subjected to mirror pairing with the abnormal nodes, and obtaining the nodes to be recombined; and then, recombining and pairing the nodes to be recombined and the nodes in the normal state in the mirror image pairs, so that the mirror image pairs are recombined, and each mirror image pair in the storage system only contains two nodes. In this embodiment, the number of abnormal nodes in the storage system may be one or more, but the number of abnormal nodes in the storage system is never greater than the number of all nodes in the storage system, which is not described in detail herein.
The reorganization pairing process of the nodes to be reorganized is described in detail herein by way of one example. Assume that there are a total of 4 nodes in the storage system, node 1, node 2, node 3, and node 4, respectively. Referring to fig. 2, fig. 2 is a schematic diagram of a storage system having 4 mirror pairs. In fig. 2, 101 denotes node 1, 102 denotes node 2, 103 denotes node 3, and 104 denotes node 4.Dom1 represents mirror pair 1, dom2 represents mirror pair 2, dom3 represents mirror pair 3, and Dom4 represents mirror pair 4.
Wherein mirror pair 1 comprises node 1 and node 2, mirror pair 2 comprises node 2 and node 3, mirror pair 3 comprises node 3 and node 4, and mirror pair 4 comprises node 4 and node 1. In fig. 2, A0 represents the cache data of node 1, A1 represents the cache data of node 1 mirrored to node 2, B0 represents the cache data of node 2, B1 represents the cache data of node 2 mirrored to node 3, C0 represents the cache data of node 3, C1 represents the cache data of node 3 mirrored to node 4, D0 represents the cache data of node 4, and D1 represents the cache data of node 4 mirrored to node 1.
Referring to fig. 3, fig. 3 is a schematic diagram illustrating a reorganization mirror pair performed by other nodes in the storage system when an abnormality occurs in the node 1 in the storage system shown in fig. 2. The parameters shown in fig. 3 remain identical to those described in fig. 2 and are not described in detail here. As can be seen from fig. 3, one node in the storage system may be assigned to multiple mirror pairs in the storage system. In addition, it should be noted that if a mirror pair reaches a stable state, it contains at most 2 nodes, and if the storage system is performing node reorganization pairing, it may contain 3 nodes in a mirror pair.
It can be understood that, because the caching strategy used in the embodiment dispersedly stores all the cached data in the storage system onto the nodes of different cabinets in the storage system, even if one cabinet in the storage system fails under the setting mechanism, the method provided by the embodiment can quickly restore the cached data in the storage system, thereby further improving the overall reliability of the storage system formed by multiple cabinets in the use process.
It can be seen that, in this embodiment, firstly, corresponding identification numbers are set for each node in a plurality of cabinets in a storage system, and identification numbers corresponding to all nodes in the storage system are formed into a target sequence; then, mirroring the cache data of the target node to the nodes adjacent to the target node according to the arrangement sequence of the target sequence, and mirroring the cache data of the node corresponding to the last identification number in the target sequence to the node corresponding to the first identification number in the target sequence to obtain a plurality of mirror pairs with the same number as the nodes in the storage system; the target node is a node corresponding to any one of the other identification numbers except the tail identification number in the target sequence; if abnormal nodes appear in the storage system, determining nodes which are subjected to mirror pairing with the abnormal nodes, and obtaining nodes to be recombined; and recombining and pairing the nodes to be recombined and the nodes in the normal state in the mirror image pairs to reconstruct the mirror image pairs, and enabling each mirror image pair of the storage system to only contain two nodes. Compared with the prior art, the cache policy used in the embodiment dispersedly stores all cache data in the storage system to nodes of different cabinets in the storage system, so that even if a certain cabinet in the storage system fails, the cache policy can be used for quickly recovering the cache data in the storage system, and the overall reliability of the storage system formed by multiple cabinets in the use process can be further improved.
Based on the above embodiment, this embodiment further describes and optimizes a technical solution, and as a preferred implementation manner, the mirroring method further includes:
if the abnormal node continuously appears in the storage system and only one first node in a normal state remains in the storage system, the first node is controlled to execute the writing operation by using the write-back mode at a first designated time, and the first node is controlled to execute the writing operation by using the write-through mode at a second designated time.
In practical application, if a plurality of abnormal nodes continuously appear in the storage system, and only one first node in a normal state remains in the storage system, in order to enable the storage system to provide normal service for a user in this case, the first node may be controlled to execute writing operation by using a write-back mode in a first designated time, and the first node may be controlled to execute writing operation by using a write-through mode in a second designated time.
It will be appreciated that when the first node performs a write operation using the write-back mode for a first specified time, such a mode of operation increases the security risk of storing data in the storage system, although it may be ensured that the storage system is able to provide normal services to the user. Therefore, after the first node is controlled to execute the writing operation in the write-back mode at the first designated time, the first node is also controlled to execute the writing operation in the write-through mode at the second designated time, so that the data written into the first node can be written into a disk of the storage system, and the data written into the first node is better protected.
As a preferred embodiment, the mirroring method further includes:
if a second node which is in a normal state is in the storage system, recombining and pairing the second node and the first node, and mirroring the cache data of the first node to the second node;
when the cached data of the first node is successfully mirrored to the second node, the second node and the first node are controlled to execute the write operation by using the write-back mode.
When the first node performs the writing operation, if a second node which is in a normal state is present in the storage system, the second node and the first node can be paired again, and the cache data of the first node is mirrored to the second node. When the cache data of the first node is successfully mirrored to the second node, the first node and the second node are controlled to execute writing operation by using a writing back mode. It is conceivable that the response speed of the storage system to the user writing operation can be improved by the arrangement, so that the user experience of the user when using the storage system can be further improved.
Obviously, by the technical scheme provided by the embodiment, the service experience of the storage system when writing data to the user can be improved.
Based on the above embodiment, this embodiment further describes and optimizes a technical solution, and as a preferred implementation manner, the mirroring method further includes:
if a third node which is in a normal state is in the abnormal nodes, recombining and pairing the third node and the nodes in the normal state in the plurality of mirror image pairs to obtain a recombined mirror image pair;
the pair of reorganized images is updated such that the pair of reorganized images contains only two nodes.
It will be appreciated that when a mirror pair reaches steady state, it will contain 2 nodes inside, while when a mirror pair is reorganized into mirror pairs, it may contain up to 3 nodes inside.
In this embodiment, in order to ensure the reliability of each mirror pair when storing the cached data, after the third node is recombined with the nodes in the normal state in the plurality of mirror pairs to obtain the recombined mirror pair, the recombined mirror pair needs to be updated, so that the situation that 3 nodes exist in the recombined mirror pair is avoided. In other words, after the reorganized mirror image pair is obtained, the reorganized mirror image pair needs to be updated, so that the reorganized mirror image pair only contains 2 nodes.
Obviously, by the technical scheme provided by the embodiment, the overall reliability of each mirror pair when storing the cache data can be ensured.
Based on the above embodiment, this embodiment further describes and optimizes the technical solution, as a preferred implementation manner, the steps are as follows: the process for recombining and pairing the nodes to be recombined and the nodes in the normal state in the plurality of mirror pairs comprises the following steps:
when the node to be recombined is to be recombined with a fourth node in a normal state in a plurality of mirror pairs, judging whether the cache data in the fourth node is effective cache data or not;
if yes, the node to be recombined and the fourth node are recombined and paired.
In this embodiment, when the node to be recombined is to be recombined with the fourth node in the normal state in the plurality of mirror pairs, it is further required to determine whether the cache data in the fourth node is valid cache data, and if the cache data in the fourth node is valid cache data, the node to be recombined is recombined with the fourth node; and if the cache data in the fourth node is not the valid cache data, forbidding the recombination pairing of the node to be recombined and the fourth node.
It will be appreciated that when the node to be reorganized is paired with a fourth node, the fourth node is the old member of the reorganized mirror image pair with respect to the node to be reorganized. At this time, only if the cache data in the fourth node is guaranteed to be valid cache data, the node to be recombined and the fourth node can be allowed to be recombined and paired, and the mirror image pair can be recombined. It can be thought that by the arrangement mode, when the cache data of the fourth node is mirrored to the node to be recombined, the data mirroring process of the fourth node is effective and meaningful, so that the normal operation of the storage system can be guaranteed.
It should be noted that, in the actual operation process, if any node in the storage system has an abnormal condition, or if the abnormal node in the storage system returns to normal, the nodes in all mirror pairs in the storage system will be recombined and paired.
Referring to fig. 4, fig. 4 is a schematic diagram of a first application scenario when nodes in mirror pairs in a storage system are recombined and paired. In the storage system shown in fig. 4, there are 4 nodes in total, and N0, N1, N2, and N3 represent node 0, node 1, node 2, and node 3, respectively. Wherein the bolded italicized nodes indicate a failure or abnormality. In the context of the figure of the drawings, N0Indicating that node 0 has failed, only node 1, node 2 and node 3 are in a normal state in the storage system. The 4 mirrors in the storage system are respectively dom0, dom1, dom2, dom3. Mirror pair dom0 contains node 1 and node 2, mirror pair dom1 contains node 1 and node 2, mirror pair dom2 contains node 2 and node 3, and mirror pair dom3 contains node 3 and node 1. When node 0 in the storage system fails, node 1, node 2 and node 3 in the storage system are recombined and paired in the manner of the recombined pairing shown in fig. 4, so as to form a stable mirror pair.
Based on the above embodiment, this embodiment further describes and optimizes the technical solution, as a preferred implementation manner, the steps are as follows: the process for recombining and pairing the nodes to be recombined and the nodes in the normal state in the plurality of mirror pairs comprises the following steps:
if the fifth node in the storage system is always in an online state, determining a mirror image pair where the fifth node is located, and obtaining an original mirror image pair;
and recombining and pairing the nodes to be recombined and the nodes in the normal state in the mirror image pairs according to the principle that the original mirror image pair is kept unchanged.
In the process of reorganizing and pairing the nodes to be reorganized, if it is determined that the fifth node in the storage system is always in an online state, then the mirror image pair where the fifth node is located needs to be determined to obtain an original mirror image pair, and then the nodes to be reorganized and paired with the nodes in a normal state in a plurality of mirror image pairs are reorganized and paired according to the principle that the original mirror image pair remains unchanged. That is, if a node in the storage system is always online, the node in the storage system remains unchanged even if the node is paired in a mirror image pair.
Referring to fig. 5, fig. 5 is a schematic diagram of a second application scenario when nodes in mirror pairs in a storage system are recombined and paired. The parameters shown in fig. 5 are consistent with the meaning of the parameters described in fig. 4, and will not be described again here. In the first two blocks shown in fig. 5, node 0, node 1, node 2, and node 3 in the storage system are always online, so even if each mirror pair in the storage system is reorganized, the reorganized mirror pair remains consistent with the previous mirror pair. In the last two blocks shown in fig. 5, node 0 in the storage system fails, and nodes 1, 2 and 3 in the storage system are always on-line, so when the mirror pairs in the storage system are recombined and paired, the nodes in the mirror pairs are recombined and paired according to the principle that the nodes in the mirror pairs are always on-line, and since the failed node 0 has no influence on the nodes in the mirror pairs, the recombined mirror pairs are consistent with the previous mirror pairs. Referring to fig. 6, fig. 6 is a schematic diagram illustrating an online node in a storage system forming a stable mirror pair.
Based on the above embodiment, this embodiment further describes and optimizes the technical solution, as a preferred implementation manner, the steps are as follows: and (3) recombining and pairing the nodes to be recombined and the nodes in a normal state in the storage system to reconstruct the mirror image pair, wherein the process comprises the following steps:
if the number of the nodes to be recombined is greater than one, carrying out recombination pairing on the target nodes to be recombined and the nodes in a normal state in the storage system so as to reconstruct a mirror image pair; the target node to be recombined is any node in the nodes to be recombined;
when the target node to be recombined forms mirror image pairs again, judging whether each mirror image pair of the storage system contains nodes for effectively caching data;
if yes, the step of reorganizing and pairing the target node to be reorganized and the nodes in the normal state in the storage system is continuously executed so as to reorganize the mirror image pair until the number of the nodes to be reorganized is zero.
In the process of recombining the nodes to be recombined to form the mirror image pairs, if the number of the nodes to be recombined is more than one, the next mirror image pair can be recombined after one mirror image pair is recombined. Firstly, recombining and pairing a target node to be recombined and a node in a normal state in a storage system to reconstruct a mirror pair; the target node to be recombined is any node in the nodes to be recombined.
After the target node to be recombined and the nodes in the normal state in the storage system are recombined into the mirror image pair, whether each mirror image pair in the storage system contains the nodes with effective cache data or not needs to be judged. If each mirror pair in the storage system comprises nodes with effective cache data, the step of recombining and pairing the target node to be recombined and the nodes in the normal state in the storage system is continuously executed so as to reconstruct the mirror pair until the number of the nodes to be recombined is zero. If both nodes in a certain mirror image pair in the storage system have no effective cache data, the process of recombining and pairing the target node to be recombined with the node in the normal state in the storage system is invalid, and the target node to be recombined and the node in the normal state in the storage system are required to be recombined and paired again.
As a preferred embodiment, the steps are as follows: and continuing to execute the process of reorganizing and pairing the target node to be reorganized and the nodes in the normal state in the storage system to reorganize the mirror image pair, wherein the process comprises the following steps of:
when the target node to be recombined forms the mirror image pair again, starting to count by using a timer, and judging whether the count time of the timer reaches the preset time or not;
If yes, the method proceeds to a step of continuously executing reorganization pairing on the target node to be reorganized and the nodes in a normal state in the storage system so as to reorganize the mirror image pair.
After the target node to be recombined and the nodes in the normal state in the storage system are recombined into the mirror image pair, in order to ensure that the nodes in each mirror image pair in the storage system are not affected by the online and offline of other nodes, an anti-oscillation timing mode is started for each mirror image pair in the storage system. That is, after the target node to be recombined forms the mirror image pair again, the timer is utilized to start timing, and whether the timing time of the timer reaches the preset time is judged; if the timing time of the timer reaches the preset time, the next node to be recombined can be recombined and paired.
As a preferred embodiment, the steps are as follows: after the process of judging whether the timing time of the timer reaches the preset time, the method further comprises the following steps:
if not, forbidding to execute the step of continuously executing the reorganization pairing of the target node to be reorganized and the node in the normal state in the storage system so as to reorganize the mirror image pair.
And if the timing time of the timer does not reach the preset time, prohibiting the next node to be recombined from being recombined and paired. That is, the step of reorganizing and pairing the target node to be reorganized and the nodes in the normal state in the storage system to reorganize the mirror pair is prohibited from being continuously performed.
As a preferred embodiment, the steps are as follows: when the target node to be recombined forms the mirror pair again, after the process of starting timing by using the timer, the method further comprises the following steps:
judging whether a seventh node which is recovered to normal exists in the storage system or not;
if the seventh node exists, judging whether the timing time of the timer reaches the preset time or not;
if the timing time of the timer reaches the preset time, recombining and pairing the seventh node and the nodes in the normal state in the mirror image pairs to reconstruct the mirror image pair;
and if the timing time of the timer does not reach the preset time, forbidding the reconstruction pairing of the seventh node and the nodes in the normal state in the mirror image pairs.
When the target node to be recombined is recombined into the mirror pair and begins to count by using a timer, whether a seventh node which is normal in a storage system is restored or not needs to be judged, namely whether the storage system faces to a mixed application scene that the node is abnormal and the abnormal node is restored or not is judged.
If a seventh node which is recovered to be normal exists in the storage system, the seventh node is required to be recombined and paired with the node in the normal state in the storage system, and the mirror image pair is recombined. Under the condition, whether the timing time of the timer reaches the preset time or not needs to be judged, and if the timing time of the timer reaches the preset time, the seventh node can be recombined and paired with the node in the normal state in the storage system; if the timing time of the timer does not reach the preset time, the seventh node and the nodes in the normal state in the mirror image pairs need to be forbidden to be recombined and paired.
Referring to fig. 7, fig. 7 is a schematic diagram of a third application scenario when nodes in mirror pairs in a storage system are recombined and paired. Referring to the first two blocks in fig. 7, when node 0, node 1, node 2 and node 3 in the storage system are all normal, the mirror pair dom0 includes node 1, node 2 and node 0, the mirror pair dom1 includes node 1 and node 2, the mirror pair dom2 includes node 2 and node 3, and the mirror pair dom3 includes node 3, node 1 and node 0. When node 0 in the storage system fails, the failed node 0 does not affect the nodes capable of forming a stable mirror pair in each mirror pair, so that after node 0 fails, mirror pair dom0 includes node 1 and node 2, mirror pair dom1 includes node 1 and node 2, mirror pair dom2 includes node 2 and node 3, and mirror pair dom3 includes node 3 and node 1.
Referring to the last three blocks in fig. 7, when node 0, node 1, node 2 and node 3 in the storage system are all normal, mirror pair dom0 includes node 0 and node 1, mirror pair dom1 includes node 1 and node 2, mirror pair dom2 includes node 2 and node 3, and mirror pair dom3 includes node 3 and node 0. When node 2 in the storage system fails, the nodes in the normal state in the storage system can be recombined into a mirror image pair, wherein mirror image pair dom0 comprises node 0 and node 1, mirror image pair dom1 comprises node 1 and node 3, mirror image pair dom2 comprises node 3 and node 0, and mirror image pair dom3 comprises node 3 and node 0. When node 0 in the storage system fails, the nodes in the normal state in the storage system can be recombined into a mirror image pair, at the moment, the mirror image pair dom0 comprises a node 1 and a node 3, the mirror image pair dom1 comprises a node 1 and a node 3, the mirror image pair dom2 comprises a node 3 and a node 1, and the mirror image pair dom3 comprises a node 3 and a node 1.
Based on the above embodiment, this embodiment further describes and optimizes the technical solution, as a preferred implementation manner, the steps are as follows: the process of reorganizing and pairing the nodes to be reorganized and the nodes in the normal state in the plurality of mirror pairs to reorganize the mirror pairs comprises the following steps:
judging whether nodes with effective cache data exist in the target mirror image pair or not; the target mirror image pair is any one mirror image pair in the storage system;
and if not, forbidding pairing of the node to be recombined and the node in the target mirror image pair.
In this embodiment, if an abnormal node occurs in the storage system, it is highly likely that the abnormal node will cause the other mirror image pair in the storage system to contain no node for effectively caching data. In this case, not only the storage system is taken offline, but also the service in the storage system is taken offline.
Therefore, when the nodes to be recombined are recombined and paired with the nodes in the normal state in the mirror image pairs, whether the nodes with effective cache data exist in the target mirror image pair is also required to be judged; the target mirror image pair is any one mirror image pair in the storage system; if the node with effective cache data exists in the target mirror image pair, the node to be recombined can be paired with the node in the target mirror image pair; if there are no nodes in the target image pair with valid cached data, pairing of the node to be reorganized with the nodes in the target image pair needs to be prohibited.
Referring to fig. 8, fig. 8 is a schematic diagram of reorganizing and pairing nodes in each mirror pair in a storage system in a fourth application scenario. In the diagram shown in FIG. 8, when node 0 in the storage system fails, mirror pair dom0 contains node 1 and node 2, mirror pair dom1 contains node 1 and node 2, mirror pair dom2 contains node 2 and node 3, and mirror pair dom3 contains node 3 and node 1. When node 0 and node 1 in the storage system fail simultaneously and result in no valid cached data on nodes in all mirror pairs in the storage system, then individual mirror pairs in the storage system are not reorganized.
Based on the above embodiment, this embodiment further describes and optimizes the technical solution, as a preferred implementation manner, the steps are as follows: after the process of recombining the nodes to be recombined with the nodes in the normal state in the mirror image pairs to reconstruct the mirror image pairs and only two nodes are contained in each mirror image pair of the storage system, the method further comprises the steps of:
judging whether the times of mirroring the cache data in each node in the storage system are equal or not;
if not, carrying out recombination pairing on the nodes in the normal state in the mirror image pairs, and executing the step of judging whether the times of mirroring the cache data in each node in the storage system are equal again until the times of mirroring the cache data in each node in the storage system are equal.
In this embodiment, in order to ensure that the cache data in the storage system can be uniformly distributed on each node of the storage system, after the node to be recombined is recombined with the nodes in the normal state in the plurality of mirror pairs, and the mirror pairs are recombined, it is further required to determine whether the number of times of mirroring the cache data in each node in the storage system is equal; if the number of times the cached data of each node in the storage system is mirrored is equal, it is indicated that the cached data in the storage system has been evenly distributed across each node of the storage system.
If the number of times of mirroring the cache data of each node in the storage system is not equal, it is indicated that the cache data in the storage system is not uniformly distributed on each node of the storage system, in this case, it is necessary to pair the nodes in a normal state among the plurality of mirror pairs in a reorganization manner, and execute the step of determining whether the number of times of mirroring the cache data of each node in the storage system is equal again until the number of times of mirroring the cache data of each node in the storage system is equal.
Obviously, by the technical scheme provided by the embodiment, the cache data in the storage system can be uniformly distributed on each node of the storage system.
The foregoing disclosure is described in some detail by way of a specific example so that those skilled in the art may more clearly understand the implementation principles of the method for mirroring cached data provided by the present invention.
Referring to fig. 9, fig. 9 is a schematic diagram illustrating a mirror pair combination pairing performed on nodes 1,2, 3, and 4 in a storage system. Assume that there are 4 nodes in the storage system, namely node 0, node 1, node 2 and node 3, and in the initial state, node 0, node 1, node 2 and node 3 are all in a normal state, and at this time, the 4 mirror pairs formed are (0, 1), (1, 2), (2, 3) and (3, 0) respectively. That is, node 0 mirrors its own cache data to node 1, node 1 mirrors its own cache data to node 2, node 2 mirrors its own cache data to node 3, and node 3 mirrors its own cache data to node 0.
When node 0 in the storage system fails, the pair of images in the storage system after the reorganization pairing is performed, the images composed of node 1, node 2, and node 3 are (1, 2), (2, 3), and (3, 1), respectively. When node 1 in the storage system fails, the pair of mirrors in the storage system after the reorganization pairing is performed, the pair of mirrors composed of node 2 and node 3 are (2, 3), and (3, 2), respectively. Because the mirror images of the node 2 and the node 3 in the mirror image pair after the recombination pairing are not equal in number of times, the fact that the cache data in the storage system are not uniformly distributed in the node 2 and the node 3 in the storage system is explained, and therefore the node 2 and the node 3 in the storage system can still be continuously recombined.
After node 2 and node 3 in the storage system are re-paired, mirrored pairs (3, 2), (2, 3), and (3, 2) are formed. Obviously, since the mirror image pair after the recombination pair has equal mirror image times on the cache data of the node 2 and the node 3, it is indicated that the cache data in the storage system are uniformly distributed in the node 2 and the node 3 of the storage system, and at this time, the mirror image pair in the storage system will keep a stable state and will not be recombined.
When node 2 or node 3 in the storage system fails, since only one normal node remains in the storage system and the other node does not have valid cache data, then in this case, node 2 and node 3 in the storage system are not reorganized. The mirrored pairs of storage systems will then remain unchanged (3, 2), (2, 3) and (3, 2).
If node 2 in the storage system fails, then when node 2 in the storage system returns to normal, the pair of mirrors in the storage system that are reconstituted by node 3 and node 2 are (2, 3), and (2, 3). Because the mirror images of the node 2 and the node 3 in the mirror image pair after the recombination pairing are not equal in number of times, the fact that the cache data in the storage system are not uniformly distributed in the node 2 and the node 3 in the storage system is explained, and therefore the node 2 and the node 3 in the storage system can still be continuously recombined. After node 2 and node 3 in the storage system are re-paired, mirror pairs (3, 2), (2, 3) and (3, 2) are formed, and when each mirror pair in the storage system has reached a steady state, there is no need to re-pair node 2 and node 3 in the storage system.
When the node 1 of the storage system returns to normal, the mirror pair composed of the node 1, the node 2, and the node 3 is (3, 2, 1), (2, 3), and (3, 2, 1). Because the number of times of mirroring the cache data of the node 1, the node 2 and the node 3 in the mirror pair after the pairing is not equal, and the mirror pair has 3 nodes, the node 1, the node 2 and the node 3 in the storage system can be further paired again. After node 1, node 2, and node 3 in the storage system are remapped, mirror pairs (1, 2), (2, 3), and (3, 1) are formed, and when each mirror pair in the storage system has reached a steady state, then there is no need to remap node 1, node 2, and node 3 in the storage system.
When the node 0 of the storage system returns to normal, the mirror pairs composed of the node 0, the node 1, the node 2, and the node 3 are (1,2,0), (1, 2), (2, 3), and (3, 1, 0). Because the number of times of mirroring the cache data of the node 0, the node 1, the node 2 and the node 3 in the mirror pair after the recombination pairing is unequal, the cache data in the storage system is not uniformly distributed in the node 0, the node 1, the node 2 and the node 3 in the storage system, and therefore the node 0, the node 1, the node 2 and the node 3 in the storage system can still be continuously recombined. After node 0, node 1, node 2, and node 3 in the storage system are remapped, mirror pairs (0, 1), (1, 2), (2, 3), and (3, 0) are formed, and when each mirror pair in the storage system has reached a steady state, then there is no need to remap node 0, node 1, node 2, and node 3 in the storage system.
Obviously, since the caching strategy used in the embodiment dispersedly stores all the caching data in the storage system to the nodes of different cabinets in the storage system, even if one cabinet in the storage system fails, the caching data in the storage system can be quickly recovered by using the method, so that the overall reliability of the storage system formed by multiple cabinets in the use process can be further improved.
Referring to fig. 10, fig. 10 is a block diagram of a data-caching mirroring device according to an embodiment of the present invention, where the device includes:
the label setting module 21 is configured to set corresponding identification numbers for each node in a plurality of cabinets in the storage system, and form a target sequence from the identification numbers corresponding to each node;
the mirror image pair generating module 22 is configured to mirror the cache data of the target node to a node adjacent to the target node according to the arrangement sequence of the target sequence, and mirror the cache data of the node corresponding to the last identification number in the target sequence to the node corresponding to the first identification number in the target sequence, so as to obtain a plurality of mirror image pairs equal to the number of nodes in the storage system; the target node is a node corresponding to any one of the other identification numbers except the tail identification number in the target sequence;
The node determining module 23 is configured to determine a node that performs mirror pairing with the abnormal node if the abnormal node occurs in the storage system, so as to obtain a node to be reorganized;
the mirror pair reorganizing module 24 is configured to reorganize and pair the nodes to be reorganized and the nodes in the normal states in the plurality of mirror pairs, so as to reorganize the mirror pairs, and make each mirror pair of the storage system only contain two nodes.
Preferably, the method further comprises:
and the write-through operation module is used for controlling the first node to execute write operation by using a write-back mode at a first appointed time and controlling the first node to execute write operation by using a write-through mode at a second appointed time if the abnormal node continuously appears in the storage system and only one first node in a normal state remains in the storage system.
Preferably, the method further comprises:
the node recovery module is used for carrying out recombination pairing on the second node and the first node if the second node which is recovered to the normal state appears in the storage system, and mirroring the cache data of the first node to the second node;
and the write-back operation module is used for controlling the second node and the first node to execute write operation by using a write-back mode when the cached data of the first node is successfully mirrored to the second node.
Preferably, the method further comprises:
the node reorganization module is used for reorganizing and pairing the third node and the nodes in the normal state in the mirror image pairs if the third node in the normal state is in the abnormal node, so as to obtain a reorganized mirror image pair;
and the mirror image pair updating module is used for updating the recombined mirror image pair so that the recombined mirror image pair only contains two nodes.
Preferably, the mirror image reconstruction module 24 includes:
the data judging unit is used for judging whether the cache data in the fourth node is effective cache data or not when the node to be recombined is to be recombined with the fourth node in a normal state in the plurality of mirror pairs;
and the first reorganization unit is used for reorganizing and pairing the node to be reorganized and the fourth node when the judging result of the data judging module is yes.
Preferably, the mirror image reconstruction module 24 includes:
the node online unit is used for determining a mirror image pair where the fifth node is located if the fifth node in the storage system is always in an online state, so as to obtain an original mirror image pair;
and the second reorganization unit is used for reorganizing and pairing the nodes to be reorganized and the nodes in the normal state in the mirror image pairs according to the principle that the original mirror image pair remains unchanged.
Preferably, the mirror image reconstruction module 24 includes:
the number determining unit is used for recombining and pairing the target node to be recombined with the node in the normal state in the storage system to reconstruct a mirror pair if the number of the nodes to be recombined is greater than one; the target node to be recombined is any node in the nodes to be recombined;
the node judging unit is used for judging whether each mirror image pair of the storage system contains nodes for effectively caching data or not when the target node to be recombined forms the mirror image pair again;
and the third reorganization unit is used for continuously executing the reorganization pairing of the target node to be reorganized and the nodes in the normal state in the storage system when the judging result of the node judging unit is yes so as to reorganize the mirror image pair until the number of the nodes to be reorganized is zero.
Preferably, the third recombination unit comprises:
the time timing subunit is used for starting timing by using the timer when the target node to be recombined forms the mirror image pair again, and judging whether the timing time of the timer reaches the preset time or not;
and the third reorganization subunit is used for entering into the step of continuously executing reorganization pairing on the target node to be reorganized and the nodes in the normal state in the storage system so as to reorganize the mirror image pair when the judging result of the time timing subunit is yes.
Preferably, the method further comprises:
and the reorganization prohibition subunit is used for prohibiting execution of the step of continuously executing reorganization pairing of the target node to be reorganized and the node in the normal state in the storage system so as to reorganize the mirror image pair when the judging result of the time timing subunit is no.
Preferably, the method further comprises:
the restoration judging unit is used for judging whether a seventh node which restores to normal exists in the storage system after the process of starting timing by using the timer when the target node to be restored forms the mirror image pair again;
the time judging unit is used for judging whether the timing time of the timer reaches the preset time or not when the judging result of the recovery judging unit is yes;
the first execution unit is used for recombining and pairing the seventh node and the nodes in the normal state in the mirror image pairs when the judging result of the time judging unit is yes so as to reorganize the mirror image pairs;
and the second execution unit is used for prohibiting the recombination pairing of the seventh node and the nodes in the normal state in the mirror pairs when the judging result of the time judging unit is negative.
Preferably, the mirror image reconstruction module 24 includes:
the cache judging unit is used for judging whether nodes with valid cache data exist in the target mirror image pair or not; the target mirror image pair is any one mirror image pair in the storage system;
And the pairing prohibition unit is used for prohibiting pairing of the node to be recombined and the node in the target mirror image pair when the judging result of the cache judging unit is negative.
Preferably, the method further comprises:
the number judgment module is used for carrying out recombination pairing on nodes to be recombined and nodes in a normal state in a plurality of mirror image pairs so as to reconstruct the mirror image pairs, and judging whether the number of times of carrying out mirror image on the cache data in each node in the storage system is equal after the process that each mirror image pair of the storage system only contains two nodes;
and the node reconfiguration module is used for carrying out reorganization pairing on the nodes in the normal state in the plurality of mirror image pairs when the judgment result of the number judgment module is no, and carrying out the step of judging whether the number of times of mirroring the cache data in each node in the storage system is equal again until the number of times of mirroring the cache data in each node in the storage system is equal.
The mirror image device for the cache data has the beneficial effects of the mirror image method for the cache data.
Referring to fig. 11, fig. 11 is a block diagram of a data caching mirroring device according to an embodiment of the present invention, where the device includes:
A memory 31 for storing a computer program;
a processor 32 for implementing the steps of a method of mirroring buffered data as disclosed above when executing a computer program.
The mirror image device for the cached data has the beneficial effects of the mirror image method for the cached data.
Accordingly, an embodiment of the present invention further provides a computer readable storage medium, where a computer program is stored, where the computer program, when executed by a processor, implements the steps of a method for mirroring cache data as disclosed above.
The computer readable storage medium provided by the embodiment of the invention has the beneficial effects of the disclosed mirroring method for caching data.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described in a different point from other embodiments, so that the same or similar parts between the embodiments are referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant points refer to the description of the method section.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The foregoing describes in detail a method, apparatus, device and medium for mirroring cached data, and specific examples are applied to illustrate the principles and embodiments of the present invention, where the foregoing examples are only for helping to understand the method and core idea of the present invention; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present invention, the present description should not be construed as limiting the present invention in view of the above.

Claims (11)

1. A method for mirroring cached data, comprising:
setting corresponding identification numbers for all nodes in a plurality of cabinets in a storage system, and forming a target sequence by the identification numbers corresponding to all the nodes;
mirroring the cache data of the target node to nodes adjacent to the target node according to the arrangement sequence of the target sequence, and mirroring the cache data of the node corresponding to the last identification number in the target sequence to the node corresponding to the first identification number in the target sequence to obtain a plurality of mirror pairs with the same number as the nodes in the storage system; the target node is a node corresponding to any one of the other identification numbers except the tail identification number in the target sequence;
if abnormal nodes appear in the storage system, determining nodes which are subjected to mirror pairing with the abnormal nodes, and obtaining nodes to be recombined;
recombining and pairing the nodes to be recombined and the nodes in the normal state in the mirror image pairs to reconstruct the mirror image pairs, and enabling each mirror image pair of the storage system to only contain two nodes;
the process of reorganizing and pairing the node to be reorganized and the node in a normal state in the storage system to reorganize the mirror pair comprises the following steps:
If the number of the nodes to be recombined is greater than one, carrying out recombination pairing on the target nodes to be recombined and the nodes in a normal state in the storage system so as to reconstruct a mirror image pair; the target node to be recombined is any node in the nodes to be recombined;
when the target node to be recombined forms mirror pairs again, judging whether each mirror pair of the storage system contains nodes for effectively caching data or not;
if yes, continuing to execute the step of recombining and pairing the target node to be recombined with the node in the normal state in the storage system to reconstruct the mirror image pair until the number of the nodes to be recombined is zero;
and the process of continuing to execute the step of recombining and pairing the target node to be recombined and the node in the normal state in the storage system to reconstruct the mirror image pair comprises the following steps:
when the target node to be recombined forms a mirror image pair again, starting timing by using a timer, and judging whether the timing time of the timer reaches the preset time or not;
if yes, entering a step of continuously executing the recombination pairing of the target node to be recombined and the node in the normal state in the storage system so as to reconstruct a mirror image pair;
After the process of judging whether the timing time of the timer reaches the preset time, the method further comprises the following steps:
if not, prohibiting the execution of the step of continuing to execute the recombination pairing of the target node to be recombined and the node in the normal state in the storage system so as to reconstruct the mirror image pair;
when the target node to be recombined reconstructs the mirror pair, the process of starting timing by using a timer further comprises:
judging whether a seventh node which is recovered to normal exists in the storage system or not;
if the seventh node exists, judging whether the timing time of the timer reaches the preset time or not;
if the timing time of the timer reaches the preset time, recombining and pairing the seventh node and nodes in a normal state in a plurality of mirror pairs to recombine the mirror pairs;
and if the timing time of the timer does not reach the preset time, forbidding the reconstruction pairing of the seventh node and the nodes in the normal state in the mirror image pairs.
2. The mirroring method of claim 1, further comprising:
if abnormal nodes continuously appear in the storage system and only one first node in a normal state remains in the storage system, the first node is controlled to execute writing operation by using a write-back mode at a first appointed time, and the first node is controlled to execute writing operation by using a write-through mode at a second appointed time.
3. The mirroring method of claim 2, further comprising:
if a second node which is in a normal state is in the storage system, recombining and pairing the second node and the first node, and mirroring the cache data of the first node to the second node;
and when the cache data of the first node is successfully mirrored to the second node, controlling the second node and the first node to execute write operation by utilizing the write-back mode.
4. The mirroring method of claim 1, further comprising:
if a third node which is in a normal state is in the abnormal nodes, recombining and pairing the third node and the nodes in the normal state in the plurality of mirror pairs to obtain a recombined mirror pair;
and updating the recombined mirror image pair so that the recombined mirror image pair only contains two nodes.
5. The mirroring method according to claim 1, wherein the process of reorganizing and pairing the node to be reorganized with nodes in a normal state among a plurality of mirror pairs includes:
when the node to be recombined is to be recombined with a fourth node in a normal state in a plurality of mirror pairs, judging whether the cache data in the fourth node is effective cache data or not;
And if so, recombining and pairing the node to be recombined and the fourth node.
6. The mirroring method according to claim 1, wherein the process of reorganizing and pairing the node to be reorganized with nodes in a normal state among a plurality of mirror pairs includes:
if the fifth node in the storage system is always in an online state, determining a mirror image pair where the fifth node is located, and obtaining an original mirror image pair;
and recombining and pairing the nodes to be recombined and the nodes in the normal state in the mirror image pairs according to the principle that the original mirror image pair is kept unchanged.
7. The mirroring method according to claim 1, wherein the process of reorganizing and pairing the node to be reorganized with nodes in a normal state among a plurality of mirror pairs to reorganize a mirror pair comprises:
judging whether nodes with effective cache data exist in the target mirror image pair or not; wherein the target mirror pair is any one of the mirror pairs in the storage system;
and if not, forbidding pairing the node to be recombined and the node in the target mirror image pair.
8. The mirroring method according to any one of claims 1 to 7, wherein after the process of reorganizing the node to be reorganized with nodes in a normal state among a plurality of mirror pairs to reorganize a mirror pair and make each mirror pair of the storage system include only two nodes, the method further comprises:
Judging whether the times of mirroring the cache data in each node in the storage system are equal or not;
if not, recombining and pairing the nodes in the normal state in the plurality of mirror pairs, and executing the step of judging whether the times of mirroring the cache data in each node in the storage system are equal again until the times of mirroring the cache data in each node in the storage system are equal.
9. A mirroring device for caching data, comprising:
the label setting module is used for setting corresponding identification numbers for all nodes in a plurality of cabinets in the storage system and forming target sequences by the identification numbers corresponding to all the nodes;
the mirror image pair generating module is used for mirroring the cache data of the target node to the nodes adjacent to the target node according to the arrangement sequence of the target sequence, and mirroring the cache data of the node corresponding to the tail identification number in the target sequence to the node corresponding to the first identification number in the target sequence so as to obtain a plurality of mirror image pairs with the same number as the nodes in the storage system; the target node is a node corresponding to any one of the other identification numbers except the tail identification number in the target sequence;
The node determining module is used for determining nodes which are subjected to mirror pairing with the abnormal nodes if the abnormal nodes appear in the storage system, so as to obtain nodes to be recombined;
the mirror image pair reorganizing module is used for reorganizing and pairing the nodes to be reorganized and the nodes in the normal state in the plurality of mirror image pairs so as to reorganize the mirror image pairs, and each mirror image pair of the storage system only contains two nodes;
the mirror image pair reconstruction module includes:
the number determining unit is used for recombining and pairing the target node to be recombined with the node in the normal state in the storage system to reconstruct a mirror image pair if the number of the nodes to be recombined is larger than one; the target node to be recombined is any node in the nodes to be recombined;
the node judging unit is used for judging whether each mirror image pair of the storage system contains nodes for effectively caching data or not when the target node to be recombined forms the mirror image pair again;
a third reorganization unit, configured to, when the determination result of the node determination unit is yes, continue to execute the step of reorganizing and pairing the target node to be reorganized and the node in the normal state in the storage system to reorganize the mirror pair until the number of the nodes to be reorganized is zero;
The third recombination unit includes:
the time timing subunit is used for starting timing by using a timer when the target node to be recombined forms the mirror image pair again, and judging whether the timing time of the timer reaches the preset time or not;
a third reorganization subunit, configured to enter the step of continuously executing reorganization pairing between the target node to be reorganized and a node in a normal state in the storage system to reorganize a mirror pair when the determination result of the time counting subunit is yes;
further comprises:
a reorganization prohibiting subunit, configured to prohibit execution of the step of reorganizing and pairing the target node to be reorganized and a node in a normal state in the storage system to reorganize a mirror pair when the determination result of the time counting subunit is no;
further comprises:
the recovery judging unit is configured to, after the process of starting timing by using the timer when the target node to be reorganized reorganizes the mirror pair, further include: judging whether a seventh node which is recovered to normal exists in the storage system or not;
the time judging unit is used for judging whether the timing time of the timer reaches the preset time or not when the judging result of the recovery judging unit is yes;
The first execution unit is used for recombining and pairing the seventh node and nodes in a normal state in a plurality of mirror pairs when the judging result of the time judging unit is yes so as to reconstruct the mirror pair;
and the second execution unit is used for prohibiting the recombination pairing of the seventh node and the nodes in the normal state in the mirror image pairs when the judging result of the time judging unit is NO.
10. A mirroring device for caching data, comprising:
a memory for storing a computer program;
a processor for implementing the steps of a method of mirroring cached data according to any one of claims 1 to 8 when executing said computer program.
11. A computer readable storage medium, characterized in that the computer readable storage medium has stored thereon a computer program which, when executed by a processor, implements the steps of a method of mirroring buffered data according to any of claims 1 to 8.
CN202211433681.1A 2022-11-16 2022-11-16 Mirror image method, device, equipment and medium for cache data Active CN115630003B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211433681.1A CN115630003B (en) 2022-11-16 2022-11-16 Mirror image method, device, equipment and medium for cache data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211433681.1A CN115630003B (en) 2022-11-16 2022-11-16 Mirror image method, device, equipment and medium for cache data

Publications (2)

Publication Number Publication Date
CN115630003A CN115630003A (en) 2023-01-20
CN115630003B true CN115630003B (en) 2023-07-21

Family

ID=84910043

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211433681.1A Active CN115630003B (en) 2022-11-16 2022-11-16 Mirror image method, device, equipment and medium for cache data

Country Status (1)

Country Link
CN (1) CN115630003B (en)

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8862642B1 (en) * 2012-06-29 2014-10-14 Emc Corporation Endurant cache
CN103942252B (en) * 2014-03-17 2017-11-28 华为技术有限公司 A kind of method and system for recovering data
CN104618153B (en) * 2015-01-20 2018-08-03 北京大学 Dynamic fault-tolerant method and system based on P2P in the processing of distributed parallel figure
US9760458B2 (en) * 2015-06-02 2017-09-12 Netapp, Inc. Dynamic mirroring
CN106484333A (en) * 2016-10-18 2017-03-08 郑州云海信息技术有限公司 A kind of memory image method for multiple storage controls

Also Published As

Publication number Publication date
CN115630003A (en) 2023-01-20

Similar Documents

Publication Publication Date Title
US7987158B2 (en) Method, system and article of manufacture for metadata replication and restoration
CN105404469B (en) A kind of storage method and system of video data
US8719220B2 (en) Low traffic failback remote copy
US6785838B2 (en) Method and apparatus for recovering from failure of a mirrored boot device
US7698593B2 (en) Data protection management on a clustered server
RU99127432A (en) METHOD AND SYSTEM OF RESTORING DATABASE INTEGRITY IN A SYSTEM OF SECTED DATABASES WITHOUT SEPARATION OF RESOURCES USING VIRTUAL DISKS OF COLLECTIVE USE
CN104935654A (en) Caching method, write point client and read client in server cluster system
CN113326006B (en) Distributed block storage system based on erasure codes
CN111880956B (en) Data synchronization method and device
CN104486438B (en) The disaster recovery method and device of distributed memory system
CN109491609A (en) A kind of caching data processing method, device, equipment and readable storage medium storing program for executing
CN106325768A (en) Dual storage system and method
CN110096237B (en) Copy processing method, node, storage system, server and readable medium
CN115630003B (en) Mirror image method, device, equipment and medium for cache data
CN115955488B (en) Distributed storage copy cross-machine room placement method and device based on copy redundancy
CN116974489A (en) Data processing method, device and system, electronic equipment and storage medium
CN110309012B (en) Data processing method and device
CN116389233A (en) Container cloud management platform active-standby switching system, method and device and computer equipment
US10168935B2 (en) Maintaining access times in storage systems employing power saving techniques
JP2009265973A (en) Data synchronization system, failure recovery method, and program
CN114003612A (en) Processing method and processing system for abnormal conditions of database
CN108664353A (en) The method, apparatus and replica management server that data are restored
WO2010011217A1 (en) Data storage method, apparatus and system for interrupted write recovery
CN106933700A (en) For the method and apparatus of the data backup between recovering
CN105491101B (en) The treating method and apparatus of data

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant