A method, device and equipment for processing brain split of distributed replication block device
By detecting the generation identifier tuple consistency status of distributed replication block devices, determining the master-slave role relationship and rebuilding the synchronization mechanism, the data loss and artificial dependence problems of the split brain automatic recovery strategy in the existing technology are solved, and rapid automatic recovery is achieved.
Patent Information
- Application Number
- CN202210753317.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-29
- Publication Date
- 2025-09-02
- Estimated Expiration
- 2042-06-29
AI Technical Summary
The existing distributed replication block device's split brain automatic recovery strategy poses a risk of data loss when determining the role of master and slave device and requires manual intervention, limiting its application scenarios.
By detecting the consistency status of the generation identifier tuple of the distributed replication block device, the master-slave role relationship is determined, and the synchronization mechanism is rebuilt based on this to achieve automatic recovery.
Reliance on manual intervention is reduced, the brain split problem of distributed replication block devices is quickly solved, and the application scenario of automatic recovery is expanded.
Smart Images

Figure CN115048246B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of storage technology, and in particular to a method, apparatus, device, and computer-readable storage medium for processing a distributed replicated block device split-brain. Background Art
[0002] Distributed Replicated Block Device (DRBD) technology is a TCP / IP-based distributed block replication storage solution. By virtualizing distributed replicated block device resources for block devices (such as hard disks, partitions, logical volumes, etc.), and configuring synchronous or asynchronous replication modes, it achieves real-time mirroring of block devices on the primary and backup nodes. Based on the heartbeat + distributed replicated block device high availability technology, it is widely used in storage system remote replication solutions.
[0003] However, since distributed replicated block device technology is based on network transmission, when the heartbeat network connection between the master and slave nodes is interrupted, the resources of the master device on the master node and the slave device on the slave node may become the master role during the connection interruption, and there may be competition for resources, causing a "brain split" problem.
[0004] There are two main solutions for resolving split-brain issues with distributed replicated block devices: manual and automatic. Distributed replicated block devices provide an automatic split-brain recovery strategy. When the network is restored, the node hosting the distributed replicated block device automatically executes the automatic split-brain recovery strategy based on the number of primary roles at the time of the detected split-brain event, allowing the distributed replicated block device to recover from the split-brain event.
[0005] However, the automatic split-brain recovery strategy provided by distributed replicated block devices requires that the master and slave of the two distributed replicated block devices be determined before automatic recovery can be performed. Furthermore, the resulting data divergence may result in the loss of important user data. Therefore, the existing automatic split-brain recovery strategy has limited application scenarios.
[0006] When the automatic split-brain recovery strategy fails to work, technical personnel need to be notified to perform manual split-brain recovery, but this undoubtedly prolongs the time required for split-brain recovery. Summary of the Invention
[0007] The purpose of this application is to provide a method, apparatus, device and computer-readable storage medium for processing distributed replicated block device brain splits, which are used to reduce the dependence of distributed replicated block device brain split recovery on manual labor and are applicable to more application scenarios.
[0008] To solve the above technical problems, the present application provides a method for handling split-brain in a distributed replicated block device, comprising:
[0009] When a split-brain event is detected in a pair of distributed replicated block devices in a master-slave relationship, detecting the consistency status of generation identifier tuples of the two distributed replicated block devices;
[0010] determining a master-slave role relationship between the two distributed replicated block devices according to the consistency state and a split-brain processing strategy corresponding to the consistency state;
[0011] A distributed replicated block device synchronization mechanism is rebuilt for the two distributed replicated block devices based on the master-slave role relationship.
[0012] Optionally, the detecting of a split-brain event in a pair of distributed replicated block devices in a master-slave relationship is specifically:
[0013] The split-brain event reported when the generation identifier tuples are inconsistent is detected after the heartbeat signal of the distributed replicated block device and another distributed replicated block device in a master-slave relationship is disconnected and then restored.
[0014] Optionally, determining the master-slave role relationship of the two distributed replicated block devices according to the consistency state and the split-brain processing strategy corresponding to the consistency state is specifically:
[0015] When the consistency state is that the globally unique identifiers of the disk synchronization bitmap change tracking generations are consistent and the globally unique identifiers of the current data generation are inconsistent, among the two distributed replication block devices, the one with the latest data update time is the master device and the other distributed replication block device is the slave device.
[0016] Optionally, determining the master-slave role relationship between the two distributed replicated block devices according to the consistency state and a split-brain processing strategy corresponding to the consistency state specifically includes:
[0017] When the consistency state is that the globally unique identifiers of the disk synchronization bitmap change tracking generations are consistent and the globally unique identifiers of the current data generation are inconsistent, if the master-slave role relationship configuration information of the two distributed replication block devices for persistence processing is obtained in the system database, the master-slave role relationship is determined based on the master-slave role relationship configuration information;
[0018] If a master upgrade processing command for one of the distributed replicated block devices is detected, the master-slave role relationship is determined based on the master upgrade processing command.
[0019] Optionally, determining the master-slave role relationship between the two distributed replicated block devices according to the consistency state and a split-brain processing strategy corresponding to the consistency state specifically includes:
[0020] When the consistency state is that the globally unique identifiers of the disk synchronization bitmap change tracking generations are inconsistent and the globally unique identifiers of the current data generation are also inconsistent, if the master-slave role relationship configuration information of the two distributed replication block devices for persistence processing is obtained in the system database, the master-slave role relationship is determined based on the master-slave role relationship configuration information;
[0021] If the master-slave role relationship configuration information is not obtained, an alarm message is generated to trigger manual processing by the user.
[0022] Optionally, reconstructing a distributed replicated block device synchronization mechanism for the two distributed replicated block devices based on the master-slave role relationship specifically includes:
[0023] After placing the slave device in the master-slave role relationship into an offline state, establishing a link between the slave device and the master device in the master-slave role relationship;
[0024] Based on the link, the connection relationship between the master device and the slave device is rebuilt, so that the master device starts data synchronization with the slave device.
[0025] Optionally, establishing a link between the slave device and the master device in the master-slave role relationship specifically includes:
[0026] Control the node where the slave device is located to initiate a connection request to the node where the master device is located;
[0027] The master device is placed in an offline state, and the node where the master device is located is controlled to connect with the node where the slave device is located, so as to establish the link.
[0028] Optionally, before establishing the link between the slave device and the master device in the master-slave role relationship, the method further includes:
[0029] The data of the slave device is restored to the time point when the split-brain event is initiated.
[0030] Optionally, when a split-brain event is detected between a pair of distributed replicated block devices in a master-slave relationship, detecting the consistency status of generation identifier tuples of the two distributed replicated block devices specifically includes:
[0031] When the split-brain event is detected, calling a split-brain processing script pre-deployed in a distributed replication block device resource configuration file;
[0032] The split-brain processing script is executed to enter the step of detecting the consistency status of the generation identifier tuples of the two distributed replicated block devices.
[0033] Optionally, it is applied to the nodes where the two distributed replicated block devices are respectively located.
[0034] To solve the above technical problems, the present application further provides a distributed replicated block device split-brain processing device, comprising:
[0035] a detection unit configured to detect the consistency state of generation identifier tuples of a pair of distributed replicated block devices in a master-slave relationship when a split-brain event is detected;
[0036] a determining unit, configured to determine a master-slave role relationship between the two distributed replicated block devices according to the consistency state and a split-brain processing strategy corresponding to the consistency state;
[0037] A reconstruction unit is configured to reconstruct a distributed replicated block device synchronization mechanism for the two distributed replicated block devices based on the master-slave role relationship.
[0038] To solve the above technical problems, the present application further provides a distributed replicated block device split-brain processing device, comprising:
[0039] Memory for storing computer programs;
[0040] A processor is configured to execute the computer program, wherein when the computer program is executed by the processor, the steps of the method for processing a distributed replicated block device split-brain are implemented as described in any one of the above.
[0041] To solve the above technical problems, the present application also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the method for processing a distributed replicated block device split-brain as described in any one of the above items are implemented.
[0042] The present application provides a method for handling a distributed replicated block device split-brain. When a split-brain event is detected in a pair of distributed replicated block devices in a master-slave relationship, the method detects the consistency state of the generation identifier tuples of the two distributed replicated block devices. The consistency state of the generation identifier tuples can be used to determine whether the two devices have a master-slave relationship and the data synchronization status of the two devices. Furthermore, the master-slave role relationship of the two distributed replicated block devices can be determined through a pre-established split-brain handling strategy corresponding to each consistency state. Based on the master-slave role relationship, a distributed replicated block device synchronization mechanism is rebuilt for the two distributed replicated block devices. This method solves the problem of limited application scenarios of existing split-brain automatic recovery strategies, effectively reduces the dependence of distributed replicated block device split-brain recovery on manual labor, and thus can quickly resolve the distributed replicated block device split-brain problem.
[0043] The present application also provides a distributed replicated block device split-brain processing device, device and computer-readable storage medium, which have the above-mentioned beneficial effects and are not repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the embodiments of the present application or the technical solutions of the prior art, the following is a brief introduction to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0045] Figure 1 A flowchart of a method for processing a distributed replicated block device split-brain provided in an embodiment of the present application;
[0046] Figure 2 A schematic diagram of the structure of a distributed replicated block device split-brain processing device provided in an embodiment of the present application;
[0047] Figure 3 A schematic diagram of the structure of a distributed replicated block device split-brain processing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0048] The core of this application is to provide a method, apparatus, device and computer-readable storage medium for processing distributed replicated block device brain splits, which are used to reduce the dependence of distributed replicated block device brain split recovery on manual work and are applicable to more application scenarios.
[0049] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0050] Example 1
[0051] Figure 1 A flowchart of a method for processing a distributed replicated block device split-brain provided in an embodiment of the present application.
[0052] like Figure 1 As shown, the method for processing a distributed replicated block device split-brain provided in an embodiment of the present application includes:
[0053] S101: When a split-brain event is detected in a pair of distributed replicated block devices in a master-slave relationship, the consistency status of generation identifier tuples of the two distributed replicated block devices is detected.
[0054] S102: Determine the master-slave role relationship between the two distributed replicated block devices according to the consistency state and the split-brain processing strategy corresponding to the consistency state.
[0055] S103: Rebuilding a distributed replicated block device synchronization mechanism for the two distributed replicated block devices based on the master-slave role relationship.
[0056] The difference between a distributed replicated block device split-brain problem and a common cluster node split-brain problem is that a distributed replicated block device split-brain problem is caused by inconsistent generation identifier (GI) tuples between the master and slave devices. The generation identifier tuple contains a globally unique identifier (Bitmap UUID) for the disk synchronization bitmap change tracking generation and a globally unique identifier (Current UUID) for the current data generation. Each new data generation identifier has an 8-byte globally unique identifier (UUID) flag. When the data on the master device and the slave device are completely consistent, the two globally unique identifiers on the master and slave devices are consistent. However, as the data on the master device is updated while the slave device has not completed data synchronization, the globally unique identifiers of the disk synchronization bitmap change tracking generation on the master and slave devices are consistent, while the globally unique identifiers of the current data generation are inconsistent until data synchronization is completed.
[0057] The disadvantage of existing automatic split-brain recovery methods is that the automatic split-brain recovery strategy provided by distributed replicated block device resources can only achieve automatic split-brain recovery when the master-slave role relationship between a pair of distributed replicated block devices is clear. However, during the process when the network connection between the two distributed replicated block devices is interrupted and neither is sure which is the master device, both distributed replicated block devices may act as the master device to receive data written by the user. As a result, the existing automatic split-brain recovery strategy may lose the data written by the user during this period after execution, causing losses to the user.
[0058] Therefore, in the distributed replicated block device split-brain processing method provided in the embodiment of the present application, in order to realize the automatic recovery of the distributed replicated block device split-brain, it is necessary to add the judgment of the generation identifier tuple to the split-brain automatic recovery strategy, so that in the automatic recovery process, it is possible to identify the relationship between the data of a pair of distributed replicated block devices when a split-brain event occurs, so as to execute the user-defined split-brain recovery strategy.
[0059] Typically, a pair of distributed replicated block devices in a master-slave relationship are deployed on two nodes of a storage cluster and exist in the form of virtualized disks, and there may be multiple pairs of distributed replicated block devices in a master-slave relationship on these two nodes. When the network between the two nodes is interrupted and then restored, a split-brain event may occur between the distributed replicated block devices that were originally in a master-slave relationship. Both may consider themselves to be the master device, and data synchronization from the master device to the slave device cannot be performed. Therefore, the method for processing split-brain of a distributed replicated block device provided in the embodiment of the present application can be applied to the nodes where the two distributed replicated block devices are located, so that the distributed replicated block devices of the nodes can be automatically recovered from the split-brain event in a timely manner. Alternatively, the method for processing split-brain of a distributed replicated block device provided in the embodiment of the present application can also be applied to a third-party monitoring node, and automatic brain recovery is performed after a split-brain event is discovered during communication with the node where the distributed replicated block device is deployed.
[0060] The method for handling a distributed replicated block device split-brain provided in an embodiment of the present application can be implemented in the form of a split-brain handling script. The split-brain handling script can be deployed in a distributed replicated block device resource. S101: When a split-brain event is detected in a pair of distributed replicated block devices in a master-slave relationship, detecting the consistency state of generation identifier tuples of the two distributed replicated block devices may specifically include:
[0061] When a split-brain event is detected, the split-brain processing script pre-deployed in the distributed replication block device resource configuration file is called;
[0062] Execute the split-brain processing script and enter the step of detecting the consistency status of the generation identifier tuples of the two distributed replicated block devices.
[0063] In software implementation, a status monitoring process is added to respond to split-brain events on distributed replicated block devices. This process polls for split-brain events during normal operation and continues to monitor the status of the distributed replicated block devices after a split-brain event occurs, providing reference information for automatic split-brain recovery. A split-brain handling daemon is added, activated under the control of the split-brain handling script, to perform judgment and automatic recovery tasks after a split-brain event occurs.
[0064] For S101, a split-brain processing script is configured in the distributed replicated block device resource. The split-brain processing script can be specifically configured in the handler section of the distributed replicated block device resource configuration file. The split-brain processing script is the absolute path information of the executable file and is configured to take effect when the master-slave device relationship of the distributed replicated block device is established.
[0065] Existing distributed replicated block devices usually use a heartbeat mechanism to achieve high availability. Therefore, when a split-brain event is detected in a pair of distributed replicated block devices in a master-slave relationship in S101, it can be specifically: a split-brain event is reported when it is detected that the heartbeat signal of a distributed replicated block device is disconnected and then restored with another distributed replicated block device in a master-slave relationship, and the generation identifier tuple is inconsistent. Based on the node where the distributed replicated block device is located or the third-party monitoring node, if the heartbeat signal between the nodes where the two distributed replicated block devices are located is detected to be disconnected, it indicates that the network between the two nodes is interrupted. After the heartbeat signal is restored, the nodes where the two distributed replicated block devices are located can check each other or the third-party monitoring node can check the consistency of the generation identifier tuples of the two distributed replicated block devices. If they are not completely consistent, a split-brain event is reported.
[0066] The status monitoring process can specifically monitor the split-brain event of the distributed replicated block device in a polling manner. The process runs when the system is started and starts polling and waiting for notification of the split-brain event of the distributed replicated block device.
[0067] In response to a split-brain event, the node invokes the split-brain handling script, starts the split-brain handling daemon on the node, and notifies the status monitoring process to monitor for split-brain events. When a split-brain event occurs, the master and slave devices of the distributed replicated block device are immediately disconnected and remain disconnected until the split-brain event is resolved.
[0068] In response to the status monitoring process receiving information about a split-brain event, the master-slave device status and generation identifier tuple of the distributed replicated block device when the split-brain occurs are obtained, and the generation identifier tuples of the two distributed replicated block devices are parsed and compared to see whether they are consistent, that is, to see whether the globally unique identifier of the disk synchronization bitmap change tracking generation and the globally unique identifier of the current data generation are consistent.
[0069] For S102, when a split-brain event occurs, there are mainly two types of consistency states between the generation identifier tuples of the two distributed replicated block devices. One is that the global unique identifier of the disk synchronization bitmap change tracking generation is consistent but the global unique identifier of the current data generation is inconsistent. The other is that the global unique identifier of the disk synchronization bitmap change tracking generation and the global unique identifier of the current data generation are inconsistent. The first consistency state means that there is indeed a master-slave relationship between the two distributed replicated block devices, but it is not clear which is the master device and which is the slave device. The second consistency state means that the two distributed replicated block devices are unrelated parents and the master-slave device link between them has been disconnected.
[0070] Since the consistency state between the generation identifier tuples of the two distributed replicated block devices can be determined when a split-brain event occurs, and the relationship between the two distributed replicated block devices corresponding to different consistency states is also relatively clear, the user can pre-customize the split-brain processing strategy for each consistency state, such as selecting the device with the latest data update as the master device, or adopting a pre-persistently configured master-slave role relationship, or promoting the distributed replicated block device that was originally a slave device to a master device in this process (this is usually done when the master device fails). All of these can be formulated by the user according to needs.
[0071] Regarding S103 , after determining the master-slave role relationship between the two distributed replicated block devices, the synchronization mechanism between the two distributed replicated block devices can be rebuilt.
[0072] S103: Rebuilding a distributed replicated block device synchronization mechanism for the two distributed replicated block devices based on the master-slave role relationship may specifically include:
[0073] After placing the slave device in the master-slave role relationship in an offline state, a link is established between the slave device and the master device in the master-slave role relationship;
[0074] Based on the link, the connection relationship between the master device and the slave device is rebuilt to enable the master device to initiate data synchronization with the slave device.
[0075] Specifically, the brainpower processing daemon defines the master-slave relationship between the two distributed replicated block devices based on the current split-brain handling strategy and then executes the automatic split-brain recovery process. First, a connection is established between the master and slave devices. Then, a connection pair is established for data synchronization. The master device then synchronizes data with the slave device.
[0076] Furthermore, establishing a link between the slave device and the master device in the master-slave role relationship may specifically include:
[0077] Control the node where the slave device is located to initiate a connection request to the node where the master device is located;
[0078] The master device is placed in an offline state, and the node where the master device is located is controlled to connect with the node where the slave device is located to establish a link.
[0079] The node where the slave device is located or the third-party monitoring node initiates a request to the node where the master device is located to establish a link between the slave device and the master device, so that the node where the master device is located sets the master device to an offline state and then establishes a link with the slave device.
[0080] Furthermore, after the master-slave role relationship is clarified, since the slave device at this time has previously existed as a master device and may have received user updated data, the data updated during this period can be deleted if the user configuration allows it. Before establishing a link between the slave device and the master device in the master-slave role relationship, the method for handling brain splits in a distributed replication block device provided by the embodiment of the present application may also include: restoring the data of the slave device to the time point when the brain split event was initiated. By restoring the data of the slave device to the time point when the brain split event was initiated, the data modifications of the slave device during the brain split are discarded, thereby avoiding data disorder in the subsequent synchronization process.
[0081] After completing the reconstruction of the distributed replication block device synchronization mechanism, the master device will initiate data synchronization to the slave device and update the inconsistent data between the slave device and the master device.
[0082] After the split-brain recovery is complete, the user can be notified of the split-brain recovery message so that the user can use the distributed replicated block device to back up the data after the split-brain recovery. At the same time, the split-brain event and the split-brain recovery message can be recorded as a log, and the new log can be periodically overwritten with the old log.
[0083] The method for handling a distributed replicated block device split-brain provided in an embodiment of the present application detects the consistency state of the generation identifier tuples of the two distributed replicated block devices when a split-brain event is detected in a pair of distributed replicated block devices in a master-slave relationship. The consistency state of the generation identifier tuples can be used to determine whether the two devices have a master-slave relationship and the data synchronization status of the two devices. The method then determines the master-slave role relationship of the two distributed replicated block devices through a pre-established split-brain handling strategy corresponding to each consistency state, and reconstructs a distributed replicated block device synchronization mechanism for the two distributed replicated block devices based on the master-slave role relationship. This method solves the problem of limited application scenarios of existing split-brain automatic recovery strategies, effectively reduces the dependence of distributed replicated block device split-brain recovery on manual labor, and thus can quickly resolve the distributed replicated block device split-brain problem.
[0084] Example 2
[0085] Based on the above embodiment, in the method for handling a split-brain of a distributed replicated block device provided in the embodiment of the present application, S102: determining the master-slave role relationship of the two distributed replicated block devices based on the consistency state and the split-brain handling strategy corresponding to the consistency state, which may be specifically:
[0086] When the consistency state is that the globally unique identifiers of the disk synchronization bitmap change tracking generations are consistent, but the globally unique identifiers of the current data generation are inconsistent, among the two distributed replication block devices, the one with the latest data update time is the primary device, and the other distributed replication block device is the slave device.
[0087] As provided in the above embodiment, the method for handling a split-brain in a distributed replicated block device, when the consistency state is that the globally unique identifiers of the disk synchronization bitmap change tracking generation are consistent, but the globally unique identifiers of the current data generation are inconsistent, it indicates that a master-slave relationship does exist between the two distributed replicated block devices, but it is unclear which is the master device and which is the slave device. Therefore, at this time, it supports selecting a user-defined split-brain handling strategy, such as using the distributed replicated block device with the latest data update time as the master device.
[0088] Example 3
[0089] Based on the above embodiments, in the method for handling a split-brain of a distributed replicated block device provided in the embodiments of the present application, S102: determining the master-slave role relationship of two distributed replicated block devices based on the consistency state and the split-brain handling strategy corresponding to the consistency state, which may specifically include:
[0090] When the consistency state is that the globally unique identifiers of the disk synchronization bitmap change tracking generations are consistent and the globally unique identifiers of the current data generation are inconsistent, if the master-slave role relationship configuration information of the two distributed replicated block devices for persistence processing is obtained in the system database, the master-slave role relationship configuration information is used to determine the master-slave role relationship;
[0091] If a master upgrade processing command for one of the distributed replicated block devices is detected, the master-slave role relationship is determined based on the master upgrade processing command.
[0092] In addition to using data update time as the basis for judgment, the master-slave role relationship configuration information of the two distributed replicated block devices can also be persisted in advance to quickly determine the master-slave role relationship during automatic split-brain recovery. After a split-brain event occurs, if the consistency state shows that the globally unique identifiers of the disk synchronization bitmap change tracking generation are consistent, but the globally unique identifiers of the current data generation are inconsistent, it indicates that a master-slave relationship does exist between the two distributed replicated block devices. In this case, the master-slave role relationship configuration information of the two distributed replicated block devices that has been persisted and obtained from the detected system database can be used to determine the master-slave role relationship of the two distributed replicated block devices.
[0093] At the same time, during the operation of the distributed replicated block device and after a split-brain event occurs in the distributed replicated block device, the user may upgrade the distributed replicated block device that was originally a slave device to a master device according to needs. At this time, user commands need to take priority.
[0094] Example 4
[0095] Based on the above embodiments, in the method for handling a split-brain of a distributed replicated block device provided in the embodiments of the present application, S102: determining the master-slave role relationship of two distributed replicated block devices based on the consistency state and the split-brain handling strategy corresponding to the consistency state, which may specifically include:
[0096] When the consistency state is that the globally unique identifiers of the disk synchronization bitmap change tracking generation are inconsistent and the globally unique identifier of the current data generation is also inconsistent, if the master-slave role relationship configuration information of the two distributed replicated block devices for persistence processing is obtained in the system database, the master-slave role relationship configuration information is used to determine the master-slave role relationship;
[0097] If the master-slave role relationship configuration information is not obtained, an alarm message is generated to trigger manual processing by the user.
[0098] In practice, if the globally unique identifier of the disk synchronization bitmap change tracking generation and the globally unique identifier of the current data generation are inconsistent, it indicates that the two distributed replicated block devices have unrelated parents. However, since these two distributed replicated block devices have reported a split-brain event, they must be in a master-slave relationship. In this case, it is not convenient for the program to determine, so an alarm message can be directly generated to trigger manual action by the user.
[0099] However, as shown in the third embodiment above, the master-slave role relationship configuration information of the two distributed replication block devices can also be persisted in the system database in advance so that the split-brain processing daemon can quickly determine the master-slave role relationship between the two devices for split-brain recovery.
[0100] The above describes in detail various embodiments corresponding to the method for processing a distributed replicated block device split-brain. On this basis, the present application also discloses a distributed replicated block device split-brain processing apparatus, device, and computer-readable storage medium corresponding to the above method.
[0101] Example 5
[0102] Figure 2 A schematic diagram of the structure of a distributed replicated block device split-brain processing device provided in an embodiment of the present application.
[0103] like Figure 2As shown, the distributed replication block device split-brain processing device provided by the embodiment of the present application includes:
[0104] A detection unit 201 is configured to detect the consistency of generation identifier tuples of a pair of distributed replicated block devices in a master-slave relationship when a split-brain event is detected between the two distributed replicated block devices;
[0105] A determining unit 202 is configured to determine a master-slave role relationship between two distributed replicated block devices based on a consistency state and a split-brain processing strategy corresponding to the consistency state;
[0106] The reconstruction unit 203 is configured to reconstruct a distributed replicated block device synchronization mechanism for the two distributed replicated block devices based on the master-slave role relationship.
[0107] Optionally, the detection unit 201 detects a split-brain event in a pair of distributed replicated block devices in a master-slave relationship, specifically: detecting that a split-brain event is reported when the heartbeat signal of the distributed replicated block device is disconnected and then restored with another distributed replicated block device in a master-slave relationship and the generation identifier tuple is inconsistent.
[0108] Optionally, the determination unit 202 determines the master-slave role relationship of the two distributed replicated block devices based on the consistency state and the split-brain processing strategy corresponding to the consistency state, specifically: when the consistency state is that the globally unique identifiers of the disk synchronization bitmap change tracking generations are consistent, and the globally unique identifiers of the current data generation are inconsistent, among the two distributed replicated block devices, the one with the latest data update time is the master device, and the other distributed replicated block device is the slave device.
[0109] Optionally, the determining unit 202 may specifically include:
[0110] A first detection subunit is configured to, when the consistency state is that the globally unique identifiers of the disk synchronization bitmap change tracking generations are consistent and the globally unique identifier of the current data generation is inconsistent, determine the master-slave role relationship based on the master-slave role relationship configuration information of the two distributed replicated block devices for persistence processing if the master-slave role relationship configuration information is obtained from the system database;
[0111] The second detection subunit is configured to determine the master-slave role relationship based on the master upgrade processing command if a master upgrade processing command for one of the distributed replication block devices is detected.
[0112] Optionally, the determining unit 202 may specifically include:
[0113] A third detection subunit is configured to, when the consistency state is that the globally unique identifiers of the disk synchronization bitmap change tracking generations are inconsistent and the globally unique identifiers of the current data generations are also inconsistent, determine the master-slave role relationship based on the master-slave role relationship configuration information of the two distributed replicated block devices for persistence processing if the master-slave role relationship configuration information is obtained from the system database;
[0114] The fourth detection subunit is configured to generate an alarm message to trigger a user to manually process the message if the master-slave role relationship configuration information is not obtained.
[0115] Optionally, the reconstruction unit 203 may specifically include:
[0116] A link subunit, configured to establish a link between the slave device and the master device in the master-slave role relationship after placing the slave device in the master-slave role relationship in an offline state;
[0117] A subunit is created to reestablish a connection relationship between the master device and the slave device based on the link, so that the master device initiates data synchronization with the slave device.
[0118] Furthermore, the link subunit establishes a link between the slave device and the master device in the master-slave role relationship, which may specifically include:
[0119] Control the node where the slave device is located to initiate a connection request to the node where the master device is located;
[0120] The master device is placed in an offline state, and the node where the master device is located is controlled to connect with the node where the slave device is located to establish a link.
[0121] Furthermore, the apparatus for processing a distributed replicated block device split-brain provided in the embodiment of the present application may further include:
[0122] The restoration subunit is used to restore data of the slave device to a time point when the split-brain event is initiated before the link subunit establishes a link between the slave device and the master device in the master-slave role relationship.
[0123] Optionally, the detection unit 201 may specifically include:
[0124] A calling subunit, configured to call a split-brain processing script pre-deployed in a distributed replication block device resource configuration file when a split-brain event is detected;
[0125] The execution subunit is used to execute the split-brain processing script and enter the step of detecting the consistency status of the generation identifier tuples of the two distributed replicated block devices.
[0126] Optionally, the apparatus for processing a distributed replicated block device split-brain provided in the embodiment of the present application may be deployed on the nodes where the two distributed replicated block devices are located.
[0127] Since the embodiments of the apparatus part correspond to the embodiments of the method part, please refer to the description of the embodiments of the method part for the embodiments of the apparatus part, and they will not be repeated here.
[0128] Example 6
[0129] Figure 3 A schematic diagram of the structure of a distributed replicated block device split-brain processing device provided in an embodiment of the present application.
[0130] like Figure 3 As shown, the distributed replication block device split-brain processing device provided in the embodiment of the present application includes:
[0131] Memory 310 for storing computer programs 311;
[0132] The processor 320 is configured to execute a computer program 311 , which, when executed by the processor 320 , implements the steps of the method for handling a distributed replicated block device split-brain as described in any one of the above embodiments.
[0133] Among them, the processor 320 may include one or more processing cores, such as a 3-core processor, an 8-core processor, etc. The processor 320 can be implemented in at least one hardware form of digital signal processing DSP (Digital Signal Processing), field programmable gate array FPGA (Field-Programmable Gate Array), and programmable logic array PLA (Programmable Logic Array). The processor 320 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as the central processing unit CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 320 may be integrated with a graphics processing unit GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 320 may also include an artificial intelligence AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0134] The memory 310 may include one or more computer-readable storage media, which may be non-transitory. The memory 310 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In this embodiment, the memory 310 is used to store at least the following computer program 311, wherein, after the computer program 311 is loaded and executed by the processor 320, it can implement the relevant steps in the method for processing brain split of the distributed replication block device disclosed in any of the aforementioned embodiments. In addition, the resources stored in the memory 310 may also include an operating system 312 and data 313, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system 312 may be Windows. The data 313 may include but is not limited to the data involved in the above method.
[0135] In some embodiments, the distributed replicated block device split-brain processing device may further include a display screen 330 , a power supply 340 , a communication interface 350 , an input / output interface 360 , a sensor 370 , and a communication bus 380 .
[0136] Those skilled in the art will understand that Figure 3 The structure shown in the figure does not constitute a limitation on the processing device for the brain split of the distributed replicated block device, and may include more or fewer components than shown in the figure.
[0137] The distributed replicated block device split-brain processing device provided in an embodiment of the present application includes a memory and a processor. When the processor executes a program stored in the memory, it can implement the distributed replicated block device split-brain processing method described above, and the effect is the same as above.
[0138] Example 7
[0139] It should be noted that the above-described embodiments of the apparatus and equipment are merely illustrative. For example, the division of modules is merely a logical function division. In actual implementation, there may be other division methods, such as multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, indirect coupling or communication connection of the apparatus or module, which may be electrical, mechanical or other forms. The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment.
[0140] In addition, the functional modules in the various embodiments of the present application may be integrated into a processing module, or each module may exist physically separately, or two or more modules may be integrated into a single module. The above-mentioned integrated modules may be implemented in the form of hardware or software functional modules.
[0141] If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, or the part that contributes to the existing technology, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and executes all or part of the steps of the method described in each embodiment of this application.
[0142] To this end, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of a method for processing a distributed replicated block device split-brain are implemented.
[0143] The computer-readable storage medium may include: a USB flash drive, a mobile hard disk, a read-only memory ROM (Read-Only Memory), a random access memory RAM (Random Access Memory), a magnetic disk or an optical disk, and other media that can store program codes.
[0144] The computer program contained in the computer-readable storage medium provided in this embodiment can implement the steps of the above-mentioned method for processing brain split of the distributed replicated block device when executed by the processor, and the effect is the same as above.
[0145] The above is a detailed introduction to the method, apparatus, device and computer-readable storage medium for processing brain split of a distributed replicated block device provided by the present application. The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the various embodiments can be referred to each other. For the devices, equipment and computer-readable storage media disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.
[0146] It should also be noted that, in this specification, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variants thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus comprising the element.
Claims
1. A method for processing a distributed replicated block device split-brain, characterized in that: include: When a split-brain event is detected in a pair of distributed replicated block devices in a master-slave relationship, detecting the consistency status of generation identifier tuples of the two distributed replicated block devices; determining a master-slave role relationship between the two distributed replicated block devices according to the consistency state and a split-brain processing strategy corresponding to the consistency state; Rebuilding a distributed replicated block device synchronization mechanism for the two distributed replicated block devices based on the master-slave role relationship; Wherein, determining the master-slave role relationship of the two distributed replicated block devices according to the consistency state and the split-brain processing strategy corresponding to the consistency state includes: When the consistency state is that the globally unique identifiers of the disk synchronization bitmap change tracking generations are consistent and the globally unique identifiers of the current data generation are inconsistent, among the two distributed replication block devices, the one with the latest data update time is the master device, and the other distributed replication block device is the slave device; if the master-slave role relationship configuration information of the two distributed replication block devices for persistence processing is obtained in the system database, the master-slave role relationship is determined according to the master-slave role relationship configuration information; if a master upgrade processing command for one of the distributed replication block devices is detected, the master-slave role relationship is determined according to the master upgrade processing command; When the consistency state is that the globally unique identifiers of the disk synchronization bitmap change tracking generations are inconsistent and the globally unique identifiers of the current data generation are also inconsistent, if the master-slave role relationship configuration information of the two distributed replication block devices for persistence processing is obtained in the system database, the master-slave role relationship is determined based on the master-slave role relationship configuration information; If the master-slave role relationship configuration information is not obtained, an alarm message is generated to trigger manual processing by the user.
2. The processing method according to claim 1, characterized in that The detection of a split-brain event in a pair of distributed replicated block devices in a master-slave relationship is specifically: The split-brain event reported when the generation identifier tuples are inconsistent is detected after the heartbeat signal of the distributed replicated block device and another distributed replicated block device in a master-slave relationship is disconnected and then restored.
3. The processing method according to claim 1, characterized in that The reconstructing a distributed replicated block device synchronization mechanism for the two distributed replicated block devices based on the master-slave role relationship specifically includes: After placing the slave device in the master-slave role relationship into an offline state, establishing a link between the slave device and the master device in the master-slave role relationship; Based on the link, the connection relationship between the master device and the slave device is rebuilt, so that the master device starts data synchronization with the slave device.
4. The processing method according to claim 3, characterized in that The establishing of a link between the slave device and the master device in the master-slave role relationship specifically includes: Control the node where the slave device is located to initiate a connection request to the node where the master device is located; The master device is placed in an offline state, and the node where the master device is located is controlled to connect with the node where the slave device is located, so as to establish the link.
5. The processing method according to claim 3, characterized in that: Before establishing a link between the slave device and the master device in the master-slave role relationship, the method further includes: The data of the slave device is restored to the time point when the split-brain event is initiated.
6. The processing method according to claim 1, characterized in that When a split-brain event is detected in a pair of distributed replicated block devices in a master-slave relationship, detecting the consistency state of generation identifier tuples of the two distributed replicated block devices specifically includes: When the split-brain event is detected, calling a split-brain processing script pre-deployed in a distributed replication block device resource configuration file; The split-brain processing script is executed to enter the step of detecting the consistency status of the generation identifier tuples of the two distributed replicated block devices.
7. The processing method according to claim 1, characterized in that Applicable to the nodes where the two distributed replicated block devices are located.
8. A distributed replicated block device split-brain processing device, characterized in that: include: a detection unit configured to detect the consistency state of generation identifier tuples of a pair of distributed replicated block devices in a master-slave relationship when a split-brain event is detected; a determining unit, configured to determine a master-slave role relationship between the two distributed replicated block devices according to the consistency state and a split-brain processing strategy corresponding to the consistency state; a reconstruction unit, configured to reconstruct a distributed replicated block device synchronization mechanism for the two distributed replicated block devices based on the master-slave role relationship; The determining unit determines the master-slave role relationship of the two distributed replicated block devices according to the consistency state and the split-brain processing strategy corresponding to the consistency state, including: when the consistency state is that the globally unique identifiers of the disk synchronization bitmap change tracking generations are consistent and the globally unique identifiers of the current data generation are inconsistent, among the two distributed replicated block devices, the one with the latest data update time is the master device, and the other distributed replicated block device is the slave device; The determining unit further includes: The first detection subunit is configured to, if master-slave role relationship configuration information of the two distributed replicated block devices for persistent processing is obtained from a system database, determine the master-slave role relationship based on the master-slave role relationship configuration information; and the second detection subunit, if a master device promotion processing command for one of the distributed replicated block devices is detected, determine the master-slave role relationship based on the master device promotion processing command; A third detection subunit is configured to, when the consistency state is that the globally unique identifiers of the disk synchronization bitmap change tracking generations are inconsistent and the globally unique identifiers of the current data generation are also inconsistent, determine the master-slave role relationship based on the master-slave role relationship configuration information of the two distributed replicated block devices for persistence processing if the master-slave role relationship configuration information is obtained in the system database; The fourth detection subunit is configured to generate an alarm message to trigger a user to manually process the message if the master-slave role relationship configuration information is not obtained.
9. A distributed replicated block device split-brain processing device, characterized in that: include: Memory for storing computer programs; A processor is configured to execute the computer program, wherein when the computer program is executed by the processor, the steps of the method for processing a distributed replicated block device split-brain are implemented as described in any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for processing a distributed replicated block device split-brain are implemented as claimed in any one of claims 1 to 7.
Citation Information
Patent Citations
Method for preventing split brain phenomenon from occurring on distributed replicated block device (DRBD) resource
CN102457400A
Method and device for processing high-availability cluster split brain
CN110377487A