Disaster recovery method under double AZ cluster and related device
By deploying arbitration devices and heartbeat monitoring mechanisms in dual-AZ clusters and dynamically adjusting the number of logical nodes, the availability problem of dual-AZ clusters in the event of AZ failure or brain split is solved, achieving higher cluster availability and resource efficiency.
Patent Information
- Application Number
- PCT/CN2024/078667
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-02-28
- Filing Date
- 2024-02-27
- Publication Date
- 2024-09-06
AI Technical Summary
It is difficult for a dual-AZ cluster to maintain high availability in the event of AZ failure or split-brain, resulting in cluster unavailability.
By deploying an arbitration device in a dual-AZ cluster and using heartbeat monitoring and arbitration application mechanisms to dynamically adjust the number of logical nodes, the physical nodes can continue to execute the majority mechanism to ensure cluster availability. When an AZ fails or the network link between two AZs is disconnected, the number of logical nodes in the successfully arbitrated AZ is reduced to the number of physical nodes to ensure the availability of the cluster and restore the number of logical nodes when the fault recovers.
It improves the availability of dual-AZ clusters in the event of AZ failure or split-brain, saves resource overhead, reduces data synchronization time, and reduces fault switching time.
Smart Images

Figure CN2024078667_06092024_PF_FP
Abstract
Description
A disaster recovery method and related equipment in a dual-AZ cluster
[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office on February 28, 2023, with application number CN202310181790.7 and invention name “A Disaster Recovery Method and Related Equipment under a Dual AZ Cluster”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of database technology, and in particular to a disaster recovery method and related equipment in a dual-AZ cluster. Background Art
[0003] Distributed relational databases generally use distributed consensus algorithms to achieve multi-copy disaster recovery and rely on these consensus algorithms to achieve high availability features with automatic failover capabilities.
[0004] An availability zone (AZ) is a geographical area within the same service area with independent power and network resources. Computing, network, storage and other resources are logically divided into multiple clusters within the AZ. A region can be understood as a large independent data center, generally divided by geographical location. There are usually multiple AZs within a region. If an AZ fails, it will not affect the normal operation of other AZs in the same region. A multi-AZ cluster can effectively provide reliability for the entire cluster and prevent a single AZ from becoming unavailable due to power, network, natural disasters, and other reasons. Due to the high cost of AZ deployment, some cloud service providers will provide a 2AZ (two AZs, also known as dual AZ) deployment solution to meet the reliability requirements of multiple AZs while also controlling deployment costs.
[0005] In a 2-AZ cluster, a majority mechanism is implemented, meaning that the number of nodes where data is successfully written must be greater than half of the configured number of logical nodes. However, in related technologies, if one AZ fails or a split-brain occurs between two AZs, only nodes in one AZ can continue writing data. However, the number of nodes in a single AZ makes it difficult to achieve a majority, potentially rendering the entire cluster unavailable.
[0006] Therefore, how to implement a disaster recovery method in a dual-AZ cluster to improve cluster availability in the event of an AZ failure or split-brain in the dual-AZ cluster architecture is a technical problem that needs to be urgently solved by those skilled in the art.
[0007] Summary of the Invention
[0008] The embodiments of the present application provide a disaster recovery method and related devices in a dual-AZ cluster to solve the problem of reduced cluster availability in the event of an AZ failure or a split-brain.
[0009] In the first aspect, the present application provides a disaster recovery method under a dual AZ cluster, which is applied to a dual AZ cluster architecture, which includes a first AZ, a second AZ and an arbitration device. The number of pre-configured logical nodes in the first AZ and the second AZ refers to the number of nodes logically deployed in the dual AZ cluster, including physical nodes deployed in the first AZ and the second AZ, and undeployed virtual nodes. Among them, physical nodes refer to computing devices with functions such as processing and storage; virtual nodes do not have actual processing and storage capabilities. The method includes: the master node of the first AZ performs a heartbeat response detection on the second AZ, wherein the master node of the first AZ is a physical node deployed in the first AZ. The heartbeat response refers to a custom structure sent at regular intervals, that is, the master node of the first AZ receives the heartbeat signal sent at regular intervals by the master node of the second AZ, so that the first AZ can ensure the validity of the connection with the second AZ.
[0010] If the master node of the second AZ confirms that the heartbeat response monitoring of the second AZ has failed, indicating that the second AZ has failed or the connection between the second AZ and the first AZ has failed, the master node of the first AZ will initiate an arbitration request to the arbitration device. The arbitration device can only allow one AZ to successfully arbitrate. If the first AZ succeeds in arbitration, it will send a corresponding configuration change instruction to the master node of the first AZ. This configuration change instruction is generated by the arbitration device based on the arbitration request.
[0011] In response to the configuration change command returned by the arbitration device, the master node of the first AZ configures the number of logical nodes in the first AZ to the number of physical nodes in the first AZ. If the first AZ successfully applies for arbitration, the second AZ becomes unavailable, and the physical nodes in the second AZ can no longer perform operations such as processing and storage. At this point, the only available nodes in the entire cluster are the physical nodes in the first AZ. Therefore, in this embodiment, the number of logical nodes in the first AZ is reduced to the number of physical nodes in the first AZ, allowing the physical nodes in the first AZ to continue to follow the majority mechanism, thereby ensuring cluster availability.
[0012] In this embodiment, in a dual-AZ cluster, when one AZ fails or the network between two AZs is disconnected, the number of logical nodes in the AZ that successfully arbitrates is reduced to the number of physical nodes in the AZ, so that the physical nodes in the AZ can continue to execute the majority mechanism in the cluster, thereby improving the availability of the AZ cluster.
[0013] In one possible implementation method, the master node of the first AZ performs heartbeat response monitoring on the second AZ, including:
[0014] The master node of the first AZ periodically sends a heartbeat signal to the master node of the second AZ;
[0015] When confirming that the master node of the second AZ has not sent a response signal, the master node of the first AZ confirms that the heartbeat response monitoring of the second AZ has failed.
[0016] In this embodiment, the first AZ and the second AZ perform heartbeat monitoring on each other to ensure the validity of the connection between them.
[0017] In a possible implementation method, after the master node of the first AZ configures the number of logical nodes of the first AZ to the number of physical nodes deployed in the first AZ in response to the configuration change instruction returned by the arbitration device, the method further includes:
[0018] When the heartbeat response of the second AZ is restored, the master node of the first AZ restores the number of logical nodes of the first AZ to the pre-configured number of logical nodes.
[0019] In this embodiment, when the first AZ can normally monitor the heartbeat response of the second AZ, it indicates that the second AZ has recovered from the fault or the split brain between AZs has recovered. The first AZ expands the number of logical nodes and restores the number of logical nodes to the initial state.
[0020] In one possible implementation method, the logical nodes include physical nodes deployed in the first AZ and the second AZ and undeployed virtual nodes;
[0021] When the number of physical nodes and virtual nodes in the second AZ is the same, the master node of the first AZ restores the number of logical nodes in the first AZ to the pre-configured number of logical nodes, specifically including:
[0022] The master node of the first AZ expands one node pair in sequence until the number of logical nodes in the first AZ is restored to the pre-configured number of logical nodes, where the node pair includes a physical node and a virtual node in the second AZ.
[0023] In this embodiment, when the number of physical nodes and virtual nodes in the second AZ is the same, each time a node pair of one virtual node and one physical node is expanded, it is ensured that during the process of expanding to a total number of logical nodes M, the first AZ has the latest data of more than half of the nodes, and data loss will not occur due to another split-brain.
[0024] In a possible implementation method, the heartbeat response monitoring of the second AZ fails, specifically including:
[0025] The second AZ fails, and / or the network link between the first AZ and the second AZ is disconnected.
[0026] In one possible implementation method, in response to the configuration change instruction returned by the arbitration device, the first AZ configures the number of logical nodes of the first AZ to the number of physical nodes actually deployed in the first AZ, specifically including:
[0027] The first AZ responds to the configuration change instruction returned by the arbitration device, synchronizes the data of the physical nodes deployed in the first AZ, and then configures the number of logical nodes in the first AZ to the number of physical nodes deployed in the first AZ.
[0028] In this embodiment, when the number of nodes containing the latest data in the first AZ is less than half of the total number of nodes deployed in the AZ, in order to meet the availability requirements of the single AZ cluster, before the number of logical nodes in the first AZ is configured, the physical nodes in the first AZ can be synchronized with the data, so that the number of nodes containing the latest data in the first AZ meets the majority principle in the first AZ.
[0029] In a second aspect, the present application provides a computing device applied to a dual-AZ cluster, the dual-AZ cluster including a first AZ, a second AZ, and an arbitration device; the number of pre-configured logical nodes in the dual-AZ cluster is not less than the total number of physical nodes actually deployed in the first AZ and the second AZ;
[0030] The computing device is a physical node deployed in the first AZ, including:
[0031] A heartbeat monitoring module, used to monitor the heartbeat response of the second AZ;
[0032] An arbitration application module, configured to initiate an arbitration application to an arbitration device when the heartbeat response monitoring of the second AZ fails;
[0033] The configuration change module is configured to configure the number of logical nodes in the first AZ to the number of physical nodes actually deployed in the first AZ in response to the configuration change instruction returned by the arbitration device.
[0034] In one possible implementation,
[0035] The heartbeat monitoring module is specifically configured to periodically send a heartbeat response to the second AZ; if it is confirmed that the master node of the second AZ has not sent a response signal, it is determined that the heartbeat response monitoring of the second AZ has failed.
[0036] In one possible implementation,
[0037] When the heartbeat response of the second AZ is restored, the system further includes: a configuration recovery module, configured to restore the number of logical nodes of the first AZ to a pre-configured number of logical nodes.
[0038] In one possible implementation method, the logical nodes include physical nodes deployed in the first AZ and the second AZ and undeployed virtual nodes;
[0039] When the number of physical nodes and virtual nodes in the second AZ is the same, configure a recovery module to sequentially expand a node pair until the number of logical nodes in the first AZ is restored to the pre-configured number of logical nodes, where the node pair includes a physical node and a virtual node in the second AZ.
[0040] In a possible implementation method, the heartbeat response monitoring of the second AZ fails, specifically including:
[0041] The heartbeat response monitoring of the second AZ failed, including:
[0042] The second AZ fails, and / or the network link between the first AZ and the second AZ is disconnected.
[0043] In one possible implementation,
[0044] The configuration change module is specifically configured to respond to the configuration change instruction returned by the arbitration device, synchronize the data of the physical nodes deployed in the first AZ, and then configure the number of logical nodes in the first AZ to the number of physical nodes deployed in the first AZ.
[0045] In a third aspect, the present application provides a dual-AZ cluster, characterized in that it includes a first AZ, a second AZ, and an arbitration device; the number of pre-configured logical nodes in the dual-AZ cluster is not less than the total number of physical nodes actually deployed in the first AZ and the second AZ;
[0046] A physical node deployed in the first AZ is the computing device according to any one of claims 7 to 12.
[0047] In a possible implementation method, the computing device is selected by physical nodes configured in the first AZ through voting based on a majority mechanism.
[0048] In one possible implementation,
[0049] The arbitration device is used to receive an arbitration application sent by a computing device and send a configuration change instruction to the computing device.
[0050] In a possible implementation method, the configuration change instruction is specifically a lock persistence success signal.
[0051] In a fourth aspect, the present application provides a computer program product comprising instructions, characterized in that when the instructions are executed by a computing device, the computing device is caused to execute any one of the above method embodiments.
[0052] In a fifth aspect, the present application provides a computer-readable storage medium, characterized in that it includes computer program instructions, which, when executed by a computing device, enable the computing device to execute any one of the method embodiments described above.
[0053] The solutions provided in the second to fifth aspects are used to implement or cooperate with the disaster recovery method under the dual-AZ cluster provided in the first aspect, and therefore can achieve the same or corresponding beneficial effects as the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] FIG1 is a schematic diagram of a dual-AZ cluster architecture in related technology;
[0055] FIG2 is a signaling diagram of a disaster recovery method in a dual-AZ cluster provided in an embodiment of the present application;
[0056] FIG3 is a schematic diagram of a dual-AZ cluster architecture provided in an embodiment of the present application;
[0057] FIG4 is a schematic diagram of another deployment of a dual-AZ cluster architecture provided in an embodiment of the present application;
[0058] FIG5 is a schematic diagram of a cluster node number recovery method provided by an embodiment of the present application;
[0059] FIG6 is a schematic diagram of the structure of a computing device provided in an embodiment of the present application;
[0060] FIG7 is a schematic diagram of the structure of a computing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0061] In order to make the purpose, technical solutions and advantages of this application more clearly understood, the following describes the embodiments of this application in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of this application, rather than all the embodiments. It is known to those skilled in the art that with the emergence of new application scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.
[0062] The terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate so that the embodiments described herein can be implemented in a sequence other than that illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or modules is not necessarily limited to those steps or modules clearly listed, but may include other steps or modules that are not clearly listed or that are inherent to these processes, methods, products or devices. The naming or numbering of steps in this application does not mean that the steps in the method flow must be executed in the time / logical sequence indicated by the naming or numbering. The process steps that have been named or numbered can be changed in the execution order according to the technical purpose to be achieved, as long as the same or similar technical effects can be achieved. The division of units in this application is a logical division. In actual application, there may be other division methods. For example, multiple units can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between each other shown or discussed can be through some interfaces, and the indirect coupling or communication connection between units can be electrical or other similar forms, which are not limited in this application. Moreover, the units or sub-units described as separate components may or may not be physically separated, may or may not be physical units, or may be distributed into multiple circuit units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this application.
[0063] An availability zone (AZ) is a collection of one or more physical data centers with independent power and network services. Within an AZ, computing, networking, storage, and other resources are logically divided into multiple clusters. A region can be thought of as a large, independent data center, generally divided by geographic location. Different regions have separate intranets. An AZ can be thought of as multiple data centers within a region, each of which is an AZ. A region can have multiple AZs, but an AZ can belong to only one region. Multiple AZs within a region are connected by high-speed fiber optic cables to meet the needs of users building high-availability systems across AZs.
[0064] Multi-AZ deployment effectively improves cluster reliability, preventing a single AZ from causing unavailability due to power outages, network issues, natural disasters, and other issues. Because AZ deployment is expensive, some cloud service providers offer a 2AZ (two AZs, also known as dual AZ) deployment solution to meet multi-AZ reliability requirements while also controlling deployment costs.
[0065] In a dual-AZ computing cluster, node read and write operations must satisfy a majority mechanism. This means that when executing an operation across the cluster, the operation is considered successful only if data updates are successful in more than half of the nodes. In one implementation, each node deploys a distributed coordinator (such as ZooKeeper or Etcd), which uses a majority mechanism to support strongly consistent read and write operations.
[0066] When an AZ fails or a split-brain occurs between two AZs, an arbitration device is used. The arbitration device provides functions such as arbitration application and arbitration query. One purpose of arbitration is to prevent the cluster from splitting brain when the cluster experiences a network partition. Split-brain is the result of a cluster partition (or grouping). A cluster partition means that two partitions believe that the other no longer exists or has failed, and thus compete for control of cluster resources. The consequence of a split-brain is that the two partitions can read and write to the shared disk simultaneously and independently, resulting in disk data corruption. The second purpose of arbitration is to limit the maximum number of failures that the cluster can withstand. Arbitration requires a majority vote in the cluster, otherwise the cluster will fail. For example, a cluster with 5 nodes can tolerate the simultaneous failure of a maximum of two nodes, also known as the quorum mechanism.
[0067] When a split-brain occurs between two AZs, both parties can initiate arbitration requests to the arbitration device, but only one party will succeed while the other fails. The AZ that failed arbitration becomes unavailable, and the nodes deployed in that AZ can no longer read or write data. If the number of nodes in the AZ that successfully arbitrates is less than the configured logical node count, the cluster remains unavailable.
[0068] A related art provides a solution for a dynamic instance, which "drifts" between two AZs and is started in the AZ where arbitration succeeds only when an AZ splits. Please refer to FIG1 , which is a schematic diagram of a dual-AZ cluster architecture in the related art.
[0069] Two AZs, AZ1 and AZ2, are deployed in the dual-AZ cluster architecture. Three nodes are deployed in each AZ. Each node consists of four modules: static instances (s_1 to s_6), dynamic instances (d_7 to d_9), agent modules (agent, agt), and control modules (control, ctrl). Static instances are permanent startup processes in the node, which can always support data read and write operations on the node as long as there are no failures. Dynamic instances will only start the process when the AZ has a split brain. The ctrl module is an arbitration application module, which is used to send arbitration applications to the arbitration device and send control information to the agt module based on the arbitration results. The control information is used to instruct the agent module to start or stop the dynamic process.
[0070] The cluster architecture is configured with 9 logical nodes, including 6 static instances and 3 dynamic instances. The 6 static instances are deployed in 6 nodes in AZ1 and AZ2 respectively.
[0071] When AZ1 and AZ2 are connected, only six static instances are started, and dynamic instances are not started. At this time, according to the majority mechanism, the minimum number of nodes that must succeed in writing is at least five. Therefore, at most one node failure is allowed among nodes 1 to 6.
[0072] Both AZs include a master node (node3 in AZ1 and node4 in AZ2). The ctrl of the master node is used to monitor each other's heartbeat response to ensure the connection validity between the first AZ and the second AZ.
[0073] When a network failure between AZ1 and AZ2 causes a split-brain event, the heartbeat response between the Ctrl nodes of the two master nodes in the two AZs times out. The Ctrl nodes enter the arbitration request state and initiate an arbitration request with the arbitration device. Only the Ctrl node in one AZ can successfully apply for arbitration. The Ctrl node that successfully applies for arbitration issues a dynamic instance startup command to all AGTs in the same AZ. This dynamic instance startup command instructs the AGT to start the corresponding dynamic instance. After the dynamic instance is started, it synchronizes data with the static instances in the AZ and starts the process.
[0074] Because this cluster architecture is configured with nine nodes, the AZ that successfully applied for arbitration includes three dynamic instances and three static instances, equivalent to occupying six nodes. According to the majority mechanism, this cluster should be able to withstand the failure of one node. However, because one dynamic instance and one static instance are deployed on a single physical node, a single failure will cause both instances to become unavailable, thus defeating the majority mechanism and causing the entire cluster to become unavailable.
[0075] It is understandable that in the above-mentioned related technologies, when AZ split-brain occurs, a single node carries two service instances, and two copies of memory and disk resources need to be reserved, resulting in a problem of wasted resource overhead. In addition, the service instance provides the ability to update data externally. Since the dynamic instance is in an inactive state for a long time, its persistent data lags significantly behind the data of the statically running service instance. Therefore, it is difficult for the dynamic instance to achieve incremental completion, and a full and rapid copy is required after startup. At this time, due to the majority principle in the entire cluster, it is necessary to wait for more than two dynamic instances to complete the snapshot synchronously in order to comply with the majority mechanism. When the snapshot file is large, it is limited by the bandwidth of the network and disk, which will cause the time for the entire cluster to recover to be longer. At the same time, the cluster is also often used to store metadata for the business cluster. As the cluster scales, the snapshot data becomes larger, which leads to an increase in the switching time of AZ failures.
[0076] In order to solve the above problems, the present application provides a disaster recovery method in a dual-AZ cluster.
[0077] Please refer to Figure 2, which is a signaling diagram of the disaster recovery method for a dual-AZ cluster provided in an embodiment of the present application. This method is applied to a dual-AZ cluster architecture. Please refer to Figure 3, which is a schematic diagram of a dual-AZ cluster architecture provided in an embodiment of the present application, including a first AZ 301, a second AZ 302, and an arbitration device 303. The number of pre-configured logical nodes in the first AZ 301 and the second AZ 302 is M, where M is a natural number, and the pre-configured number of logical nodes M is not less than the total number of physical nodes actually deployed in the first AZ and the second AZ.
[0078] It should be noted that the number of pre-configured logical nodes in the first AZ and the second AZ refers to the sum of the physical nodes and virtual nodes in the dual AZ cluster. Taking Figure 3 as an example, the number of pre-configured logical nodes in this architecture is 9, including a total of 6 physical nodes deployed in the first AZ 301 and the second AZ 302 (node311, node312, node313 in the first AZ, node314, node315, node316 in the second AZ), and 3 undeployed virtual nodes (node317, node318, node319). Each physical node includes two modules, namely service instances (instances 1 to 9) and controllers (ctrl). The service instances are specifically distributed coordinators, such as Zookeeper (ZK) or Etcd, which are used to execute a majority mechanism on the nodes in the cluster to achieve strong consistent read and write.
[0079] Referring to FIG. 2 , the disaster recovery method in a dual-AZ cluster provided in this embodiment includes:
[0080] 201. The master node of the first AZ performs heartbeat response monitoring on the second AZ.
[0081] The master node of the first AZ is a physical node deployed in the first AZ. The heartbeat refers to a custom structure sent at regular intervals. It is understood that in a dual-AZ cluster architecture, the connection between the first AZ and the second AZ needs to be valid, and the method used is to monitor each other's heartbeat responses.
[0082] In one possible implementation method, the specific process of the first AZ performing heartbeat response monitoring on the second AZ includes: the master node of the first AZ sends a heartbeat request to the master node of the second AZ, and the heartbeat request is used for the master node of the second AZ to send a heartbeat signal to the master node of the first AZ; if the master node of the first AZ obtains the heartbeat signal sent by the master node of the second AZ, it indicates that the network connection between the first AZ and the second AZ is valid; if the master node of the first AZ does not receive the heartbeat signal sent by the second AZ within a preset time, it indicates that the connection between the first AZ and the second AZ has failed, and the reason for the connection failure may be a fault in the second AZ or a network disconnection (brain split) between the first AZ and the second AZ. The second AZ can also actively send a heartbeat signal to the master node of the first AZ according to a certain rule to facilitate the first AZ to monitor the heartbeat of the second AZ.
[0083] In another possible implementation method, step 201 specifically includes:
[0084] The master node of the first AZ sends a heartbeat signal to the second AZ.
[0085] The master node of the first AZ periodically sends a heartbeat signal to the master node of the second AZ;
[0086] If the master node of the first AZ confirms that the master node of the second AZ has not sent a response signal, it confirms that the heartbeat response monitoring of the second AZ has failed. It can be understood that the heartbeat monitoring between the first and second AZs is specifically performed by computing devices in the first and second AZs. The computing devices are physical nodes deployed in the first and second AZs, and each physical node is deployed with one service instance and one controller. The service instance is used to complete data read and write operations of the cluster service.
[0087] The heartbeat monitoring and arbitration application operations are specifically performed by the controller. It is understandable that since the controller can be deployed on the physical nodes in each AZ, each physical node has the function of accessing the arbitration device and performing heartbeat monitoring. Under normal circumstances, the controllers within a single AZ can vote to select the main controller (master) in the AZ through the majority principle. The heartbeat monitoring and arbitration application operations are performed by the master. When the node where the master is located fails, other controllers will continue to vote to select a new master. In this embodiment, the masters between two AZs perform heartbeat response monitoring. If the master of the other AZ does not respond to the heartbeat, it is considered that the other AZ has failed or a brain split has occurred.
[0088] 202 , after the master node of the first AZ confirms that the heartbeat response monitoring of the second AZ fails, the first AZ initiates an arbitration application to the arbitration device.
[0089] If the heartbeat response monitoring of the second AZ fails, it means that the second AZ has a fault or there is a brain split between the first AZ and the second AZ. At this time, the first AZ enters the arbitration process.
[0090] Assume that the second AZ experiences a power failure. Since the first AZ continues to be unable to receive heartbeat responses from the second AZ, it enters the arbitration request state and sends an arbitration request to the arbitration device. Specifically, it requests that the arbitration device lock the persistent data and record the data in the second AZ as old. It is understood that the arbitration device can provide locking persistence capabilities. For example, in a cluster built with ZK / etcd, the arbitration device can achieve data persistence through an optimistic locking mechanism.
[0091] The arbitration device can be an independently deployed single server or cluster, or a cloud service. Those skilled in the art can deploy it accordingly according to actual needs, which will not be described in detail here.
[0092] It can be understood that, in this step, the operation of initiating an arbitration application to the arbitration device may be specifically performed by the master in the first AZ.
[0093] 203. The arbitration device sends a configuration change instruction to the master node of the first AZ.
[0094] It's understandable that after receiving an arbitration request, only one party can successfully arbitrate, while the other party's request will fail. In practice, if a split-brain occurs between two AZs, both AZs will almost simultaneously initiate arbitration requests to the arbitration device, essentially attempting to "grab the lock." It's understandable that the arbitration device is exclusive, allowing only one AZ to successfully grab the lock. In this embodiment, the arbitration device sends an arbitration request success signal to the first AZ, indicating that the first AZ has successfully grabbed the lock, providing lock persistence for the first AZ, and marking the data in the second AZ as stale.
[0095] Specifically, the arbitration device sends a lock persistence signal to the master in the first AZ.
[0096] 204. The master node of the first AZ configures the number of logical nodes of the first AZ to the number of physical nodes deployed in the first AZ in response to the configuration change instruction.
[0097] After the arbitration request for the first AZ succeeds, the corresponding second AZ becomes unavailable. At this point, the number of available nodes in the cluster is equal to the number of physical nodes in the first AZ. To meet the majority principle and maintain cluster availability, this embodiment reconfigures the number of logical nodes in the first AZ to match the number of physical nodes deployed in the first AZ.
[0098] It is understandable that, assuming that the arbitration application of the first AZ fails and the arbitration application of the second AZ succeeds, after the second AZ completes the corresponding configuration change, the number of physical nodes in the second AZ is used as the number of clusters to provide services.
[0099] Taking Figure 3 as an example, when the first AZ and the second AZ are connected and running, the networks between all service instances are connected, and the entire cluster can provide services normally. The number of logical nodes pre-configured for the entire cluster is 9. According to the majority principle, a successful cluster write operation requires 5 nodes to complete data persistence, so the number of nodes containing the latest data in each AZ is at least 2. Since the first AZ includes 3 physical nodes, when the first AZ successfully applies for arbitration, the number of logical nodes of each node in the first AZ is configured to 3, and the first AZ will provide services with a configuration of 3 logical nodes. According to the majority principle, at least 2 nodes are required in the cluster to provide services, so the cluster after the configuration change can meet the service provision requirements, as follows:
[0100] When the first AZ is in normal use, there are at least two nodes containing the latest data, specifically node311 and node312. When the arbitration application of the first AZ is successful, the number of logical nodes is 3, including node311, node312, and node313 deployed in the first AZ. The cluster needs to read the latest data to provide services, and still needs to meet the majority principle, that is, any two nodes need to be selected from node311, node312, and node313 to provide services, and the data of these two nodes needs to contain the latest data. Since node311 and node312 contain the latest data, after reconfiguring the number of clusters, no matter how two nodes are selected, at least one of node311 and node312 must be included, and the latest data can be read without the need for a full snapshot copy, thus meeting the availability requirements of the cluster. At the same time, even if one node in the configured cluster fails, the entire cluster is still available, which improves the availability of the cluster.
[0101] The disaster recovery method under the dual-AZ cluster provided in the embodiment of the present application is different from the dynamic instance method adopted in the technology corresponding to Figure 1. In the case of AZ failure or brain split, the method in this embodiment can still allow the occurrence of faulty nodes, thereby improving the availability of the cluster. At the same time, in this method, only one service instance needs to be configured in each node, saving resource overhead. The service instance corresponding to each node in the cluster is a static instance, which reduces data synchronization time.
[0102] It is understandable that in the actual use of the cluster, the nodes containing the latest data in a single AZ usually exceed half of the total number of nodes deployed in the single AZ. Therefore, after the number of logical nodes is configured as above, the cluster still meets the availability requirements.
[0103] However, in one possible implementation method, after the arbitration application of an AZ is successful, the number of nodes in the AZ containing the latest data is less than half of the total number of nodes deployed in the AZ. In this case, step 204 specifically includes:
[0104] The master node of the first AZ responds to the configuration change instruction returned by the arbitration device, first synchronizes the data of the physical nodes deployed in the first AZ, and then configures the number of logical nodes in the first AZ to the number of physical nodes deployed in the first AZ.
[0105] For ease of understanding, please refer to FIG. 4 , which is a deployment diagram of another dual-AZ cluster architecture provided in an embodiment of the present application, including a first AZ 401 , a second AZ 402 and an arbitration device 403 .
[0106] The first AZ 401 and the arbitration device 403 are similar to the first AZ 301 and the arbitration device 303 of the dual-AZ cluster architecture shown in FIG3 , and are not described in detail here.
[0107] In the architecture shown in FIG4 , the number of pre-configured logical nodes is 9, including 3 nodes deployed in the first AZ, 4 nodes deployed in the second AZ, and 2 undeployed nodes.
[0108] When the first AZ and the second AZ are connected and running, the networks between all service instances are connected, and the entire cluster can provide services normally. The number of pre-configured logical nodes for the entire cluster is 9. According to the majority principle, a successful cluster write operation requires 5 nodes to complete data persistence, which means that the number of nodes containing the latest data in the first AZ is at least 1, and the number of nodes containing the latest data in the second AZ is at least 2. Since the first AZ includes 3 physical nodes, when the first AZ successfully applies for arbitration, if the number of logical nodes of each node in the first AZ is directly configured to 3, according to the majority principle, at least 2 nodes in the cluster are required to provide services. These two nodes may not contain the latest data and do not meet the cluster's availability requirements. For example:
[0109] When the first AZ is in normal use, there is at least one node containing the latest data, and this node is node411. When the arbitration application of the first AZ is successful, the number of logical nodes is 3, including node411, node412 and node413. The cluster needs to read the latest data to provide services, and still needs to meet the majority principle, that is, any two nodes need to be selected from node411, node412 and node413 to provide services, and the data of these two nodes needs to contain the latest data. In order to avoid the two nodes selected being node412 and node413 that do not contain the latest data, before configuring the logical nodes of the first AZ, the data of node412 and / or node413 can be synchronized with node411, so that the number of nodes containing the latest data in the first AZ meets the majority principle in the first AZ. After data synchronization, the logical nodes of the first AZ are configured to the number of physical nodes in the first AZ.
[0110] Specifically, after receiving the arbitration request success signal, the master in the first AZ sends a configuration change request to the other ctrls in the first AZ. Upon receiving the configuration change request, the ctrl changes the number of logical nodes in the configuration of its service instance to the number of physical nodes in the first AZ. After the change is successful, it sends a configuration success signal to the master. After receiving the configuration success signal, the master continues to send a process restart command to the ctrl, instructing the ctrl to reset the process of the corresponding service instance so that the configured logical node number takes effect on the node.
[0111] 205 , when the heartbeat response of the second AZ is restored, the master node of the first AZ restores the number of logical nodes of the first AZ to the pre-configured number of logical nodes.
[0112] It is understandable that when the first AZ can normally monitor the heartbeat response of the second AZ, it indicates that the second AZ has recovered from the fault or the split brain between AZs has recovered. The first AZ expands the number of logical nodes and restores the number of logical nodes to the initial state.
[0113] Specifically, after detecting a heartbeat from the master of the second AZ, the master in the first AZ deems the second AZ to have recovered and begins the AZ recovery process. The master in the first AZ sends a configuration instruction to other ctrls in the first AZ to expand the number of logical nodes, restoring the number of logical nodes in the first AZ to the pre-configured M. It will be appreciated that the configuration change operation for restoring the number of logical nodes is similar to the configuration change in step 204 above and will not be further described here.
[0114] In a possible implementation method, when the number of physical nodes and virtual nodes in the second AZ is the same, step 205 specifically includes:
[0115] When the heartbeat response of the second AZ is restored, the logical nodes of the first AZ are expanded one node pair at a time until the number of logical nodes of the first AZ is restored to the pre-configured number M of logical nodes, where the node pair includes a physical node and a virtual node in the second AZ.
[0116] As shown in Figure 5, Figure 5 is a schematic diagram of a logical node number recovery provided by an embodiment of the present application. It can be understood that Figure 5 is a supplement to the cluster architecture shown in Figure 3. When restoring the number of logical nodes in the first AZ, each time the node pair of a virtual node and a physical node is expanded, for example, node314+node317, node315+node318, node316+node319. The purpose of this is to ensure that during the process of expanding to a total number of logical nodes of 9, there are at least 2 nodes in the first AZ with the latest data, and data will not be lost due to another brain split.
[0117] After the expansion is complete, the nodes in the second AZ join the cluster, and the arbitration software can mark the data in the second AZ as new. It is understood that arbitration can only be successful if the arbitration software marks the data as new in the AZ.
[0118] The disaster recovery method under the dual-AZ cluster provided in the embodiment of the present application reduces memory and disk resource overhead, reduces single-AZ fault switching delay, and improves the cluster availability of a single AZ through dynamic configuration changes.
[0119] This application also provides a computing device. See Figure 6, which is a schematic diagram of the structure of a computing device provided in an embodiment of this application. This computing device 600 is applied to a dual-AZ cluster architecture, where the dual-AZ cluster includes a first AZ, a second AZ, and an arbitration device. The number of preconfigured logical nodes in the first AZ and the second AZ is M, where M is a natural number.
[0120] The computing device includes a physical node deployed in the first AZ. It is understandable that the computing device provided in this embodiment can be any physical node in the cluster architecture shown in Figures 3 to 5 above.
[0121] Computing equipment includes:
[0122] A heartbeat monitoring module 601 is configured to monitor the heartbeat response of the second AZ;
[0123] An arbitration application module 602 is configured to initiate an arbitration application to an arbitration device when the heartbeat response monitoring of the second AZ fails;
[0124] The configuration change module 603 is configured to configure the number of logical nodes in the first AZ to the number of physical nodes actually deployed in the first AZ in response to the configuration change instruction returned by the arbitration device.
[0125] In one possible implementation,
[0126] The heartbeat monitoring module 601 is specifically configured to periodically send a heartbeat response to the second AZ; if it is confirmed that the master node of the second AZ has not sent a response signal, it is determined that the heartbeat response monitoring of the second AZ has failed.
[0127] In one possible implementation,
[0128] The system further includes: a configuration recovery module 604, configured to restore the number of logical nodes in the first AZ to a pre-configured number of logical nodes.
[0129] In one possible implementation,
[0130] Logical nodes include physical nodes deployed in the first AZ and the second AZ and undeployed virtual nodes;
[0131] When the number of physical nodes and virtual nodes in the second AZ is the same, a configuration recovery module 604 is configured to sequentially expand a node pair until the number of logical nodes in the first AZ is restored to the pre-configured number of logical nodes, where the node pair includes a physical node and a virtual node in the second AZ.
[0132] In one possible implementation,
[0133] The heartbeat response monitoring of the second AZ failed, including:
[0134] The second AZ fails, and / or the network link between the first AZ and the second AZ is disconnected.
[0135] In one possible implementation,
[0136] The configuration change module 603 is specifically configured to respond to the configuration change instruction returned by the arbitration device, synchronize the data of the physical nodes deployed in the first AZ, and then configure the number of logical nodes in the first AZ to the number of physical nodes deployed in the first AZ.
[0137] It can be understood that the computing device in this embodiment can be any physical node in the cluster architecture shown in Figures 3 to 5 above, specifically the physical node where the master is deployed in the first AZ. The functions of each device in the computing device are used to implement the corresponding steps in Figures 3 to 5. For example, the ctrl module is used to execute the actions performed by the above-mentioned heartbeat detection module and arbitration application module, and the service instance is used to execute the actions performed by the above-mentioned configuration change module and configuration recovery module, wherein the ctrl module is used to pass the configuration change information sent by the arbitration device to the service instance.
[0138] The present application also provides a dual-AZ cluster, including a first AZ, a second AZ and an arbitration device; the number of pre-configured logical nodes in the dual-AZ cluster is not less than the total number of physical nodes actually deployed in the first AZ and the second AZ; one physical node deployed in the first AZ is a computing device as shown in Figure 6.
[0139] In a possible implementation method, the computing device is selected by physical nodes in the first AZ through voting based on a majority mechanism.
[0140] In a possible implementation method, the arbitration device is configured to receive an arbitration request sent by a computing device and send a configuration change instruction to the computing device.
[0141] In a possible implementation method, the arbitration application success signal is specifically a lock persistence success signal.
[0142] This application also provides a computing device 700. As shown in Figure 7, computing device 700 includes a bus 702, a processor 704, a memory 706, and a communication interface 708. Processor 704, memory 706, and communication interface 708 communicate with each other via bus 702. Computing device 700 can be a server or a terminal device. It should be understood that this application does not limit the number of processors and memories in computing device 700.
[0143] Bus 702 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, among others. Buses may be classified as address buses, data buses, control buses, and the like. For ease of illustration, FIG7 illustrates a single bus line, but this does not imply a single bus or type of bus. Bus 704 may include a path for transmitting information between various components of computing device 700 (e.g., memory 706, processor 704, and communication interface 708).
[0144] The processor 704 may include any one or more processors such as a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0145] The memory 706 may include volatile memory, such as random access memory (RAM). The processor 704 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state drive (SSD).
[0146] The memory 706 stores executable program code, and the processor 704 executes the executable program code to implement the functions of the controller and service instance, respectively, thereby implementing the disaster recovery method in the dual-AZ cluster. In other words, the memory 706 stores instructions for executing the disaster recovery method in the dual-AZ cluster.
[0147] Embodiments of the present application also provide a computer program product containing instructions. The computer program product may be software or a program product containing instructions that can be run on a computing device or stored on any available medium. When the computer program product is run on at least one computing device, it causes the at least one computing device to execute a disaster recovery method for a dual-AZ cluster, or instructs the computing device to execute a disaster recovery method for a dual-AZ cluster.
[0148] The embodiments of the present application also provide a computer-readable storage medium. The computer-readable storage medium can be any available medium that can be stored by a computing device or a data storage device such as a data center that contains one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive). The computer-readable storage medium includes instructions that instruct the computing device to execute the disaster recovery method under a dual-AZ cluster, or instruct the computing device to execute the disaster recovery method under a dual-AZ cluster.
[0149] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0150] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interface, device or unit, which can be electrical, mechanical or other forms.
[0151] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0152] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0153] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
Claims
1. A disaster recovery method in a dual-availability zone AZ cluster, characterized in that: A master node applied to a first AZ, the first AZ being arranged in a dual AZ cluster, the dual AZ cluster further comprising a second AZ and an arbitration device; the number of pre-configured logical nodes in the dual AZ cluster being not less than the total number of physical nodes actually deployed in the first AZ and the second AZ; The method comprises: The master node of the first AZ performs heartbeat response monitoring on the second AZ, and the master node of the first AZ is a physical node deployed in the first AZ; When the master node of the first AZ confirms that the heartbeat response monitoring of the second AZ fails, the master node of the first AZ initiates an arbitration application to the arbitration device; The master node of the first AZ configures the number of logical nodes of the first AZ to the number of physical nodes actually deployed in the first AZ in response to the configuration change instruction returned by the arbitration device, wherein the configuration change instruction is generated by the arbitration device according to the arbitration application.
2. The method according to claim 1, characterized in that The master node of the first AZ performs heartbeat response monitoring on the second AZ, including: The master node of the first AZ periodically sends a heartbeat signal to the master node of the second AZ; When confirming that the master node of the second AZ has not sent a response signal, the master node of the first AZ confirms that the heartbeat response monitoring of the second AZ has failed.
3. The method according to any one of claims 1 or 2, characterized in that: After the master node of the first AZ configures the number of logical nodes of the first AZ to the number of physical nodes deployed in the first AZ in response to the configuration change instruction returned by the arbitration device, the method further includes: When the heartbeat response of the second AZ is restored, the master node of the first AZ restores the number of logical nodes of the first AZ to the pre-configured number of logical nodes.
4. The method according to claim 3, characterized in that The logical nodes include physical nodes deployed in the first AZ and the second AZ and undeployed virtual nodes; When the number of physical nodes in the second AZ is the same as the number of virtual nodes, the master node of the first AZ restores the number of logical nodes of the first AZ to the pre-configured number of logical nodes, specifically including: The master node of the first AZ sequentially expands a node pair until the number of logical nodes of the first AZ is restored to the pre-configured number of logical nodes, wherein the node pair includes a physical node in the second AZ and one of the virtual nodes.
5. The method according to any one of claims 1 to 4, characterized in that: The heartbeat response monitoring of the second AZ fails, specifically including: The second AZ fails, and / or the network link between the first AZ and the second AZ is disconnected.
6. The method according to any one of claims 1 to 5, characterized in that: The first AZ configures the number of logical nodes of the first AZ to the number of physical nodes actually deployed in the first AZ in response to the configuration change instruction returned by the arbitration device, specifically including: The first AZ synchronizes data of the physical nodes deployed in the first AZ in response to the configuration change instruction returned by the arbitration device, and then configures the number of logical nodes in the first AZ to the number of physical nodes deployed in the first AZ.
7. A computing device, characterized in that Applied to a dual AZ cluster, the dual AZ cluster includes a first AZ, a second AZ and an arbitration device; the number of pre-configured logical nodes in the dual AZ cluster is not less than the total number of physical nodes actually deployed in the first AZ and the second AZ; The computing device is a physical node deployed in the first AZ, including: A heartbeat monitoring module, used for performing heartbeat response monitoring on the second AZ; an arbitration application module, configured to initiate an arbitration application to the arbitration device when the heartbeat response monitoring of the second AZ fails; A configuration change module is used to configure the number of logical nodes in the first AZ to the number of physical nodes actually deployed in the first AZ in response to the configuration change instruction returned by the arbitration device.
8. The computing device according to claim 7, characterized in that The heartbeat monitoring module is specifically used to periodically send a heartbeat response to the second AZ; after confirming that the master node of the second AZ is In the case where a response signal is sent, it is confirmed that the heartbeat response monitoring of the second AZ has failed.
9. The computing device according to claim 7 or 8, characterized in that When the heartbeat response of the second AZ is restored, the method further includes: the configuration recovery module, which is used to restore the number of logical nodes of the first AZ to the pre-configured number of logical nodes.
10. The computing device according to claim 9, characterized in that The logical nodes include physical nodes deployed in the first AZ and the second AZ and undeployed virtual nodes; When the number of physical nodes in the second AZ is the same as the number of virtual nodes, the configuration recovery module is specifically used to expand a node pair in sequence until the number of logical nodes in the first AZ is restored to the pre-configured number of logical nodes, wherein the node pair includes a physical node in the second AZ and one of the virtual nodes.
11. The computing device according to any one of claims 7 to 10, characterized in that: The heartbeat response monitoring of the second AZ fails, specifically including: The second AZ fails, and / or the network link between the first AZ and the second AZ is disconnected.
12. The computing device according to any one of claims 7 to 11, characterized in that: The configuration change module is specifically used to respond to the configuration change instruction returned by the arbitration device, synchronize the data of the physical nodes deployed in the first AZ, and then configure the number of logical nodes in the first AZ to the number of physical nodes deployed in the first AZ.
13. A dual AZ cluster, characterized in that: comprising a first AZ, a second AZ and an arbitration device; the number of logical nodes pre-configured in the dual AZ cluster is not less than the total number of physical nodes actually deployed in the first AZ and the second AZ; A physical node deployed in the first AZ is a computing device as described in any one of claims 7 to 12.
14. The dual AZ cluster according to claim 13, characterized in that: The computing device is selected by voting of physical nodes configured in the first AZ based on a majority mechanism.
15. The dual AZ cluster according to claim 13 or 14, characterized in that: The arbitration device is used to receive the arbitration application sent by the computing device and send a configuration change instruction to the computing device.
16. The dual AZ cluster according to claim 15, characterized in that: The configuration change instruction is specifically a lock persistence success signal.
17. A computer program product comprising instructions, characterized in that When the instructions are executed by a computing device, the computing device is caused to perform the method according to any one of claims 1 to 6.
18. A computer-readable storage medium, characterized in that: The method comprises computer program instructions. When the computer program instructions are executed by a computing device, the computing device performs the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Configuration modification method of storage cluster, storage cluster and computer system
CN109729129A
Disaster recovery management method for cloud cluster and related device
CN112698992A
Disaster recovery method and device for double available areas, electronic equipment and storage medium
CN113987066A
Instance deployment method and device, cloud system, computing equipment and storage medium
CN115168020A
Hybrid cluster recovery techniques
US10454754B1
Cited By
Storage disk reservation method, electronic equipment, storage medium and program product
CN118860915A
