Mirror recombination method and electronic device

By using a ring node layout and dynamic mirror pairing mechanism, the problems of low efficiency and poor reversibility of mirror reassembly when storage cluster nodes fail are solved, achieving fast and reversible mirror reassembly and load balancing, thus improving the reliability and availability of the system.

CN121597498BActive Publication Date: 2026-05-29INSPUR SUZHOU INTELLIGENT TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
INSPUR SUZHOU INTELLIGENT TECH CO LTD
Filing Date
2026-01-28
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

In existing technologies, storage cluster nodes cannot dynamically adapt to abnormal scenario switching when they fail, resulting in poor reversibility, low image reassembly efficiency, and limited scalability.

Method used

By adopting a ring node layout and dynamic mirror pairing mechanism, offline nodes are identified by detecting the status of cluster nodes, and mirror pairs are dynamically reassembled. The position of mirror pairs is optimized based on the load balancing principle to achieve fast and reversible mirror reassembly.

Benefits of technology

It improves the efficiency of image reassembly of storage clusters when nodes fail or recover, meets load balancing requirements, and ensures data reliability and high system availability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121597498B_ABST
    Figure CN121597498B_ABST
Patent Text Reader

Abstract

The application discloses a mirror image reorganization method and electronic equipment, and relates to the technical field of storage service equipment, and comprises the following steps: identifying a first target node in an offline state based on the current state of at least one cluster node of a target mirror image ring, and determining a first mirror image pair of the first target node; determining a second target node and a third target node of the first mirror image pair according to the first target node and the first mirror image pair; acquiring the load of the second target node and the load of the third target node; and obtaining a mirror image reorganization result of the first mirror image pair according to the load of the second target node and the load of the third target node. The technical problem that the storage cluster node cannot dynamically adapt to abnormal scene switching and reversibility is poor when the storage cluster node fails or recovers is solved. Through the ring node layout and the dynamic mirror image pairing mechanism, automatic optimization and dynamic reorganization are realized when the node in the storage cluster environment fails or recovers, the mirror image pair reorganization efficiency is improved, and the load balancing demand is met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of storage service equipment technology, and in particular to mirror reconstruction methods and electronic devices. Background Technology

[0002] In distributed storage clusters, a dual-replica mirroring strategy is often used to ensure data reliability: the same data is stored in two completely identical copies on two different physical nodes. When either node fails, the other copy can immediately take over the service to avoid data loss.

[0003] In related technologies, a lookup table method is usually used for mirror reassembly: all possible combinations of node failures are enumerated in advance, and a mirror pair reassembly scheme is preset for each scenario. However, this method cannot dynamically adapt to abnormal scenario switching, has poor reversibility, and there may be differences between fault reassembly and reverse recovery reassembly. Its scalability is limited and urgently needs to be solved. Summary of the Invention

[0004] This invention provides a mirror reconstruction method and electronic device to at least solve the problem in related technologies that storage cluster nodes cannot dynamically adapt to abnormal scenario switching and have poor reversibility when they fail or recover.

[0005] This invention provides a mirror reassembly method, comprising: detecting the current state of at least one cluster node of a target mirror ring; based on the current state of the at least one cluster node, identifying a first target node that is offline, determining a first mirror pair corresponding to the first target node, and determining a second target node of the first mirror pair according to the first target node and the first mirror pair, wherein the second target node is online; determining a third target node of the first mirror pair, and obtaining the load of the second target node and the load of the third target node of the first mirror pair, and obtaining the mirror reassembly result of the first mirror pair according to the load of the second target node and the load of the third target node of the first mirror pair.

[0006] The present invention also provides a mirror reconstruction apparatus, comprising:

[0007] The detection module is used to detect the current state of at least one cluster node of the target mirror ring;

[0008] The determination module is used to identify a first target node that is offline based on the current state of the at least one cluster node, determine a first mirror pair corresponding to the first target node, and determine a second target node of the first mirror pair based on the first target node and the first mirror pair, wherein the second target node is online.

[0009] The acquisition module is used to determine the third target node of the first mirror pair, and acquire the load of the second target node and the load of the third target node of the first mirror pair, and obtain the mirror reconstruction result of the first mirror pair based on the load of the second target node and the load of the third target node of the first mirror pair.

[0010] The present invention also provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the processor executing the program to implement the steps of any of the above-described mirror reconstruction methods.

[0011] The present invention also provides a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of any of the above-described image reconstruction methods.

[0012] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of any of the above-described image reconstruction methods.

[0013] This invention identifies an offline first target node based on the current state of at least one cluster node in a target mirror ring, determines a first mirror pair of the first target node, and identifies a second and third target node of the first mirror pair based on the first target node and the first mirror pair. It also obtains the load of the second and third target nodes and, based on their loads, obtains the mirror reassembly result of the first mirror pair. This solves the technical problem of poor reversibility and inability to dynamically adapt to abnormal scenario switching when storage cluster nodes fail or recover. Through a ring node layout and dynamic mirror pairing mechanism, it achieves automatic optimization and dynamic reassembly when nodes fail and recover in the storage cluster environment, improving mirror pair reassembly efficiency and meeting load balancing requirements. Attached Figure Description

[0014] To more clearly illustrate the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0015] Figure 1 This is a schematic flowchart of a mirror reconstruction method provided in an embodiment of the present invention;

[0016] Figure 2 A schematic diagram illustrating device node ID (Identifier) ​​allocation according to an embodiment of the present invention;

[0017] Figure 3 A flowchart illustrating the mirror pair recombination process provided in one embodiment of the present invention;

[0018] Figure 4 A diagram showing the position distribution of the mirror rings provided in one embodiment of the present invention;

[0019] Figure 5 This is a diagram illustrating the sequential online mirror pair reassembly process of nodes according to an embodiment of the present invention.

[0020] Figure 6 A flowchart illustrating the simulation of node failure and node recovery mirror reconstruction is provided in one embodiment of the present invention.

[0021] Figure 7 This is a block diagram of a mirror reconstruction apparatus according to an embodiment of the present invention;

[0022] Figure 8 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present invention. Detailed Implementation

[0023] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of the present invention.

[0024] It should be noted that, in the description of this invention, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. The terms "first," "second," etc., used in this invention are used to distinguish similar objects and are not used to describe a specific order or sequence.

[0025] To enable those skilled in the art to better understand the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0026] Specifically, before introducing the embodiments of the present invention, we will first introduce some limitations of the mirror reconstruction technology in the related art.

[0027] In storage cluster systems, the core function of mirrored replicas is to ensure data security and improve business continuity by creating identical redundant copies of data. It is a data protection strategy that trades space for high reliability. Among them, dual-replica mirroring in a four-node cluster is one of the most commonly used data redundancy strategies. The method is to store two completely identical copies of core data on two different nodes in the cluster, and maintain data consistency through real-time synchronization between the replicas. Its core value lies in the fact that when one copy of any node (or storage medium) in the storage cluster becomes invalid due to hardware failure (such as hard drive failure, server crash), software anomaly (such as file system corruption), or human error (such as accidental deletion), the other complete copy can be directly reused to avoid permanent loss of core data. At this time, the "reassembly" of the mirror pair (dual replica), that is, how to quickly restore the dual-replica redundancy state (ensuring that there are still two usable copies of the data), is the problem that this invention aims to solve.

[0028] In practical applications, when reassembling a faulty mirror pair among surviving nodes in a cluster system, the following requirements must be followed: (1) Ensure the data integrity of the surviving replicas, ensuring that the data before and after reassembly is "not lost, not tampered with, and traceable", and avoid abnormal business data due to reassembly; (2) Ensure the continuity of services, and avoid long-term unavailability of services due to replica switching or synchronization; (3) Meet the load balancing of nodes after reassembly, avoid single-point overload, and ensure the overall performance of the cluster; (4) Ensure fault domain isolation, and avoid the simultaneous loss of both replicas due to the same fault; (8) Automated dynamic reassembly, reducing manual intervention; (6) Reversibility principle, ensuring that the mirror pair restores its original configuration when the node recovers; (7) Ensure compatibility and support elastic expansion; (8) Take performance into account and reduce latency, etc.

[0029] Among related technologies, mirror reassembly technology mainly adopts the "table lookup method". By enumerating possible failure scenarios and pre-setting a reassembly plan, reassembly is completed by looking up the table when a failure occurs. However, the above method cannot be dynamically adjusted when abnormal scenarios change, has poor reversibility and weak scalability (when there are too many cluster nodes, it is impossible to enumerate all scenarios), cannot dynamically adapt to the situation of abnormal scenario switching, has poor reversibility, and there may be differences between fault reassembly and reverse recovery reassembly. Moreover, when the number of cluster nodes increases, the number of failure scenarios increases exponentially, making it difficult to enumerate all of them, and the scalability is significantly limited.

[0030] Therefore, based on the aforementioned problems, the mirror reassembly method adopted in this invention, through a ring node layout and dynamic mirror pairing mechanism, enables rapid dynamic reassembly of mirror pairs in a storage cluster environment when nodes fail and rejoin, reducing excessive intermediate state switching and meeting load balancing requirements. At the same time, the deterministic state transition protocol conforms to the principle of reversibility, the ring topology has strong scalability, and it also satisfies data reliability and strong consistency.

[0031] The embodiments of the present invention provide a mirror reconstruction method, and the method is described in detail in conjunction with the execution flow of the mirror reconstruction method.

[0032] Specifically, Figure 1 This is a schematic flowchart of a mirror reconstruction method provided in an embodiment of the present invention;

[0033] like Figure 1 As shown, the mirror reconstruction method includes the following steps:

[0034] In step S101, the current state of at least one cluster node of the target mirror ring is detected.

[0035] Specifically, the embodiments of the present invention mainly include a mirror ring configuration stage and a dynamic reassembly stage of mirror pairs during device operation. In the mirror ring configuration stage, it is necessary to configure the target node and mirror pair in the target mirror ring so as to perform subsequent dynamic reassembly operations of mirror pairs based on the configured target mirror ring. The following is a detailed description based on the mirror ring configuration stage.

[0036] According to one embodiment of the present invention, before detecting the current state of at least one cluster node of the target mirror ring, the method further includes: configuring the length of the target mirror ring; determining the total number of cluster nodes based on a preset spacing and the length of the target mirror ring, and assigning node identifiers to at least some cluster nodes based on a preset identifier allocation strategy to obtain node identifiers of at least some cluster nodes; and determining the positions of at least some mirror pairs within the target mirror ring based on the node identifiers of at least some cluster nodes.

[0037] According to one embodiment of the present invention, based on a preset identifier allocation strategy, assigning node identifiers to at least a portion of cluster nodes to obtain node identifiers for at least a portion of cluster nodes includes: determining nodes to be assigned identifiers from at least a portion of cluster nodes; determining the node sequence number of the target service device where the node to be assigned identifier is located, the device code of the target service device, and the total number of nodes within the target service device; generating node identifiers for the nodes to be assigned identifiers based on the node sequence number of the target service device, the device code of the target service device, and the total number of nodes within the target service device; determining new nodes to be assigned identifiers from the remaining cluster nodes that have not been assigned node identifiers, and re-executing the steps of determining the node sequence number of the target service device where the node to be assigned identifier is located, the device code of the target service device, and the total number of nodes within the target service device, until node identifiers for at least a portion of cluster nodes are obtained.

[0038] The preset spacing and preset label allocation strategy can be set by those skilled in the art according to the actual mirror ring setting requirements, and are not specifically limited here.

[0039] Specifically, the embodiments of the present invention adopt a ring topology architecture, namely the target mirror ring of the present invention. First, the length L of the target mirror ring is configured and a preset spacing d is taken. Then, the total number n of cluster nodes in the target mirror ring is determined according to the length L of the target mirror ring and the preset spacing d, that is, L=n*d. The cluster nodes in the target mirror ring are evenly distributed in the target mirror ring in a clockwise direction. At the same time, it is necessary to ensure that the set preset spacing d can be quantified and calculated so that the system has symmetry and predictability, and at the same time ensures that the system load is evenly distributed.

[0040] Therefore, based on the target mirror ring length L, the preset spacing d, and the total number of cluster nodes n, we can determine the i-th node (node ​​IDs are counted starting from 0, i∈{0,1,2,…,n) 1) The position P(i) in the target mirror ring can be represented as:

[0041] (1)

[0042] Secondly, each cluster node in the target mirror ring is assigned a node identifier to fix its position within the target mirror ring. To adhere to the fault domain isolation principle and prevent the failure of both the primary and backup nodes of the mirror pair due to a failure of a cluster node within the same service device (e.g., power outage, network switch failure), thus avoiding permanent data loss or prolonged service interruption, this embodiment of the invention employs a cross-assignment principle during node identifier allocation. This ensures that node identifiers within the same service device are not consecutive. For example, ... Figure 2 As shown, the node identifiers in device 1 can be node 0 and node 2, and the node identifiers in device 2 can be node 1 and node 3.

[0043] Specifically, in the target mirror ring, a node to be assigned is determined from at least a portion of the cluster nodes. The node number i of the target service device where the node to be assigned is located, the device code k of the target service device, and the total number of nodes b within the target service device are also determined. A node identifier for the node to be assigned is generated based on the node number i, the device code k, and the total number of nodes b within the target service device. After assigning the node identifier of one node to be assigned, based on the above steps, new nodes to be assigned are determined from the remaining unassigned cluster nodes in the target mirror ring and assigned. Then, the steps of determining the node number i, the device code k, and the total number of nodes b within the target service device are repeated until node identifiers for at least a portion of the cluster nodes are obtained, meaning that node identifiers for all cluster nodes in the target mirror ring have been assigned.

[0044] For example, if an embodiment of the present invention uses a service devices (the service device codes are k=0,1,...,a) 1) Each service device contains b nodes (the node index within the service device is i=0, 1, ..., b). 1) The ID assigned to the i-th node on the k-th service device can be calculated using the following formula:

[0045] (2)

[0046] Furthermore, after the node identifiers are assigned, each cluster node is assigned a fixed position in the mirror ring using formula (1), and at the same time, each mirror pair MP is assigned a fixed position in the mirror ring.

[0047] Specifically, in the target mirror ring of the two replicas, the number of mirror pairs is the same as the number of cluster nodes. Mirror pairs use deterministic path selection, fixing the mirror pairs in the gap between two adjacent cluster nodes on the target mirror ring, forming a complete ring data path. Each mirror pair is associated with its two adjacent cluster nodes, providing a positional reference for subsequent dynamic reassembly of mirror pairs. Fixing the position of the mirror pairs also avoids the complexity of dynamic reassembly. Combining formula (1), given that the number of mirror pairs in the target mirror ring is n, the j-th mirror pair (mirror pair IDs are counted starting from 0, j∈{0,1,2,…,n) is... 1) The position M(j) on the target mirror ring can be represented as:

[0048] (3)

[0049] Substituting formula (1) into formula (3) and simplifying, we get:

[0050] (4)

[0051] Therefore, using the above formula, the positions of at least some mirror pairs (MPs) within the target mirror ring can be determined based on the node identifiers of at least some cluster nodes.

[0052] At this point, the relevant configuration of the target mirror ring is complete. Then, all mirror pairs and cluster nodes in the configured target mirror ring are initialized, so that the cluster nodes are empty. Then, according to the assigned node identifier order, the cluster nodes are added to the target mirror ring one by one. When a new node is added, the mirror pair reassembly operation is triggered. At this time, according to the mirror pair reassembly rules, a master node and a standby node are assigned to each mirror pair, and this step is repeated until all cluster nodes are added to the target mirror ring. At this time, the mirror pair node allocation reaches the optimal state, and after completion, the next step is executed.

[0053] The mirror pair reassembly rules of this invention mainly include three rules: mirror node composition rules, mirror pair master / slave determination rules, and mirror pair reassembly rules. The mirror node composition principle is: (1) A mirror pair is composed of the node before the mirror pair (counterclockwise direction) and the node after the mirror pair (clockwise direction); (2) If a node is offline, the next online node is searched along the direction of the offline node. The mirror pair master / slave determination principle is: (1) If the distance between the mirror pair and the previous node is equal to the distance between the mirror pair and the next node, the previous node of the mirror pair is taken as the master node and the next node of the mirror pair is taken as the slave node. If the distance between the mirror pair and the previous node is not equal to the distance between the mirror pair and the next node, the nearest principle is adopted, that is, the node closer to the mirror pair is the master node and the node farther from the mirror pair is the slave node. In other words, if the mirror pair is offline, the next node is taken as the master node and the next node is taken as the slave node. If the distance between the mirror pair and the previous node is less than the distance between the mirror pair and the next node, then the previous node of the mirror pair is taken as the master node and the next node of the mirror pair is taken as the backup node. In order to ensure data consistency, service continuity and system high availability when the master node fails during operation, the backup node can be switched to in time. The mirror pair reassembly rules are as follows: (1) When the master node of the mirror pair goes offline due to failure, the backup node of the mirror pair is converted into the master node and a new backup node is found for the mirror pair. If the backup node of the mirror pair goes offline due to failure, the master node of the mirror pair remains unchanged and a new backup node is found for the mirror pair. (2) The unaffected mirror pair does not change its node composition, so as to minimize the switching of intermediate states. Therefore, based on the above mirror pair reassembly rules, the aim is to ensure that the mirror reassembly follows the principles of data integrity, service continuity and reversibility.

[0054] Therefore, in the optimal case, mirror pairs The nodes are composed as follows:

[0055] (5)

[0056] Therefore, by configuring the target mirror ring parameters and using a cross-connect strategy based on fault domain isolation to allocate node IDs, a logical ring topology with symmetry, scalability and high reliability can be constructed during the initialization phase. This not only ensures that the primary and backup replicas of any mirror pair are distributed on different physical devices to resist single point of failure, but also provides a deterministic geometric benchmark for subsequent dynamic reassembly, thereby enabling fast, reversible and load-balanced automatic mirror reconstruction when a node fails or recovers.

[0057] According to one embodiment of the present invention, after determining the positions of at least some mirror pairs within the target mirror ring, the method further includes: determining whether a newly added node exists in the target mirror ring; if a newly added node exists in the target mirror ring, determining a second mirror pair of the newly added node, and determining a fourth target node of the second mirror pair based on mirror pair recombination rules, wherein the fourth target node is online; determining a fifth target node of the second mirror pair, and obtaining the load of the fourth target node of the second mirror pair and the load of the fifth target node of the second mirror pair, and obtaining the mirror recombination result of the second mirror pair based on the load of the fourth target node of the second mirror pair and the load of the fifth target node of the second mirror pair.

[0058] Specifically, based on all the mirror pairs and cluster nodes in the target mirror ring that have been configured above, and after initialization, the cluster nodes are added to the target mirror ring one by one according to the assigned node identifier order.

[0059] Specifically, when a new node is added to the target mirror ring, a mirror pair reassembly operation is triggered. This determines the second mirror pair of the newly added node, which consists of the mirror pairs on either side of the new node. At this point, a mirror pair reassembly operation is performed based on the new node. Based on the mirror pair reassembly rules, the fourth and fifth target nodes of the second mirror pair are determined. The fourth target node of the second mirror pair can be the newly added node or another online target node found for the second mirror pair based on the mirror pair reassembly rules. Similarly, the fifth target node can be the newly added node or another online target node found for the second mirror pair based on the mirror pair reassembly rules. The target nodes, where the primary / standby status of the fourth and fifth target nodes can be determined based on the primary / standby determination rules of the mirror pair. For example, if the first target node of the second mirror pair is the fourth target node, the second target node of the second mirror pair is the fifth target node, and the distance between the second mirror pair and the fourth target node is equal to the distance between the second mirror pair and the fifth target node, then the fourth target node is the primary node of the second mirror pair, and the fifth target node is the standby node of the second mirror pair. This step is repeated until all nodes are added to the target mirror ring. At this point, the node allocation of all mirror pairs in the target mirror ring has reached the optimal state, and then the subsequent load judgment continues.

[0060] Furthermore, in order to meet the load balancing of the entire target mirror ring, this embodiment of the invention needs to detect the load status of each node after mirror reassembly. If each node meets the load requirements, the mirror pair reassembly is determined to be complete; otherwise, the mirror pair reassembly is determined to have failed.

[0061] Specifically, the total number of mirror pairs N and the total number of online nodes M of the target mirror ring are obtained. Then, the ratio of the total number of mirror pairs N to the total number of online nodes M is calculated. The load of the fourth target node of the second mirror pair and the load of the fifth target node of the second mirror pair are obtained. The difference between the load of the fourth target node and the load of the fifth target node of the second mirror pair is calculated. Then, based on the ratio and the difference, it is determined that the second mirror pair has completed the reorganization when it meets the preset reorganization conditions, that is, when the total number of mirror pairs N, the total number of online nodes M, and the loads of the fourth and fifth target nodes satisfy the preset reorganization conditions of the following formulas (6) and (7), the load F(i) of the i-th online node should satisfy the following conditions:

[0062] (6)

[0063] (7)

[0064] In other words, when determining whether the loads of the fourth and fifth target nodes meet the preset reorganization conditions, it is necessary to determine the load of the fourth target node. Is it less than or equal to the ratio, and what is the load of the fifth target node? Is it less than or equal to the ratio, and what is the load of the fourth target node? Load of the fifth target node Whether the absolute value of the difference is less than or equal to a preset threshold (e.g., 1), if the load of the fourth target node... Less than or equal to the ratio, and the load of the fifth target node. If the ratio is less than or equal to the value of the second mirror pair and the absolute value of the difference is less than or equal to 1, it means that the second mirror pair meets the preset reassembly conditions, that is, the second mirror pair meets the above load balancing detection rules. At this time, it can be determined that the second mirror pair has completed reassembly, and the cluster is notified that the second mirror pair has completed reassembly, and the reassembly operation of the next mirror pair continues. Otherwise, it is determined that the second mirror pair does not meet the preset reassembly conditions.

[0065] Furthermore, if the second mirror pair does not meet the preset reorganization conditions, the target node of the second mirror pair can be searched again and the load of the target node can be recalculated. If the load of the target node after recalculation still does not meet the preset reorganization conditions, the service device where the second mirror pair is located is restarted, and the step of configuring the length of the target mirror ring is re-executed. The method of searching for the target node of the second mirror pair and recalculating the load of the target node is the same as the method of searching for nodes and calculating load described above. To avoid redundancy, it will not be described in detail here.

[0066] Therefore, after determining the fixed position of the mirror pair within the target mirror ring, when a new node joins the cluster, the system can dynamically search for the nearest online node along a preset direction based on the ring topology, and perform precise and localized reorganization of the mirror pairs affected by that node according to the distance priority principle, effectively ensuring load balancing, fault domain isolation and high system availability.

[0067] After the entire target mirror ring configuration has been completed, and the target mirror ring has successfully added new nodes and performed relevant load and reassembly rule determinations, during cluster operation, the current status of each cluster node is further detected, such as the offline status or the restored online status of each cluster node, so as to perform corresponding mirror pair reassembly operations based on the current status of the cluster nodes.

[0068] In step S102, based on the current state of at least one cluster node, a first target node that is offline is identified, and a first mirror pair corresponding to the first target node is determined. Then, a second target node of the first mirror pair is determined based on the first target node and the first mirror pair. The second target node is online.

[0069] Specifically, if at least one cluster node in the target mirror ring is found to be offline, it indicates that the first target node has gone offline due to a fault, and a mirror pair reassembly operation needs to be triggered for the first mirror pair affected by the offline status of the first target node.

[0070] In this context, the first target node can be either a primary node or a backup node. When the first target node is offline, it is necessary to determine the first mirror pair corresponding to the first target node, and then determine the second target node of the online first mirror pair based on the first target node and the first mirror pair. This second target node can be either a primary node or a backup node. For example, if the first target node is the primary node of the first mirror and the second target node is the backup node of the first mirror, when the first target node is offline, the second target node is converted into the primary node of the first mirror based on the mirror pair reorganization rules, and another new online target node is found for the first mirror pair, which is the newly assigned node for the first mirror pair. If the first target node is the backup node of the first mirror and the second target node is the primary node of the first mirror, when the first target node is offline, the primary node of the first mirror remains unchanged, and then another new online target node is found for the first mirror pair based on the mirror pair reorganization rules, which is the newly assigned node for the first mirror pair.

[0071] In step S103, the third target node of the first mirror pair is determined, and the load of the second target node and the load of the third target node of the first mirror pair are obtained. The mirror reconstruction result of the first mirror pair is obtained based on the load of the second target node and the load of the third target node of the first mirror pair.

[0072] According to one embodiment of the present invention, obtaining the mirror reassembly result of the first mirror pair based on the load of the second target node of the first mirror pair and the load of the third target node of the first mirror pair includes: obtaining the total number of mirror pairs and the total number of online nodes of the target mirror ring; calculating the ratio of the total number of mirror pairs to the total number of online nodes, and calculating a first difference between the load of the second target node of the first mirror pair and the load of the third target node of the first mirror pair; and determining that the first mirror pair has completed reassembly if the first mirror pair meets the preset reassembly conditions based on the ratio and the first difference.

[0073] According to one embodiment of the present invention, after calculating the first difference between the load of the second target node of the first mirror pair and the load of the third target node of the first mirror pair, the method further includes: determining whether the load of the second target node of the first mirror pair is less than the ratio, whether the load of the third target node of the first mirror pair is less than the ratio, and whether the first difference is less than or equal to a preset threshold; if the load of the second target node of the first mirror pair is less than the ratio, and the load of the third target node of the first mirror pair is less than the ratio, and the first difference is less than or equal to the preset threshold, then the first mirror pair is determined to meet the preset recombination condition; otherwise, the first mirror pair is determined to not meet the preset recombination condition.

[0074] Specifically, in this embodiment of the invention, after identifying that the first target node is offline, a new online target node is found for the first mirror pair based on the mirror pair reassembly rules. This new online target node can be the second target node of the first mirror pair, and the node previously selected by the first mirror pair can be the third target node. Then, after determining the second and third target nodes of the first mirror pair, in order to satisfy the load balancing of the entire target mirror ring, it is also necessary to calculate the load of the second target node and the load of the third target node of the first mirror pair and detect the load of each node. If each node meets the preset reassembly conditions, that is, the load requirements are met, then the mirror pair reassembly is determined to be completed; otherwise, the mirror pair reassembly is determined to be failed.

[0075] Specifically, first, the ratio of the total number of mirror pairs N to the total number of online nodes M is calculated, and then the load of the second target node of the first mirror pair is calculated. The load of the third target node of the first mirror pair The first difference between them; secondly, the absolute value of the comparison value and the first difference is used to determine if the load of the second target node is... The load of the third target node is less than or equal to the ratio. If the first mirror pair meets the preset reassembly conditions, i.e., the first mirror pair satisfies the above load balancing detection rules, it can be determined that the first mirror pair has completed reassembly, and the cluster is notified that the first mirror pair has completed reassembly, and the reassembly operation of the next mirror pair continues. Otherwise, it is determined that the first mirror pair does not meet the preset reassembly conditions. The specific load calculation rules have been explained in detail above, and will not be elaborated here to avoid redundancy.

[0076] Therefore, by calculating the primary and backup loads for the nodes on both sides of the mirror pair and verifying whether the difference meets the preset reassembly conditions, it is possible to effectively avoid individual nodes bearing excessive read / write or synchronization pressure due to mirror reassembly, ensuring balanced resource utilization and stable performance of each node in the cluster, preventing secondary failures caused by hotspot bottlenecks, and improving overall service reliability and hardware utilization.

[0077] According to one embodiment of the present invention, after determining that the first mirror pair does not meet the preset recombination conditions, the method further includes: obtaining the cumulative number of times the first mirror pair does not meet the preset recombination conditions; if the cumulative number is less than the preset number, determining a new second target node and a new third target node for the first mirror pair, and obtaining the load of the new second target node and the load of the new third target node; calculating a second difference between the load of the new second target node and the load of the new third target node, and obtaining the mirror recombination result of the first mirror pair based on the ratio and the second difference, according to the load of the new second target node and the load of the new third target node.

[0078] Specifically, if the first mirror pair does not meet the preset reorganization conditions, the target node of the first mirror pair can be re-found and its load recalculated. If the cumulative number of recalculations reaches two, and the load of the recalculated target node meets the preset reorganization conditions, a new second target node and a new third target node for the first mirror pair are determined based on the mirror pair reorganization rules. The loads of the new second target node and the new third target node are obtained, and then a second difference is calculated between their loads. If the load of the new second target node... The load of the new third target node is less than or equal to the ratio. If the ratio is less than or equal to the first mirror pair and the absolute value of the second difference is less than or equal to 1, it means that the first mirror pair meets the preset reassembly conditions, that is, the first mirror pair satisfies the above load balancing detection rules. At this time, it can be determined that the first mirror pair has completed reassembly, and the cluster is notified that the first mirror pair has completed reassembly, and the reassembly operation of the next mirror pair continues.

[0079] Therefore, after determining that the load of the nodes on both sides of the first mirror pair does not meet the preset reorganization conditions, the risk of load imbalance can be dynamically avoided by finding new candidate nodes and performing load calculation and secondary determination. This ensures that the reorganization result achieves balanced resource allocation while guaranteeing data redundancy, thereby improving system stability and service reliability.

[0080] According to one embodiment of the present invention, after obtaining the cumulative number of times that the first image pair does not meet the preset reassembly conditions, the method further includes: if the cumulative number is greater than or equal to the preset number, restarting the service device where the first image pair is located, and re-executing the step of configuring the length of the target image ring.

[0081] Specifically, if the load of the recalculated target node still does not meet the preset reorganization conditions, that is, the load of the new second target node... Greater than the ratio, or the load of the new third target node. Greater than the ratio, or the load of the new second target node. and the load of the new third target node If the absolute value of the second difference between them is greater than 1, then the service device where the first mirror pair is located is restarted, and the step of configuring the length of the target mirror ring is re-executed. In this process, the target node of the first mirror pair is re-found and the load of the target node is recalculated in accordance with the node finding rules mentioned above. To avoid redundancy, this will not be described in detail here.

[0082] Therefore, when the second determination still does not meet the preset reorganization conditions, restarting the reorganization process can trigger a wider range of node reselection or system-level coordination mechanisms, avoiding getting trapped in local suboptimal solutions and enhancing the robustness and self-healing ability of the system.

[0083] According to one embodiment of the present invention, after identifying the first target node in an offline state, the method further includes: determining whether the first target node has recovered to an online state; if the first target node has recovered to an online state, determining the first target node as a newly recovered online node, and determining the third mirror pair of the newly recovered online node, and determining the sixth target node of the third mirror pair based on the mirror pair recombination rules, wherein the sixth target node is in an online state; determining the seventh target node of the third mirror pair, and obtaining the load of the sixth target node and the load of the seventh target node of the third mirror pair, and obtaining the mirror recombination result of the third mirror pair based on the load of the sixth target node and the load of the seventh target node of the third mirror pair.

[0084] Specifically, during cluster operation, if an offline node returns to online status and rejoins the target mirror ring, the forward or backward nodes of that mirror pair will also change. In this case, for the changed mirror pairs, it is still necessary to perform a reorganization operation on the affected mirror pairs based on the mirror pair reorganization rules, and reallocate new mirror nodes to the affected mirror pairs.

[0085] Specifically, if the offline first target node returns to online status, it is determined as the newly restored online node, and a third mirror pair is identified. This third mirror pair consists of the mirror pairs on either side of the newly restored online node. Then, based on the mirror pair recombination rules, the newly restored online node of the third mirror pair, i.e., the sixth target node, is determined, as well as the seventh target node of the third mirror pair. The seventh target node is the online target node previously searched by the third mirror pair. Finally, the loads of the sixth and seventh target nodes of the third mirror pair are obtained, and the mirror recombination result of the third mirror pair is obtained based on their loads. That is, the load of the sixth target node is determined. The load of the seventh target node is less than or equal to the ratio. If the ratio is less than or equal to the value of the third mirror pair and the absolute value of the difference is less than or equal to 1, it means that the third mirror pair meets the preset reassembly conditions, that is, the third mirror pair satisfies the above load balancing detection rules. At this time, it can be determined that the third mirror pair has completed the reassembly, and the cluster is notified that the third mirror pair has completed the reassembly, and the reassembly operation of the next mirror pair continues.

[0086] Therefore, after the offline node comes back online, the mirror pairing can be automatically reconstructed based on the mirror pair reassembly rules, which can accurately restore the optimal master-slave layout, realize the reversibility of fault recovery and load balancing, and effectively improve the system's high availability, data consistency and self-healing capabilities.

[0087] Furthermore, such as Figure 3 As shown, to facilitate a clearer understanding of the present invention by those skilled in the art, a detailed description will be provided below with reference to a specific embodiment:

[0088] (1) Initialize the mirror ring parameters, set the distance between nodes d to 10, the number of nodes n to 4, and configure the mirror ring length L to 40. After completion, proceed to the next step;

[0089] (2) such as Figure 2As shown, according to formula (2), node identifiers are assigned to the four nodes of device 1 and device 2. The two node identifiers of device 1 are 0 and 2, and the two node identifiers of device 2 are 1 and 3. Then, according to formula (1), each node is assigned a fixed position in the target mirror ring. The positions of nodes 0, 1, 2, and 3 in the target mirror ring are 0, 10, 20, and 30, respectively. After completion, proceed to the next step.

[0090] (3) such as Figure 4 As shown, mirror pairs MP0, MP1, MP2, and MP3 are allocated and initialized. According to formula (3), fixed positions of 5, 15, 25, and 35 are assigned to the above mirror pairs in the target mirror ring. After the position allocation is completed, the forward and backward nodes of each mirror pair are initialized to be empty. After the operation is completed, the next step is executed.

[0091] (4) Create a cluster, such as Figure 5 As shown, nodes are added to the cluster one by one according to their node identifiers. Node 0 is added first, triggering the mirror pair reassembly operation. Based on the mirror pair reassembly rules, a master node and a backup node are assigned to each mirror pair. At this point, the node composition of mirror pairs MP0, MP1, MP2, and MP3 is as follows: Figure 4 As shown, after node 0 comes online, it can be represented as MP0(0,0), MP1(0,0), MP2(0,0), and MP3(0,0). After completion, proceed to the next step.

[0092] (5) Node 1 joins the cluster and performs the same mirror pair reassembly operation as (4). A master node and a backup node are assigned to each mirror pair. At this time, mirror pair MP0 changes from (0,0) to (0,1), MP1 changes from (0,0) to (1,0), MP2 changes from (0,0) to (1,0), and MP3 changes from (0,0) to (0,1). After completion, the next operation is performed.

[0093] (6) Node 2 joins the cluster and performs the same mirror pair reorganization operation as (4). Mirror pair MP0 is already in the optimal state and is therefore unaffected. A master node and a backup node are assigned to the affected mirror pairs. At this time, mirror pair MP1 changes from (1,0) to (1,2), MP2 changes from (1,0) to (2,0), and MP3 changes from (0,1) to (0,2). After completion, the next operation is performed.

[0094] (7) Node 3 joins the cluster and performs the same mirror pair reassembly operation as (4). Mirror pairs MP0 and MPP1 are already in the optimal state and are therefore unaffected. A master node and a backup node are assigned to the affected mirror pairs. At this time, mirror pair MP2 changes from (2,0) to (2,3) and MP3 changes from (0,2) to (3,0). After the operation is completed, the mirror pair reassembly is completed and the next operation is performed.

[0095] (8) Check the load of each node. According to the formula (6) and formula (7), the primary load and backup load of all nodes are 1, and the absolute value of the difference between the primary and backup loads is 0. The mirror system meets the load requirements. Notify the cluster that the mirror reassembly is complete and execute the next operation.

[0096] like Figure 6 As shown below, the simulation of node failure and image reassembly during node recovery during cluster operation is as follows:

[0097] (9) During cluster operation, if node 1 fails and goes offline, the backward node of mirror pair MP0 and the forward node of mirror pair MP1 will change. Therefore, the same mirror pair reassembly operation as (4) will be performed. MP0 will be updated from (0,1) to (0,2) and MP1 will be updated from (1,2) to (2,0). After completion, the next step will be executed.

[0098] (10) Check the load of each online node and calculate the load values ​​of each online node as follows: the primary load of node 0 is 1, the backup load is 2, and the difference is 1; the primary load of node 2 is 2, the backup load is 1, and the difference is 1; the primary load of node 3 is 1, the backup load is 1, and the difference is 0. Therefore, the image system meets the load requirements. Notify the cluster that the image reassembly is complete and proceed to the next step.

[0099] (11) During cluster operation, if node 2 also fails and goes offline, the optimal member nodes of the mirror pair MP0, MP1, and MP2 will change. Therefore, the same mirror pair reassembly operation as in (4) will be performed. MP0 will be updated from (0,2) to (0,3), MP1 will be updated from (2,0) to (0,3), and MP2 will be updated from (2,3) to (3,0). After completion, the next step will be executed.

[0100] (12) Check the load of each online node and calculate the load values ​​of each online node as follows: the primary load of node 0 is 2, the backup load is 2, and the difference is 0; the primary load of node 3 is 2, the backup load is 2, and the difference is 0. Therefore, the image system meets the load requirements. Notify the cluster that the image reassembly is complete and proceed to the next step.

[0101] (13) During cluster operation, if node 1 recovers and rejoins the cluster, the optimal member node of the mirror pair MP0, MP1, and MP2 changes. Therefore, the same mirror pair reorganization operation as in (4) is executed. MP0 is updated from (0,3) to (0,1), MP1 is updated from (0,3) to (1,3), and MP2 is updated from (3,0) to (3,1). After completion, the next step is executed.

[0102] (14) Check the load of each online node and calculate the load values ​​of each online node as follows: the primary load of node 0 is 1, the backup load is 1, and the difference is 0; the primary load of node 1 is 1, the backup load is 2, and the difference is 1; the primary load of node 3 is 2, the backup load is 1, and the difference is 1. Therefore, the image system meets the load requirements. Notify the cluster that the image reassembly is complete and proceed to the next step.

[0103] (15) During cluster operation, if node 2 also recovers and rejoins the cluster, the backward nodes of the mirror pair MP1 and the forward nodes of MP2 change. Therefore, the same mirror pair reassembly operation as in step four is performed. MP1 is updated from (1,3) to (1,2), and MP2 is updated from (3,1) to (2,3). After completion, proceed to the next step.

[0104] (16) Check the load status of each online node. Calculate the load value of each online node according to formulas (6) and (7). The primary and backup loads of all nodes are 1, and the absolute difference between the primary and backup loads is 0. The mirror system meets the load requirements. Therefore, the mirror system meets the load requirements. Notify the cluster that the mirror reassembly is complete.

[0105] Therefore, this invention, through a ring node layout and dynamic mirror pairing mechanism, enables rapid dynamic reassembly of mirror pairs when a node fails and rejoins after recovery. The method is more efficient, has strong reversibility, and meets the requirements of load balancing, strong data consistency, and service continuity. At the same time, it has strong scalability and provides reliable technical support for dual-replica mirror systems under more node clusters.

[0106] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method.

[0107] Embodiments of the present invention also provide a mirror reconstruction apparatus.

[0108] Figure 7 This is a block diagram of a mirror reconstruction device according to an embodiment of the present invention.

[0109] like Figure 7 As shown, the mirror reconstruction device 10 includes: a detection module 100, a determination module 200, and an acquisition module 300.

[0110] The detection module 100 is used to detect the current state of at least one cluster node of the target mirror ring.

[0111] The determination module 200 is used to identify a first target node that is offline based on the current state of at least one cluster node, determine a first mirror pair corresponding to the first target node, and determine a second target node of the first mirror pair based on the first target node and the first mirror pair, wherein the second target node is online.

[0112] The acquisition module 300 is used to determine the third target node of the first mirror pair, and to acquire the load of the second target node and the load of the third target node of the first mirror pair, and to obtain the mirror reconstruction result of the first mirror pair based on the load of the second target node and the load of the third target node of the first mirror pair.

[0113] According to one embodiment of the present invention, the acquisition module 300 includes:

[0114] The acquisition unit is used to obtain the total number of mirror pairs and the total number of online nodes of the target mirror ring;

[0115] The calculation unit is used to calculate the ratio of the total number of mirror pairs to the total number of online nodes, and to calculate the first difference between the load of the second target node of the first mirror pair and the load of the third target node of the first mirror pair.

[0116] The determination unit is used to determine that the first mirror pair has completed recombination if the first mirror pair meets the preset recombination conditions based on the ratio and the first difference.

[0117] According to one embodiment of the present invention, after calculating a first difference between the load of the second target node of the first mirror pair and the load of the third target node of the first mirror pair, the calculation unit further includes:

[0118] The judgment subunit is used to determine whether the load of the second target node of the first mirror pair is less than the ratio, whether the load of the third target node of the first mirror pair is less than the ratio, and whether the first difference is less than or equal to a preset threshold.

[0119] The determination subunit is used to determine that the first mirror pair meets the preset recombination conditions if the load of the second target node of the first mirror pair is less than the ratio, the load of the third target node of the first mirror pair is less than the ratio, and the first difference is less than or equal to a preset threshold; otherwise, it determines that the first mirror pair does not meet the preset recombination conditions.

[0120] According to an embodiment of the present invention, after determining that the first mirror pair does not meet the preset recombination conditions, the determination subunit further includes:

[0121] The first acquisition component is used to acquire the cumulative number of times that the first image pair does not meet the preset recombination conditions;

[0122] If the cumulative number of acquisitions is less than the preset number, then a new second target node and a new third target node of the first mirror pair are determined, and the load of the new second target node and the load of the new third target node are acquired.

[0123] The third acquisition component calculates the second difference between the load of the new second target node and the load of the new third target node, and based on the ratio and the second difference, obtains the mirror reassembly result of the first mirror pair according to the load of the new second target node and the load of the new third target node.

[0124] According to an embodiment of the present invention, after obtaining the cumulative number of times that the first image pair does not meet the preset recombination conditions, the first obtaining element further includes:

[0125] The configuration sub-component is used to restart the service device where the first mirror pair is located and re-execute the step of configuring the length of the target mirror ring if the cumulative number of times is greater than or equal to the preset number of times.

[0126] According to one embodiment of the present invention, before detecting the current state of at least one cluster node of the target mirror ring, the detection module 100 further includes:

[0127] Configuration unit, used to configure the length of the target mirror ring;

[0128] The allocation unit is used to determine the total number of cluster nodes based on a preset interval and the length of the target mirror ring, and to allocate node identifiers to at least some cluster nodes based on a preset identifier allocation strategy to obtain node identifiers for at least some cluster nodes.

[0129] The first determining unit is used to determine the positions of at least a portion of the mirror pairs within the target mirror ring based on the node identifiers of at least a portion of the cluster nodes.

[0130] According to one embodiment of the present invention, the allocation unit includes:

[0131] The first determining subunit is used to determine the identifier node to be assigned from at least a portion of the cluster nodes;

[0132] The second determining subunit is used to determine the node sequence number of the target service device where the identifier node to be assigned is located, the device code of the target service device, and the total number of nodes in the target service device;

[0133] The generation subunit is used to generate the node identifier of the node to be assigned based on the node sequence number of the target service device, the device code of the target service device, and the total number of nodes in the target service device;

[0134] The third determining subunit is used to determine new nodes to be assigned identifiers from the remaining cluster nodes that have not been assigned node identifiers, and to re-execute the steps of determining the node sequence number of the target service device where the node to be assigned identifier is located, the device code of the target service device, and the total number of nodes in the target service device, until the node identifiers of at least some cluster nodes are obtained.

[0135] According to an embodiment of the present invention, after determining the positions of at least a portion of the mirror pairs within the target mirror ring, the determining unit further includes:

[0136] The judgment sub-unit is used to determine whether a new node has been added to the target mirror ring;

[0137] The fourth determining subunit is used to determine the second mirror pair of the newly added node if there is a newly added node in the target mirror ring, and to determine the fourth target node of the second mirror pair based on the mirror pair recombination rules. The fourth target node is in an online state.

[0138] The fifth determining subunit is used to determine the fifth target node of the second mirror pair, and to obtain the load of the fourth target node of the second mirror pair and the load of the fifth target node of the second mirror pair, and to obtain the mirror recombination result of the second mirror pair based on the load of the fourth target node of the second mirror pair and the load of the fifth target node of the second mirror pair.

[0139] According to one embodiment of the present invention, after identifying a first target node that is offline, the determining module 200 further includes:

[0140] The judgment unit is used to determine whether the first target node has returned to an online state;

[0141] The second determining unit is used to determine that if the first target node recovers to the online state, the first target node is a newly recovered online node, and the third mirror pair of the newly recovered online node is determined. Based on the mirror pair recombination rules, the sixth target node of the third mirror pair is determined, and the sixth target node is in the online state.

[0142] The third determining unit is used to determine the seventh target node of the third mirror pair, and obtain the load of the sixth target node and the load of the seventh target node of the third mirror pair, and obtain the mirror recombination result of the third mirror pair based on the load of the sixth target node and the load of the seventh target node of the third mirror pair.

[0143] In summary, the descriptions of the features in the embodiments corresponding to the mirror reconstruction apparatus can be found in the relevant descriptions of the embodiments corresponding to the mirror reconstruction method, and will not be repeated here.

[0144] Embodiments of the present invention also provide an electronic device, which may include:

[0145] The memory 801, the processor 802, and the computer program stored on the memory 801 and capable of running on the processor 802.

[0146] When the processor 802 executes the program, it implements the image reconstruction method provided in the above embodiments.

[0147] Furthermore, electronic devices also include:

[0148] Communication interface 803 is used for communication between memory 801 and processor 802.

[0149] The memory 801 is used to store computer programs that can run on the processor 802.

[0150] The memory 801 may include high-speed RAM memory, and may also include non-volatile memory, such as at least one disk storage device.

[0151] If the memory 801, processor 802, and communication interface 803 are implemented independently, then the communication interface 803, memory 801, and processor 802 can be interconnected via a bus to complete communication between them. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized into address buses, data buses, control buses, etc. For ease of representation, Figure 8 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.

[0152] Optionally, in a specific implementation, if the memory 801, processor 802, and communication interface 803 are integrated on a single chip, then the memory 801, processor 802, and communication interface 803 can communicate with each other through an internal interface.

[0153] The processor 802 may be a central processing unit (CPU), an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement embodiments of the present invention.

[0154] Embodiments of the present invention also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above-described embodiments of the image reconstruction method when it is run.

[0155] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.

[0156] Embodiments of the present invention also provide a computer program product, which includes a computer program that, when executed by a processor, implements the steps in any of the above-described image reconstruction method embodiments.

[0157] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0158] The mirror reconstruction method provided by this invention has been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this invention. The descriptions of the embodiments above are only for the purpose of helping to understand the method and core ideas of this invention. It should be noted that those skilled in the art can make several improvements and modifications to this invention without departing from the principles of this invention, and these improvements and modifications also fall within the protection scope of the claims of this invention.

Claims

1. A mirror reconstruction method, characterized in that, include: Detect the current state of at least one cluster node in the target mirror ring; Based on the current state of the at least one cluster node, identify a first target node that is offline, determine a first mirror pair corresponding to the first target node, and determine a second target node of the first mirror pair based on the first target node and the first mirror pair, wherein the second target node is online. Determine the third target node of the first mirror pair, and obtain the load of the second target node and the load of the third target node of the first mirror pair. Based on the load of the second target node and the load of the third target node of the first mirror pair, obtain the mirror reassembly result of the first mirror pair. Before detecting the current state of at least one cluster node of the target mirror ring, the method further includes: configuring the length of the target mirror ring; determining the total number of cluster nodes based on a preset spacing and the length of the target mirror ring, and assigning node identifiers to at least some cluster nodes based on a preset identifier allocation strategy to obtain node identifiers for at least some cluster nodes; and determining the positions of at least some mirror pairs within the target mirror ring based on the node identifiers of the at least some cluster nodes.

2. The mirror reconstruction method according to claim 1, characterized in that, The step of obtaining the mirror reassembly result of the first mirror pair based on the load of the second target node and the load of the third target node of the first mirror pair includes: Obtain the total number of mirror pairs and the total number of online nodes of the target mirror ring; Calculate the ratio of the total number of mirror pairs to the total number of online nodes, and calculate the first difference between the load of the second target node of the first mirror pair and the load of the third target node of the first mirror pair; If the first mirror pair meets the preset recombination conditions based on the ratio and the first difference, the first mirror pair is determined to have completed recombination.

3. The mirror reconstruction method according to claim 2, characterized in that, After calculating the first difference between the load of the second target node of the first mirror pair and the load of the third target node of the first mirror pair, the method further includes: Determine whether the load of the second target node of the first mirror pair is less than the ratio, whether the load of the third target node of the first mirror pair is less than the ratio, and whether the first difference is less than or equal to a preset threshold. If the load of the second target node of the first mirror pair is less than the ratio, and the load of the third target node of the first mirror pair is less than the ratio, and the first difference is less than or equal to the preset threshold, then the first mirror pair is determined to meet the preset recombination condition; otherwise, the first mirror pair is determined not to meet the preset recombination condition.

4. The mirror reconstruction method according to claim 3, characterized in that, After determining that the first mirror pair does not meet the preset recombination conditions, the process also includes: Obtain the cumulative number of times the first image pair does not meet the preset recombination conditions; If the cumulative number of times is less than the preset number of times, then a new second target node and a new third target node of the first mirror pair are determined, and the load of the new second target node and the load of the new third target node are obtained; Calculate a second difference between the load of the new second target node and the load of the new third target node, and based on the ratio and the second difference, obtain the mirror reassembly result of the first mirror pair according to the load of the new second target node and the load of the new third target node.

5. The mirror reconstruction method according to claim 4, characterized in that, After obtaining the cumulative number of times the first image pair does not meet the preset recombination conditions, the method further includes: If the cumulative number of times is greater than or equal to the preset number of times, then restart the service device where the first mirror pair is located, and re-execute the step of configuring the length of the target mirror ring.

6. The mirror reconstruction method according to claim 1, characterized in that, The method of assigning node identifiers to at least a portion of the cluster nodes based on a preset identifier allocation strategy to obtain node identifiers for at least a portion of the cluster nodes includes: Determine the identifier node to be assigned from at least a portion of the cluster nodes; Determine the node sequence number of the target service device where the identifier node to be assigned is located, the device code of the target service device, and the total number of nodes in the target service device; The node identifier of the node to be assigned is generated based on the node sequence number of the target service device, the device code of the target service device, and the total number of nodes in the target service device; A new node to be assigned an identifier is determined from the remaining cluster nodes that have not been assigned an identifier, and the steps of determining the node sequence number of the target service device where the node to be assigned an identifier is located, the device code of the target service device, and the total number of nodes in the target service device are re-executed until the node identifiers of at least some of the cluster nodes are obtained.

7. The mirror reconstruction method according to claim 1, characterized in that, After determining the positions of at least a portion of the mirror pairs within the target mirror ring, the method further includes: Determine whether a new node has been added to the target mirror ring; If the newly added node exists in the target mirror ring, determine the second mirror pair of the newly added node, and based on the mirror pair recombination rules, determine the fourth target node of the second mirror pair, wherein the fourth target node is in an online state; The fifth target node of the second mirror pair is determined, and the load of the fourth target node and the fifth target node of the second mirror pair are obtained. The mirror reconstruction result of the second mirror pair is obtained based on the load of the fourth target node and the load of the fifth target node of the second mirror pair.

8. The mirror reconstruction method according to claim 1, characterized in that, After identifying the first target node that is offline, the process also includes: Determine whether the first target node has returned to online status; If the first target node recovers to the online state, the first target node is determined to be a newly recovered online node, and the third mirror pair of the newly recovered online node is determined. Based on the mirror pair recombination rules, the sixth target node of the third mirror pair is determined, and the sixth target node is in the online state. The seventh target node of the third mirror pair is determined, and the load of the sixth target node and the seventh target node of the third mirror pair are obtained. The mirror reassembly result of the third mirror pair is obtained based on the load of the sixth target node and the seventh target node of the third mirror pair.

9. An electronic device, characterized in that, include: A memory, a processor, and a computer program stored in the memory and executable on the processor, the processor executing the program to implement the steps of the mirror reconstruction method as described in any one of claims 1 to 8.