A data disaster recovery method, device, equipment and medium

By utilizing the second data center to start the leader node of the second cluster in a dual data center architecture to maintain data consistency, the problem of ETCD clusters being unable to provide services during failures is solved, achieving high availability and data consistency, and reducing data disaster recovery costs.

CN113515408BActive Publication Date: 2026-01-23HUAWEI CLOUD COMPUTING TECHNOLOGIES CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202010279154.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-04-10
Publication Date
2026-01-23
Estimated Expiration
2040-04-10

AI Technical Summary

Technical Problem

In a dual-datacenter architecture, when one datacenter fails, the ETCD cluster cannot provide services to the outside world because it has only one node left and cannot elect a leader node, thus failing to meet high availability requirements.

Method used

With M nodes deployed in the first data center and N nodes deployed in the second data center, a second cluster is started through the second data center. One node is used as the leader node to maintain data consistency, ensuring that the cluster can still provide services in the event of a failure and maintain data consistency when the data center is restored.

Benefits of technology

It enables continued service provision even during data center failures, meeting high availability requirements, and maintaining data consistency during data recovery, thereby reducing data disaster recovery costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113515408B_ABST
    Figure CN113515408B_ABST
Patent Text Reader

Abstract

The application provides a data disaster recovery method, which is applied to a first data center and a second data center, the first data center is deployed with M nodes, the second data center is deployed with N nodes, M is an even number, N is an odd number, M is greater than N, wherein the M nodes of the first data center and the N nodes of the second data center form a first cluster, the second data center obtains a working state of the first data center, when the first data center fails, the nodes of the second data center start a second cluster to provide services through a leader node of the second cluster, the leader node of the second cluster is one of the N nodes, and is used for maintaining consistency of data between the N nodes in the second cluster. In this way, the problem that the first cluster may not provide services externally when the first data center fails in the related art, and it is difficult to meet the high availability requirement is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a data disaster recovery method, apparatus, device, and computer-readable storage medium. Background Technology

[0002] As users place increasingly higher demands on data security, more and more applications are adopting clustered approaches for data storage. For example, ETCD clusters are used for data storage. An ETCD cluster is a distributed system, typically consisting of multiple nodes. These nodes communicate with each other to provide a unified service. Each node stores complete data, and consistency protocols such as Raft are used to ensure that the data maintained by each node is consistent.

[0003] If the aforementioned distributed system is deployed in a single data center, there is a risk of infrastructure failures, such as water, electricity, and network outages, leading to a loss of service. Therefore, the industry often deploys distributed systems in two separate data centers to improve availability.

[0004] A typical deployment involves placing two nodes in one data center and one node in another, forming a three-node cluster. If the data center with two nodes fails, the cluster may be unable to provide services, making it difficult to meet high availability requirements. Summary of the Invention

[0005] This application provides a data disaster recovery method that addresses the problem of a dual-datacenter architecture cluster being unable to provide services when one of the datacenters with a large number of nodes fails, thus meeting high availability requirements. This application also provides the corresponding apparatus, equipment, computer-readable storage medium, and computer program products for this data disaster recovery method.

[0006] Firstly, this application provides a data disaster recovery method. This method is applied to a first data center and a second data center. The first data center deploys M nodes, and the second data center deploys N nodes. M is an even number, N is an odd number, and M is greater than N. The M nodes of the first data center and the N nodes of the second data center form a first cluster, which provides services based on a leader node within the first cluster.

[0007] The second data center can obtain the operational status of the first data center. When the operational status of the first data center indicates a failure, the second data center starts a second cluster (a sub-cluster of the first cluster) to provide services through the leader node of the second cluster. The leader node of the second cluster is one of N nodes, and it is used to maintain data consistency among the N nodes in the second cluster.

[0008] In this way, even if the first data center fails, the application can still provide services through the second cluster, solving the problem in related technologies where a cluster cannot provide services due to the inability to elect a leader node when only one node remains. Furthermore, even if the second data center fails, more than half of the nodes in the first cluster will still be operational, enabling normal service provision. In other words, even if either the first or second data center fails, services can still be provided, meeting the requirements for high availability.

[0009] The second cluster can be pre-created and then activated in the event of a failure in the first data center. In some possible implementations, the second cluster can be created and activated in the event of a failure in the first data center. The creation time of the second cluster does not affect the specific implementation of this application.

[0010] In some possible implementations, when the first data center recovers, the second data center can add the nodes from the first data center to the second cluster. This achieves data consistency between the M nodes in the first data center and the N nodes in the second data center, further improving application availability.

[0011] In some possible implementations, the second data center can send a query request to the arbitration node to query the working status of the first data center, and then receive a query response from the arbitration node, thereby obtaining the working status of the first data center from the query response.

[0012] In some possible implementations, when the second data center recovers from a failure, it can also determine the leader node of the first cluster from among the N nodes deployed in the second data center. Specifically, the second data center can determine the leader node from within the second data center in response to a leader transfer operation triggered by a node in the first data center. That is, when the second data center is functioning normally, a node in the second data center is always the leader node, thereby ensuring that the data written to the nodes in the second data center is complete whether the second data center is faulty or functioning normally. Both the first and second data centers can store complete data, ensuring data consistency.

[0013] In some possible implementations, the first data center comprises 2K nodes, and the second data center comprises 2K-1 nodes. K is a positive integer. As an example, K can be 1 or 2, corresponding to either a 3-node cluster or a 7-node cluster. When the first cluster is a 3-node cluster, the first data center comprises 2 nodes, and the second data center comprises 1 node. When the first cluster is a 7-node cluster, the first data center comprises 3 nodes, and the second data center comprises 4 nodes. This achieves a balance between fault tolerance and performance.

[0014] Secondly, this application provides a data disaster recovery device. This device is applied to a first data center and a second data center. The first data center has M nodes, and the second data center has N nodes. M is an even number, N is an odd number, and M is greater than N. The M nodes of the first data center and the N nodes of the second data center form a first cluster, and the first cluster provides services based on the leader node in the first cluster.

[0015] The device includes a communication module and a startup module. The communication module is used to acquire the operational status of the first data center, and the startup module is used to start a second cluster to provide services through the leader node of the second cluster when the first data center fails. The leader node of the second cluster is one of the N nodes, and the leader node of the second cluster is used to maintain data consistency among the N nodes in the second cluster.

[0016] In some possible implementations, the device further includes:

[0017] An add module is used to add nodes from the first data center to the second cluster when the first data center recovers.

[0018] In some possible implementations, the communication module is specifically used for:

[0019] Send a query request to the arbitration node, the query request being used to query the working status of the first data center;

[0020] Receive a query response sent by the arbitration node, the query response including the working status of the first data center.

[0021] In some possible implementations, the device further includes:

[0022] The determination module is used to determine the leader node of the first cluster from the second data center when the second data center recovers from a failure.

[0023] In some possible implementations, the first data center comprises 2K nodes, and the second data center comprises 2K-1 nodes, where K is a positive integer. As an example, K can be 1 or 2. When K is 1, the first data center comprises 2 nodes and the second data center comprises 1 node; when K is 2, the first data center comprises 4 nodes and the second data center comprises 3 nodes.

[0024] Thirdly, this application provides a device, which may be a computer device such as a server or cloud server. The device includes a processor and a memory. The processor and the memory communicate with each other. The processor is used to execute instructions stored in the memory to cause the device to perform a data disaster recovery method as described in the first aspect or any implementation thereof.

[0025] Fourthly, this application provides a computer-readable storage medium. The computer-readable storage medium includes instructions that instruct the execution of the data disaster recovery method described in the first aspect or any implementation thereof.

[0026] Fifthly, this application provides a computer program product containing instructions. When the computer program product is run on a device such as a computer, it causes the device to perform the data disaster recovery method described in the first aspect or any implementation thereof.

[0027] Based on the implementation methods provided in the above aspects, this application can be further combined to provide more implementation methods. Attached Figure Description

[0028] To more clearly illustrate the technical methods of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly described below.

[0029] Figure 1 A system architecture diagram of a data disaster recovery method provided in this application embodiment;

[0030] Figure 2 A flowchart illustrating a data disaster recovery method provided in this application embodiment;

[0031] Figure 3 A system architecture diagram of a data disaster recovery method provided in this application embodiment;

[0032] Figure 4 A system architecture diagram of a data disaster recovery method provided in this application embodiment;

[0033] Figure 5 A schematic diagram of the structure of a data disaster recovery device provided in an embodiment of this application;

[0034] Figure 6 This is a schematic diagram of the structure of a device provided in an embodiment of this application. Detailed Implementation

[0035] The solutions in the embodiments provided in this application will now be described with reference to the accompanying drawings.

[0036] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such terms can be used interchangeably where appropriate; this is merely a way of distinguishing objects with the same attributes in the embodiments of this application.

[0037] To facilitate understanding of the technical solution of this application, some technical terms involved in this application will be introduced below.

[0038] Data disaster recovery is a technology that protects data security and improves data availability. It typically involves backing up data to ensure security and enhance availability. Depending on the backup method, data disaster recovery can generally be categorized into different levels. For example, backing up data locally on a tape drive and backing it up in a remote data center obviously have different disaster recovery levels; the latter has significantly higher capabilities than the former.

[0039] A data center is an infrastructure used for transmitting, accelerating, displaying, computing, and storing data. This infrastructure can be understood as a server room that provides power, network, cooling systems, and other services. Nodes are deployed within a data center; these nodes are devices that perform data computing and / or storage. The data center uses these nodes to achieve data transmission, acceleration, display, computing, and storage functions. Nodes can be physical devices, such as servers. Of course, nodes can also be logical devices, such as virtual machines (VMs) on servers. The data center provides power and network services to the nodes to ensure they can provide services normally.

[0040] For data security and continuous availability, many applications employ a dual-datacenter architecture to prevent service disruption due to the failure of a single data center. In a dual-datacenter architecture, both data centers can accept transactions and process the same data simultaneously. When one data center fails, transactions can continue in the other data center without requiring a system switchover.

[0041] The key to switching to another data center in the event of a data center failure lies in maintaining data consistency between the two data centers. Data consistency can generally be maintained by establishing a cluster between the two data centers. For ease of understanding, this application uses an ETCD cluster as an example.

[0042] ETCD clusters are distributed storage systems used for shared configuration and service discovery. ETCD clusters use the Raft protocol to maintain the consistency of the state of all nodes within the cluster. The Raft protocol, also known as the Raft algorithm, is a consensus algorithm. Consensus refers to multiple nodes reaching a unified view on a certain matter, even in the event of partial node failure, network latency, or network segmentation. Generally, if more than half of the nodes in an ETCD cluster reach a unified view on a certain matter, that view is considered reliable. For example, in an ETCD cluster with 4K-1 nodes (K being a positive integer), if 2K nodes reach a unified view on writing data, then all nodes in the ETCD cluster can write the data. Even if some nodes fail to update the data due to network or other reasons, data consistency will eventually be maintained.

[0043] An industry-standard dual-datacenter architecture ETCD cluster is provided. This ETCD cluster consists of two datacenters, DC1 and DC2. DC1 has two nodes, denoted as VM1 and VM3. DC2 has one node, denoted as VM2. When DC2 fails, VM1 and VM3 can form a cluster to continue providing services. However, when DC1 fails, because only VM2 remains, the ETCD cluster cannot elect a leader node, causing it to cease providing services. In this situation, application services become abnormal, failing to meet high availability requirements.

[0044] In view of this, this application provides a data disaster recovery method. This method is applied to a dual data center, specifically a first data center and a second data center. The first data center deploys M nodes, and the second data center deploys N nodes. M is even, N is odd, and M is greater than N. The M nodes of the first data center and the N nodes of the second data center form a first cluster of size M+N. The first cluster provides services based on its leader node. The second data center can obtain the working status of the first data center. When the working status of the first data center indicates a failure, the second data center can start a second cluster (a sub-cluster of the first cluster). One node of the second data center acts as the leader node of the second cluster, maintaining data consistency among the N nodes in the second cluster, thus ensuring that applications can still provide services when the first data center fails. This solves the problem in related technologies where a single node cannot elect a leader node, causing the cluster to be unable to provide services, and meets the requirements of high availability.

[0045] In a practical implementation, the first data center can include 2K nodes, and the second data center can include 2K-1 nodes, where K is a positive integer. This configuration ensures a relatively even distribution of nodes between the first and second data centers, achieving a balance between fault tolerance and performance.

[0046] To make the technical solution of this application clearer and easier to understand, the application environment of the data disaster recovery method provided in the embodiments of this application will be introduced below with reference to the accompanying drawings.

[0047] The data disaster recovery methods provided in this application include, but are not limited to, those described in the embodiments of this application. Figure 1 The application environment shown. For example... Figure 1 As shown, this scenario includes data center 102 and data center 104. Data center 102 has 2K nodes deployed, denoted as node 1 to node 2K. Data center 104 has 2K-1 nodes deployed, denoted as node 2K+1 to node 4K-1. K is a positive integer, such as 1 or 2. Correspondingly, data center 102 can include 2 nodes, and data center 104 can include 1 node. Alternatively, data center 102 can include 4 nodes, and correspondingly, data center 104 can include 3 nodes.

[0048] Data center 104 can obtain the operational status of data center 102. When data center 102 fails, data center 104 can start a second cluster. This second cluster consists of 2K-1 nodes from data center 104, i.e., nodes 2K+1 to 4K-1.

[0049] In the second cluster, the leader node is one of the nodes listed above, ranging from 2K+1 to 4K-1. Specifically, a node in the cluster is in one of three states at any given time: leader, candidate, or follower. All nodes start as followers and switch to candidate status if they do not receive a heartbeat message from the leader for a period of time. Candidate nodes can vote for themselves and send election requests to other nodes. When a candidate node receives a majority of votes (e.g., more than half the votes), it wins the election and becomes the leader. The leader node is responsible for receiving update requests (such as data write requests) from clients, replicating these requests to follower nodes, and executing them when it is "safe" (e.g., when more than half of the nodes agree), thus maintaining data consistency among the 2K-1 nodes in the second cluster.

[0050] Next, the data disaster recovery method provided in this application embodiment will be introduced from the perspective of data center 104.

[0051] See Figure 2 The flowchart shown illustrates a data disaster recovery method, which includes:

[0052] S202: The data center 104 obtains the operating status of the data center 102. When the operating status of the data center 102 indicates a fault, S204 is executed.

[0053] The data center 102 operates in two states. One state is normal operation, where the data center 102 provides power, network, and cooling systems to the nodes, enabling them to provide services normally. The other state is fault operation, where the data center 102 cannot provide power, network, or cooling systems to the nodes, causing them to be unable to provide services normally.

[0054] It's important to note that a data center 102 being in a faulty state is entirely different from a node within data center 102 being in a faulty state. When data center 102 is in a faulty state, such as during a power outage, all nodes within data center 102 will be unable to provide services. However, if one node in data center 102 is in a faulty state, the other nodes within data center 102 will still be able to provide services.

[0055] Data center 104 can obtain the operational status of data center 102 through any node deployed within data center 104, enabling data processing based on the operational status of data center 102 and thus achieving data disaster recovery. Nodes in data center 104 can obtain the operational status of data center 102 through an arbitration node.

[0056] See Figure 3 The diagram shows the structure of a data disaster recovery system, which includes data centers 102 and 104, as well as an arbitration node 106. The arbitration node 106 interacts with data centers 102 and 104. Thus, data center 104 can obtain the operational status of data center 102 through the arbitration node 106.

[0057] In some possible implementations, data center 104 can send a query request to the arbitration node 106 to inquire about the operational status of data center 102. Arbitration node 106 can determine the operational status of data center 102 based on heartbeat messages from nodes within data center 102. For example, if arbitration node 106 receives heartbeat messages from at least one node in data center 102 within a preset time period, it determines that data center 102 is in a normal operating state. If arbitration node 106 does not receive heartbeat messages from any node in data center 102 within the preset time period, it determines that data center 102 is in a faulty operating state. Arbitration node 106 generates a query response based on the operational status of data center 102 and then sends the query response to data center 104, so that data center 104 can learn about the operational status of data center 102 based on the query response.

[0058] When data center 104 learns of a failure in data center 102, it can execute S204 to ensure that data consistency between nodes is maintained and services are provided normally even when data center 102 fails.

[0059] S204: The nodes of the data center 104 start a second cluster to provide services through the leader node of the second cluster.

[0060] The leader node of the second cluster is one of the nodes in the second data center. When the second data center has N nodes, the leader node of the second cluster is one of those N nodes; when N equals 2K-1, the leader node of the second cluster is one of those 2K-1 nodes. The leader node of the second cluster is specifically responsible for maintaining data consistency among the N (N can be 2K-1) nodes in the second cluster.

[0061] When data center 102 fails, any node in data center 104, or a first pre-defined node in data center 104, can create a second cluster, for example, using commands such as `force-new-cluster`. This second cluster comprises 2,000-1 nodes deployed in data center 104. One of these 2,000-1 nodes serves as the leader node, which maintains data consistency across all 2,000-1 nodes in the second cluster.

[0062] The leader node of the second cluster can be a second preset node among 2K-1 nodes. This second preset node can be the same node as the first preset node, or it can be a different node. When the nodes of data center 104 create the second cluster, the second preset node can send a notification message to other nodes in the second cluster to inform them that the leader node is the aforementioned second preset node. This reduces the additional overhead caused by operations such as election.

[0063] In some implementations, the leader node of the second cluster can also be determined through election. When the second cluster is created, the 2K-1 nodes deployed in data center 104 change from follower nodes to candidate nodes. Candidate nodes vote for themselves and send election requests to other nodes in the second cluster. When a candidate node receives a majority of votes, that candidate node becomes the leader node.

[0064] In some implementations, data center 104 may also pre-create a second cluster, determine the leader node of the second cluster, and then start the second cluster in the event of a failure of the first data center to provide services through the leader node of the second cluster.

[0065] When data center 104 fails, data center 102 comprises 2K nodes, exceeding the number of nodes in the first cluster. Therefore, when these 2K nodes reach a consensus on update requests (such as data write requests), data consistency among these 2K nodes in the first cluster can still be maintained. When data center 104 recovers, the leader node in the first cluster can again execute update requests (such as data write requests) to write data to the 2K-1 nodes deployed in data center 104, thereby maintaining data consistency among the 4K-1 nodes in the first cluster.

[0066] In this embodiment, the number of nodes deployed in data centers 102 and 104 can be set according to business needs. Considering fault tolerance, more nodes can be deployed in data centers 102 and 104. Considering performance, fewer nodes can be deployed in data centers 102 and 104. Taking both fault tolerance and performance into account, K can be 1 or 2.

[0067] Based on this, in some possible implementations, data center 102 can be deployed with two nodes, and data center 104 can be deployed with one node. In this implementation, when data center 102 fails, the nodes in data center 104 can create a single-node cluster, which is the second cluster mentioned above. This single-node cluster can use one node from data center 104 as the leader node to maintain data consistency among different nodes in the second cluster.

[0068] In some other possible implementations, data center 102 can be deployed with 4 nodes, and data center 104 can be deployed with 3 nodes. In this implementation, when data center 102 fails, the nodes in data center 104 can create a three-node cluster, which is the second cluster mentioned above. The leader node in the three-node cluster can be a second preset node or a node determined by election; this embodiment does not limit this.

[0069] Based on the above description, the data disaster recovery method provided in this application embodiment supports the following in a dual-center data disaster recovery system: when one data center (i.e., the first data center) with a large number of nodes fails, the other data center (i.e., the second data center) can independently create a second cluster. One node in the second data center acts as the leader node of the second cluster, maintaining data consistency among different nodes in the second cluster. This ensures that applications can still provide services when the first data center fails. Thus, it solves the problem in related technologies where a single node cannot elect a leader node, causing the cluster to be unable to provide services, and meets the requirements of high availability.

[0070] exist Figure 2 In the illustrated embodiment, when data center 102 recovers, that is, when it switches from a faulty working state to a normal working state, data center 104 adds the nodes of data center 102 to the second cluster. Specifically, the nodes of data center 104 include the leader node of the second cluster, which can add the nodes deployed in data center 102 to the second cluster using a member add command such as the member add command.

[0071] In some possible implementations, when data center 104 recovers from a failure, i.e., when it switches from a failed operating state to a normal operating state, data center 104 can determine the leader node of the first cluster from among the nodes deployed in data center 104. Specifically, data center 104 can determine the leader node from among the nodes in data center 104 in response to a leader node transfer operation triggered by a node in data center 102. The node in data center 102 that is the leader node can transfer its leader privileges to a node in data center 104 using a leader transfer command, such as the `move leader` command. The leader node of the first cluster is then switched from a node deployed in data center 102 to a node deployed in data center 104.

[0072] To facilitate understanding of the technical solution of this application, the following example illustrates the data disaster recovery method by deploying two nodes, namely VM1 and VM3, in data center 102 and one node, namely VM2, in data center 104.

[0073] See Figure 4 The diagram shows the structure of the data disaster recovery system. Nodes VM1, VM2, and VM3 deployed in data centers 102 and 104 form a three-node ETCD cluster. Each node in the ETCD cluster has a monitoring program. When the monitoring program runs, the node can call the arbitration proxy interface corresponding to the arbitration service provided by arbitration node 106 to perform arbitration.

[0074] Specifically, the monitoring program of node VM2 deployed in data center 104 calls the arbitration agent interface of arbitration node 106 to determine the working status of data center 102. When data center 102 fails, VM2 uses the force-new-cluster command to automatically transform the ETCD cluster into a single-node cluster. VM2 is the leader node of the single-node cluster.

[0075] When VM2's monitoring program determines that data center 102 has recovered by calling the arbitration agent interface of arbitration node 106, VM2, as the leader node, uses the member add command to add VM1 and VM3 to the new cluster.

[0076] When data center 104 fails, nodes VM1 and VM3 in data center 102 remain available. The ETCD cluster can use its own election capabilities to determine either VM1 or VM3 as the leader node, and high availability of the cluster service can still be achieved based on this leader node. When data center 104 recovers, i.e., when it switches from a failed working state to a normal working state, the ETCD cluster can bring VM2 into cluster management. VM1 or VM3 transfers leader privileges using the `move leader` command, making VM2 the leader node. This ensures that data written to VM2 is complete whether data center 102 is faulty or functioning normally, and that complete data is stored in both data centers 102 and 104, thus guaranteeing data consistency.

[0077] The method provided in this application can solve the problem of service unavailability caused by the inability to elect a leader when the entire data center with many nodes fails in a dual-data center disaster recovery system, thus meeting high availability requirements. Furthermore, this method eliminates the need to build three data centers to ensure the odd number of nodes required for the ETCD cluster, reducing data disaster recovery costs.

[0078] The above combination Figures 1 to 4 The data disaster recovery method provided in the embodiments of this application will be described in detail. Next, the data disaster recovery device and equipment provided in the embodiments of this application will be introduced with reference to the accompanying drawings.

[0079] See Figure 5 The diagram shows the structure of a data disaster recovery device 500, which is applied to a first data center and a second data center. The first data center has M nodes, and the second data center has N nodes. M is an even number, N is an odd number, and M is greater than N. The M nodes of the first data center and the N nodes of the second data center form a first cluster.

[0080] The device 500 includes:

[0081] Communication module 502 is used to obtain the working status of the first data center;

[0082] The startup module 504 is used to start the second cluster to provide services through the leader node of the second cluster when the working status of the first data center indicates that the first data center is faulty. The leader node of the second cluster is one of the N nodes, and the leader node is used to maintain the consistency of data among the N nodes in the second cluster.

[0083] For a detailed implementation of the communication module 502, please refer to [link / reference needed]. Figure 2 The description of S202 in the illustrated embodiment, and the specific implementation of the startup module 504 can be found in [reference needed]. Figure 2 The description of S204 in the illustrated embodiment will not be repeated here.

[0084] In some possible implementations, the device 500 further includes:

[0085] Add module 506 to add the nodes of the first data center to the second cluster when the first data center recovers.

[0086] For details on the implementation of module 506, please refer to [link / reference]. Figure 2 The relevant content described in the illustrated embodiments will not be repeated here.

[0087] Among some possible implementations,

[0088] The communication module 502 is specifically used for:

[0089] Send a query request to the arbitration node, the query request being used to query the working status of the first data center;

[0090] Receive a query response sent by the arbitration node, the query response including the working status of the first data center.

[0091] In some possible implementations, the device 500 further includes:

[0092] The determination module 508 is used to determine the leader node from the second data center when the second data center recovers from a failure.

[0093] For a detailed implementation of module 508, please refer to [link / reference]. Figure 2 The relevant content described in the illustrated embodiments will not be repeated here.

[0094] In some possible implementations, the first data center includes 2K nodes, and the second data center includes 2K-1 nodes, where K is a positive integer.

[0095] The data disaster recovery device 500 according to the embodiments of this application can correspond to the execution of the methods described in the embodiments of this application, and the above and other operations and / or functions of each module / unit of the data disaster recovery device 500 are respectively for implementing Figure 2 For the sake of brevity, the corresponding processes of each method in the illustrated embodiments will not be described in detail here.

[0096] This application also provides a device. This device can be a physical device such as a server, or a virtualized device such as a cloud server. Specifically, this device is used to implement, for example... Figure 5 The data disaster recovery device 500 in the illustrated embodiment has the following functions.

[0097] Figure 6 A structural schematic diagram of a device 600 is provided, such as... Figure 6 As shown, device 600 includes a bus 601, a processor 602, a communication interface 603, and a memory 604. The processor 602, memory 604, and communication interface 603 communicate via bus 601. Bus 601 can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, Figure 6 The bus is represented by a single thick line, but this does not indicate that there is only one bus or one type of bus. Communication interface 603 is used for external communication. For example, it receives update requests (such as data write requests), sends query requests to arbitration node 106, receives query responses from arbitration node 106, and so on.

[0098] The processor 602 may be a central processing unit (CPU). The memory 604 may include volatile memory, such as random access memory (RAM). The memory 604 may also include non-volatile memory, such as read-only memory (ROM), flash memory, HDD, or SSD.

[0099] The memory 604 stores executable code, and the processor 602 executes the executable code to perform the aforementioned data disaster recovery method.

[0100] Specifically, in achieving Figure 5 In the case of the illustrated embodiment, and Figure 5 When the modules of the data disaster recovery device 500 described in the embodiment are implemented in software, the following steps are performed: Figure 5 The software or program code required for the functions of the startup module 504, addition module 506, and determination module 508 are stored in the memory 604. The communication module 102 obtains the working status of the first data center, such as data center 102, and transmits it to the processor 602 via the bus 601. The processor 602 executes the program code corresponding to each module stored in the memory 604, such as the program code corresponding to the startup module 504, to start the second cluster to provide services through the leader node of the second cluster when the working status of the first data center indicates a failure. In this way, the application can still provide services to the outside world based on the second cluster, thereby realizing data disaster recovery.

[0101] Of course, processor 602 can also execute program code corresponding to add module 506 to add nodes from the first data center to the second cluster when the first data center recovers. Processor 602 can also execute program code corresponding to determine module 508 to re-determine the leader node from the second data center in response to a leader node transfer operation triggered by nodes from the first data center when the second data center recovers from a failure.

[0102] This application also provides a computer-readable storage medium including instructions that instruct device 600 to perform the data disaster recovery method applied to data disaster recovery device 500 described above.

[0103] This application also provides a computer-readable storage medium including instructions that instruct device 600 to perform the data disaster recovery method applied to data disaster recovery device 500 described above.

[0104] This application also provides a computer program product, which, when executed by a computer, enables the computer to perform any of the aforementioned data disaster recovery methods. The computer program product can be a software installation package; when any of the aforementioned data disaster recovery methods needs to be used, the computer program product can be downloaded and executed on the computer.

Claims

1. A data disaster recovery method, characterized by, The method is applied to a first data center and a second data center, the first data center is deployed with M nodes, the second data center is deployed with N nodes, M is even, N is odd, M is greater than N, the M nodes of the first data center and the N nodes of the second data center form a first cluster, the first cluster provides services based on a leader node in the first cluster, when the second data center fails, more than half of the nodes of the first cluster work, the first cluster normally provides services, and the method comprises: The second data center obtains the working state of the first data center; When the working state of the first data center indicates that the first data center fails, the second data center starts a second cluster to provide services through a leader node of the second cluster, the second cluster is a sub-cluster of the first cluster, the second cluster includes the N nodes, the leader node of the second cluster is one of the N nodes, and the leader node of the second cluster is used to maintain consistency of data among the N nodes in the second cluster.

2. The method of claim 1, wherein, The method further comprises: When the first data center recovers, the second data center adds the nodes of the first data center to the second cluster.

3. The method of claim 1, wherein, The second data center obtains the working state of the first data center, comprising: The second data center sends a query request to an arbitration node, the query request is used to query the working state of the first data center; The second data center receives a query response sent by the arbitration node, and the query response includes the working state of the first data center.

4. The method according to any one of claims 1 to 3, characterized in that, The method further comprises: When the second data center recovers from failure, the leader node of the first cluster is determined from the second data center.

5. The method according to any one of claims 1 to 3, characterized in that, The first data center includes 2K nodes, the second data center includes 2K-1 nodes, and K is a positive integer.

6. A data disaster recovery apparatus, characterized by comprising: The method is applied to a first data center and a second data center, the first data center is deployed with M nodes, the second data center is deployed with N nodes, M is even, N is odd, M is greater than N, the M nodes of the first data center and the N nodes of the second data center form a first cluster, the first cluster provides services based on a leader node in the first cluster, when the second data center fails, more than half of the nodes of the first cluster work, the first cluster normally provides services, and the method comprises: The communication module is configured to obtain the working state of the first data center; The starting module is configured to start a second cluster to provide services through a leader node of the second cluster when the working state of the first data center indicates that the first data center fails, the second cluster is a sub-cluster of the first cluster, the second cluster includes the N nodes, the leader node of the second cluster is one of the N nodes, and the leader node of the second cluster is used to maintain consistency of data among the N nodes in the second cluster.

7. The apparatus of claim 6, wherein, The device further comprises: An adding module, configured to add the node of the first data center to the second cluster when the first data center recovers.

8. The apparatus of claim 6, wherein, The communication module is specifically configured to: send a query request to an arbitration node, the query request being used to query a working state of the first data center; receive a query response sent by the arbitration node, the query response including the working state of the first data center.

9. The apparatus of any one of claims 6 to 8, wherein, The apparatus further includes: a determining module, configured to determine a leader node of the first cluster from the second data center when the second data center recovers from failure.

10. The apparatus of any one of claims 6 to 8, wherein, The first data center includes 2K nodes, and the second data center includes 2K-1 nodes, where K is a positive integer.

11. An electronic device, comprising: The electronic device includes a processor and a memory; The processor is configured to execute instructions stored in the memory, so that the electronic device performs the data disaster recovery method according to any one of claims 1 to 5.

12. A computer-readable storage medium, characterized in that, The computer readable storage medium includes instructions for instructing a computer to perform the data disaster recovery method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Data management method and system, electronic equipment and storage medium

    CN109600430A