A computer room disaster recovery processing method, system, scheduling node and storage medium
By placing the nodes of the host and backup computer rooms in the same cluster, using database group replication and cluster manager Raft protocol, the computer room can be switched in seconds and data consistency, solving the problems of inconvenient management and poor user experience in dual cluster mode. , improves business availability and data consistency.
Patent Information
- Application Number
- CN202410098921.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-24
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2044-01-24
AI Technical Summary
In the existing computer room disaster recovery plan, a cluster is deployed in the main and backup computer rooms under the dual cluster mode, resulting in inconvenient data and topology management, poor user experience during business switching, single function of the backup computer room, and traditional main and backup copy mode is difficult to ensure data. consistency.
The computer room is downgraded when the host room fails and the backup room upgrade method realizes the computer room level switching. By placing the nodes of the host room and the backup room in the same cluster, using database group replication and cluster manager Raft protocol, data consistency and business are achieved. Non-perception switching.
It realizes second-level switching between computer rooms, simplifies data and topological structure management, improves user experience, and enriches the functions of backup computer rooms nodes, allowing them to participate in data consistency voting and master selection, ensuring data consistency.
Smart Images

Figure CN117938629B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer room disaster recovery, and in particular to a computer room disaster recovery processing method, system, scheduling node and storage medium. Background Art
[0002] In a single computer room deployment, force majeure problems (such as power outages, network disconnections, etc.) may occur, causing the cluster to be unable to provide services normally, causing potential losses to the business. Therefore, in the field of financial-level high availability, in order to avoid user losses, a multi-active mechanism based on computer rooms in the same city or in different locations is needed. While ensuring the consistency of data in each computer room, the high availability problems caused by the single point of the computer room are minimized to the greatest extent. Dual computer rooms are one of the solutions. When the main computer room fails, it can quickly switch to the backup computer room to provide external services, and the recovery time can be as low as seconds; when the backup computer room fails, the main computer room can still provide external services normally; after the failed computer room is restored, it can also rejoin the database cluster.
[0003] The existing solutions generally adopt a dual-cluster mode. The dual-cluster mode deploys a cluster in the main and standby computer rooms respectively, which is not conducive to the efficient management of data and topology. At the same time, in the dual-cluster mode, when the main computer room fails and switches to the standby computer room, the upper-layer business needs to be rerouted to the new cluster entrance, which is obvious to the business end and is not user-friendly. In addition, in the existing solutions, the standby computer room is often only a data copy of the main computer room and has a relatively simple function. Moreover, there are three main types of traditional master-standby replication modes. One is the synchronous mode. The nodes in the standby computer room may respond slowly, which will affect the performance of the main computer room. The remaining two are semi-synchronous or asynchronous modes. If the computer room fails and the switchover fails, it cannot guarantee that the data in the standby computer room is consistent with that in the main computer room. Summary of the invention
[0004] The embodiment of the present invention provides a computer room disaster recovery processing method, system, scheduling node and storage medium, which realizes the computer room switching in seconds by downgrading the main computer room and upgrading the backup computer room when the main computer room fails. The nodes of the main and backup computer rooms are in the same cluster, making the computer room switching simpler.
[0005] In a first aspect, an embodiment of the present invention provides a computer room disaster recovery processing method, which is applied to a cluster manager of a computer room disaster recovery processing system, wherein the computer room disaster recovery processing system is deployed with at least a main computer room and a backup computer room, wherein the main computer room and the backup computer room respectively include at least a database, a cluster manager, and an application agent, wherein each node in the main computer room and each node in the backup computer room are in the same cluster, the database of the main computer room and the database of the backup computer room are in the same database cluster, and the cluster manager of the main computer room and the cluster manager of the backup computer room are in the same cluster manager cluster, wherein the method comprises:
[0006] Receive a request from a client to downgrade the computer room of the main computer room;
[0007] Setting the first application agent in the computer room to prohibit providing external write services and downgrading the database master node and the cluster manager leader in the computer room respectively;
[0008] Receive a request from a client for upgrading the backup computer room;
[0009] The database standby node in the standby computer room is switched to a new database master node, the cluster manager follower is switched to a new cluster manager leader, and the second application agent in the standby computer room is set to provide external write services.
[0010] In a second aspect, an embodiment of the present invention provides a computer room disaster recovery processing system, wherein the system is deployed with at least a main computer room and a backup computer room, wherein the main computer room and the backup computer room respectively include at least a database, a cluster manager, and an application agent, wherein each node in the main computer room and each node in the backup computer room are in the same cluster, the database of the main computer room and the database of the backup computer room are in the same database cluster, and the cluster manager of the main computer room and the cluster manager of the backup computer room are in the same cluster manager cluster; the cluster manager is specifically used to:
[0011] Receive a request from a client to downgrade the computer room of the main computer room;
[0012] Setting the first application agent in the computer room to prohibit providing external write services and downgrading the database master node and the cluster manager leader in the computer room respectively;
[0013] Receive a request from a client for upgrading the backup computer room;
[0014] The database standby node in the standby computer room is switched to a new database master node, the cluster manager follower is switched to a new cluster manager leader, and the second application agent in the standby computer room is set to provide external write services.
[0015] In a third aspect, an embodiment of the present invention further provides a scheduling node, the scheduling node comprising:
[0016] at least one processor; and
[0017] a memory communicatively connected to the at least one processor; wherein,
[0018] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the computer room disaster recovery processing method described in the first aspect embodiment.
[0019] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the computer room disaster recovery processing method as described in the embodiment of the first aspect when executing the computer room disaster recovery processing method.
[0020] The embodiment of the present invention provides a computer room disaster recovery processing method, system, scheduling node and storage medium. The method is applied to a cluster manager of a computer room disaster recovery processing system. The computer room disaster recovery processing system is deployed with at least a main computer room and a standby computer room. The main computer room and the standby computer room respectively include at least a database, a cluster manager and an application agent. Each node in the main computer room and each node in the standby computer room are in the same cluster. The database of the main computer room and the database of the standby computer room are in the same database cluster. The cluster manager of the main computer room and the cluster manager of the standby computer room are in the same cluster manager cluster. The method comprises: receiving a computer room downgrade request for the main computer room sent by a client; setting a first application agent in the main computer room to prohibit providing external write services and performing downgrade processing on the database master node and the cluster manager leader in the main computer room respectively; receiving a computer room upgrade request for the standby computer room sent by a client; switching the database standby node in the standby computer room to a new database master node, switching the cluster manager follower to a new cluster manager leader and setting the second application agent in the standby computer room to provide external write services. Using this method, based on the dual computer room deployment in the database cluster and cluster manager cluster mode, when the standby computer room fails, the cluster can remain healthy; when the main computer room fails, the computer room can be switched in seconds by downgrading the main computer room and upgrading the standby computer room. The nodes of the main and standby computer rooms are in the same cluster, which provides great convenience for the management of data and topology structure; and the databases of the main and standby computer rooms use a database cluster, which makes computer room switching simpler. When the computer room fails, the upper-layer business does not need to be rerouted to the new cluster entrance, and the business layer is almost unaware, which improves the user experience. At the same time, because the nodes of the main and standby computer rooms are in the same database cluster, the relationship between the nodes of the main and standby computer rooms is no longer just a replication relationship. The nodes of the standby computer room will also participate in the data consistency voting and the election of the master, enriching the functions of the standby nodes.
[0021] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0023] Figure 1 A schematic diagram of a process flow of a computer room disaster recovery processing method provided in the first embodiment of the present invention;
[0024] Figure 2 An example diagram of the relationship between nodes in a computer room during the execution of a computer room disaster recovery processing method provided in the first embodiment of the present invention;
[0025] Figure 3 An example diagram of a database cluster in the execution of a computer room disaster recovery processing method provided in the first embodiment of the present invention;
[0026] Figure 4 An example diagram of a cluster manager cluster in the execution of a computer room disaster recovery processing method provided in the first embodiment of the present invention;
[0027] Figure 5 An example diagram of cluster recovery in the execution of a computer room disaster recovery processing method provided in the first embodiment of the present invention:
[0028] Figure 6 A schematic diagram of a process flow of another computer room disaster recovery processing method provided in Embodiment 2 of the present invention;
[0029] Figure 7 An example diagram of a main machine room degradation during the execution of a machine room disaster recovery processing method provided in the second embodiment of the present invention;
[0030] Figure 8 An example diagram of database degradation in the execution of a computer room disaster recovery processing method provided in the second embodiment of the present invention;
[0031] Fig. 9 An example diagram of database degradation in the execution of a computer room disaster recovery processing method provided in the second embodiment of the present invention;
[0032] Fig.10 An example diagram of upgrading a standby computer room during the execution of a computer room disaster recovery processing method provided in the second embodiment of the present invention;
[0033] Fig.11 An example diagram of a database upgrade in the execution of a computer room disaster recovery processing method provided in the second embodiment of the present invention;
[0034] Fig.12 A schematic diagram of the structure of a computer room disaster recovery processing system provided in Embodiment 3 of the present invention;
[0035] Fig.13 A schematic diagram of the structure of another computer room disaster recovery processing system provided in Embodiment 3 of the present invention;
[0036] Fig.14 A structural diagram of another computer room disaster recovery processing system provided in Embodiment 3 of the present invention;
[0037] Fig.15 A structural diagram of another computer room disaster recovery processing system provided in Embodiment 3 of the present invention;
[0038] Fig.16 A schematic diagram of the structure of a scheduling node provided in Embodiment 4 of the present invention. DETAILED DESCRIPTION
[0039] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0040] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention 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 interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those 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 units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0041] In the existing scheme, the dual cluster mode is generally adopted. The dual cluster mode is to deploy a set of clusters in the main and standby computer rooms respectively. For example, the method and device for synchronizing distributed database nodes based on an external observer group, the scheme provides a method for synchronizing distributed database nodes based on external observers. The method includes: when the distributed database cluster fails, the external observer group makes a unified survival judgment on the entire database cluster; based on the external observer group, the surviving nodes in the database cluster are voted to elect the master node, and the remaining surviving nodes are standby nodes; the data of the master node is copied to the standby node for synchronization. In this scheme, the data replication between the master and standby nodes is implemented by the semi-synchronous replication protocol, and the master election is implemented by the Replication And Fault Tolerant (Raft) protocol. The Raft state machine is implemented at the data table engine layer. In the dual cluster mode of this scheme, a set of clusters are deployed in the main and standby computer rooms respectively, which is not conducive to the efficient management of data and topology. In the dual cluster mode, when the main computer room fails and switches to the standby computer room, the upper-layer business needs to be rerouted to the new cluster entrance, which is obvious to the business end and is less user-friendly. In this solution, the backup computer room is often just a data copy of the main computer room, with a single function. In the traditional master-slave replication mode, the nodes in the backup computer room may respond slowly, which will also affect performance.
[0042] Embodiment 1
[0043] Figure 1 A flow chart of a method for disaster recovery processing in a computer room provided in Embodiment 1 of the present invention is provided. The method can be applicable to the situation where disaster recovery processing is performed on a computer room. The method can be executed by a cluster manager of a computer room disaster recovery processing system, wherein the cluster manager can be implemented by software and / or hardware and is generally deployed in the computer room disaster recovery processing system.
[0044] The computer room disaster recovery processing system is deployed with at least a main computer room and a backup computer room. The main computer room and the backup computer room respectively include at least a database, a cluster manager and an application agent. Each node in the main computer room and each node in the backup computer room are in the same cluster, the database of the main computer room and the database of the backup computer room are in the same database cluster, and the cluster manager of the main computer room and the cluster manager of the backup computer room are in the same cluster manager cluster.
[0045] In this embodiment, the main computer room includes at least a database, a cluster manager, and an application agent, and the standby computer room also includes at least a database, a cluster manager, and an application agent. The computer room may also include a database agent. Different from the dual cluster mode in the prior art, in which the main and standby computer rooms are each deployed with a cluster, in this embodiment, each node of the dual computer room is in the same cluster.
[0046] It should be noted that, before performing the computer room disaster recovery process, this embodiment needs to initialize the cluster consisting of the main computer room and the backup computer room through the computer room management. Specifically, it includes: setting a computer room name for each server deployed in the cluster. When the database cluster is started, it will determine the computer room where it is located by judging the computer room name of the server, and then set the computer room label for each component in turn. For example, the computer room of the main computer room is numbered 1, and server A and server B are located in the main computer room. The computer room label of the database and cluster manager running on server A and server B is 1. Among them, the application agent and database agent are stateless, and the computer room information is stored in the memory after initialization. The cluster manager and database persist the computer room information in a file.
[0047] Figure 2 An example diagram of the relationship between nodes in a computer room during the execution of a computer room disaster recovery processing method provided in the first embodiment of the present invention is shown in FIG. Figure 2 As shown in the figure, the relationship between the nodes in the computer room is as follows:
[0048] Application proxy: It is the business request entry point and forwards the request to the database master node.
[0049] Cluster manager: It is the management component of the database cluster, which is mainly responsible for the status detection and fault repair of the underlying database cluster. At the same time, this component itself is also a high-availability management component cluster implemented through the Raft protocol. Therefore, in addition to the management of the underlying database cluster, it also integrates the retirement and recovery functions of the management component itself. The cluster consists of a leader and several followers. The recommended number is an odd number of 3 or more.
[0050] Database agent: mainly responsible for starting and stopping the database and registering database information operations.
[0051] Database: A system that independently stores and manages data. Multiple databases use a group replication architecture to form a multi-copy cluster. The cluster contains a master node and several backup nodes. The recommended number is 3 or more.
[0052] Preferably, the database cluster is implemented based on database group replication technology, and the cluster manager cluster is implemented based on a distributed consistency protocol.
[0053] Among them, database group replication (GR) technology is a new database replication technology that provides a way to create a highly available system between servers. It is based on the Paxos algorithm and creates a replication group so that the databases in the group can work together. It can ensure data consistency, provide fault tolerance, and automatically manage the servers in the group.
[0054] The Paxos algorithm is an algorithm that solves the consistency problem in distributed systems. Its main goal is to reach a consensus decision in a distributed system composed of multiple nodes even if a few nodes fail. The main advantage of the Paxos algorithm is that it can ensure the consistency of the system at any time, even in the event of network partitions or node failures.
[0055] Figure 3 An example diagram of a database cluster in the execution of a computer room disaster recovery processing method provided in the first embodiment of the present invention, such as Figure 3 As shown in the figure, it is assumed that database 1 and database 2 are deployed in the main computer room, and database 3 is deployed in the standby computer room. Database 1, database 2 and database 3 use the GR group replication architecture to form a multi-copy database cluster. Among them, database 1 is the master node, and database 2 and database 3 are slave nodes.
[0056] The cluster manager cluster is implemented based on a distributed consistency protocol. The Raft protocol is currently the most widely used distributed consistency protocol. The leader is selected through a majority mechanism. When a node receives more than N / 2 votes, it becomes the leader, where N is the number of nodes. The remaining nodes become followers, and the leader and followers maintain communication through a timed heartbeat mechanism. Figure 4 An example diagram of a cluster manager cluster in the execution of a computer room disaster recovery processing method provided in the first embodiment of the present invention, such as Figure 4 As shown, it is assumed that cluster manager 1 and cluster manager 2 are deployed in the main computer room, and cluster manager 3 is deployed in the standby computer room. Cluster manager 1, cluster manager 2 and cluster manager 3 form a cluster manager cluster based on the Raft protocol. Among them, cluster manager 1 is the leader, and cluster manager 2 and cluster manager 3 are followers.
[0057] It should be noted that the computer room disaster recovery processing method provided in this embodiment is different from the semi-synchronous replication method adopted in the above-mentioned existing scheme; in this embodiment, a group replication replication architecture is adopted, and the final consistency of distributed data is achieved based on the Paxos algorithm. When a transaction is submitted, it must be authenticated and passed by more than half of the nodes in the group before it can be submitted. Moreover, since a majority response mechanism is adopted, the slow response of individual nodes does not have much impact on the master node. The master selection method is different. In the above-mentioned existing scheme, the scheduler also participates in the voting process; in this embodiment, the master selection under the majority of the cluster is automatically completed by the group replication plug-in, and the master selection and reconstruction of the cluster is completed by the scheduler under the minority. The functions of the scheduler are not exactly the same. The main functions of the scheduling node in the above-mentioned existing scheme are to perform survival judgment, voting and election on the database cluster; the main function of the scheduling node in this embodiment is the fault switching of the computer room.
[0058] like Figure 1As shown, the computer room disaster recovery processing method provided in this embodiment may specifically include the following steps:
[0059] S101: Receive a request for downgrading a computer room from a client.
[0060] The computer room with the majority nodes is recorded as the main computer room, and the computer room with the minority nodes is recorded as the backup computer room. It can be considered that in general, the main computer room provides services to the outside world, and when the main computer room fails, it switches to the backup computer room to provide services to the outside world.
[0061] In this embodiment, based on the dual computer room deployment in the database cluster (i.e., database group replication cluster) and cluster manager cluster (i.e., manager Raft cluster) modes, when the standby computer room fails, the cluster can remain healthy; when the main computer room fails, the computer room switching can be achieved in seconds by downgrading the main computer room and upgrading the standby computer room. It can be considered that when a failure occurs in the main computer room, the computer room disaster recovery process includes downgrading the main computer room and upgrading the standby computer room. When a disaster recovery level failure occurs in the main computer room, it is necessary to downgrade the main computer room and decommission the nodes of the main computer room. Then, the standby computer room is upgraded, and the standby computer room provides services to the outside world. After the standby computer room failure is restored, the dual computer room cluster is restored to health through cluster recovery operations. The executor of this embodiment can be considered to be a cluster manager.
[0062] When a failure occurs in the main computer room, disaster recovery processing is required, that is, the main computer room is retired and switched to the backup computer room to provide external services. In this embodiment, when the main computer room needs to be downgraded, the user or management software sends a computer room downgrade request to the cluster manager in the specified computer room. Among them, the user can send the computer room downgrade request through human-computer interaction, or the management software that manages the computer room can send the computer room downgrade request when it detects a failure in the main computer room. In this embodiment, the user's human-computer interaction method or the management software method is collectively referred to as a client-based operation method. The client sends a computer room downgrade request to all cluster managers in a polling manner. Correspondingly, the cluster manager receives the computer room downgrade request for the main computer room sent by the client.
[0063] S102: Setting the first application agent in the computer room to prohibit providing external write services and downgrading the database master node and the cluster manager leader in the computer room respectively.
[0064] The main computer room includes at least application agent, database and cluster manager nodes. When the main computer room is in normal state, the main computer room provides external services by default. The application agent in the main computer room is recorded as the first application agent. The main computer room has a database master node and a cluster manager leader.
[0065] In this embodiment, the downgrading of the computer room mainly includes prohibiting the application agent located in the computer room from providing external write services, and downgrading the cluster manager leader and the master node of the database in the computer room, such as switching to other computer rooms or forcibly exiting the cluster.
[0066] Exemplarily, the steps for processing the nodes in the main computer room can be described as follows: the cluster manager sets the application agent in the designated computer room to read-only and rejects write requests. The cluster manager issues a downgrade request to the database in the computer room. The downgrade of the database can be divided into graceful switching and forced exit. Graceful switching means that the switching operation is performed after the currently executing transaction is committed normally. If the master node is located in the designated downgraded computer room, the master node is switched to another computer room. If the graceful switching fails, you can continue to try to force exit; forced exit will force the database to leave the database cluster. The cluster manager cluster performs graceful switching or forced exit. Graceful switching means that if the cluster manager leader is located in the designated downgraded computer room, the leader is switched to another computer room. If the graceful switching fails, you can continue to try to force exit; forced exit will force the leader located in the downgraded computer room to leave the cluster manager cluster.
[0067] S103: Receive a computer room upgrade request for the standby computer room sent by the client.
[0068] In this embodiment, when a failure occurs in the main computer room, disaster recovery processing is required, that is, the main computer room is retired and switched to the standby computer room to provide external services. In this embodiment, after the main computer room is downgraded, the standby computer room also needs to be upgraded. The user or management software sends a computer room upgrade request to the cluster manager in the specified computer room. Among them, the user can send the computer room upgrade request through human-computer interaction, or the management software that manages the computer room can send the computer room upgrade request. In this embodiment, the user adopts the human-computer interaction method or the management software method collectively referred to as the client-based operation method. The client sends a computer room upgrade request to all cluster managers in a polling manner. Correspondingly, the cluster manager receives the computer room upgrade request for the standby computer room sent by the client. It can be understood that the client sends computer room downgrade and upgrade commands to all cluster managers in a polling manner.
[0069] S104: Switch the database standby node in the standby computer room to a new database master node, switch the cluster manager follower to a new cluster manager leader, and set the second application agent in the standby computer room to provide external write services.
[0070] The standby computer room at least includes application agent, database and cluster manager nodes. The application agent in the standby computer room is recorded as the second application agent. The standby computer room has a database standby node and a cluster manager follower.
[0071] In this embodiment, the computer room upgrade mainly includes switching the designated cluster manager follower in the computer room to the leader, switching the backup node of the database to the master node, and setting the application agent in the computer room to provide read and write services to the outside.
[0072] Exemplarily, the steps for processing the nodes in the standby computer room can be described as follows: the cluster manager sends an upgrade request to the database in the computer room. The upgrade of the database can be divided into graceful switching and forced master switching. Graceful switching refers to performing a switching operation after the currently executing transaction is normally committed. If the master node is located in another computer room, the master node is switched to the current computer room. If the graceful switching fails, you can continue to try to force the master switch; forced master switching will force the database to leave the group database cluster, declare itself as the master node and reorganize the new cluster. After the database upgrade is successful, the cluster manager will set a minority writable label for the database so that the cluster composed of a single master node can provide read and write services. The cluster manager cluster performs graceful switching or forced master switching. Similar to the database, graceful switching means that if the cluster manager leader is located in another computer room, the leader is switched to the current computer room. If the graceful switching fails, you can continue to try to force the master switch; forced master switching will force the specified cluster manager in the computer room to exit the cluster manager cluster and declare itself as the leader to create a new cluster. The cluster manager sets the application agent in the specified computer room to be readable and writable, so that it can provide services to the outside world normally.
[0073] The above are the two main operations of switching the computer room. In actual scenarios, the client sends computer room downgrade and upgrade commands to all cluster management components in a polling manner. For the downgrade operation, the downgrade is considered successful only when all components (i.e. nodes) in the specified computer room return success. Because the computer room to be downgraded may have failed, if a connection error is returned, the response is still counted as successful. For the upgrade operation, as long as any management component returns success, the upgrade is considered successful. If the downgrade and upgrade of the computer room are both successful, the computer room switch can be considered successful.
[0074] The embodiment of the present invention provides a computer room disaster recovery processing method, the method is applied to the cluster manager of the computer room disaster recovery processing system, the computer room disaster recovery processing system is deployed with at least a main computer room and a standby computer room, the main computer room and the standby computer room respectively include at least a database, a cluster manager and an application agent, each node in the main computer room and each node in the standby computer room are in the same cluster, the database of the main computer room and the database of the standby computer room are in the same database cluster, the cluster manager of the main computer room and the cluster manager of the standby computer room are in the same cluster manager cluster, the method comprises: receiving a computer room downgrade request for the main computer room sent by a client; setting a first application agent in the main computer room to prohibit providing external write services and performing downgrade processing on the database master node and the cluster manager leader in the main computer room respectively; receiving a computer room upgrade request for the standby computer room sent by the client; switching the database standby node in the standby computer room to a new database master node, switching the cluster manager follower to a new cluster manager leader, and setting the second application agent in the standby computer room to provide external write services. Using this method, based on the dual computer room deployment in the database cluster and cluster manager cluster mode, when the standby computer room fails, the cluster can remain healthy; when the main computer room fails, the computer room can be switched in seconds by downgrading the main computer room and upgrading the standby computer room. The nodes of the main and standby computer rooms are in the same cluster, which provides great convenience for the management of data and topology structure; and the databases of the main and standby computer rooms use a database cluster, which makes computer room switching simpler. When the computer room fails, the upper-layer business does not need to be rerouted to the new cluster entrance, and the business layer is almost unaware, which improves the user experience. At the same time, because the nodes of the main and standby computer rooms are in the same database cluster, the relationship between the nodes of the main and standby computer rooms is no longer just a replication relationship. The nodes of the standby computer room will also participate in the data consistency voting and the election of the master, enriching the functions of the standby nodes.
[0075] As an optional embodiment of the present invention, based on the above embodiment, the method also includes: when a cluster recovery request sent by the client is received, adding the failed-recovered database to the database cluster, adding the failed-recovered cluster manager to the cluster manager cluster, and setting the attributes of the failed-recovered application agent to be readable and writable.
[0076] In this embodiment, after the computer room failure is restored, the dual computer room cluster can be restored to normal through the cluster recovery operation. When the computer room failure is restored, the user can send a cluster recovery request through human-computer interaction, or the management software that manages the computer room can send a cluster recovery request. When the computer room failure is restored, the cluster recovery request can be sent through the client. Cluster recovery mainly includes adding the restored database to the database cluster, adding the restored cluster manager to the cluster manager cluster, and setting the restored application proxy to be readable and writable.
[0077] The above technical solution adds a cluster recovery function, which enables the database and cluster manager to be re-added to the cluster after the computer room failure is recovered, and the properties of the application agent are set to be readable and writable, so that the restored computer room can be re-added to the cluster.
[0078] As a specific implementation manner, the steps of adding the failed-recovered database to the database cluster, adding the failed-recovered cluster manager to the cluster manager cluster, and setting the attributes of the failed-recovered application agent to be readable and writable may include:
[0079] a1) Detect the status of the database that is not in the database cluster and add the failed recovered database to the database cluster as a database standby node.
[0080] In this embodiment, the cluster manager detects the status of databases that are not in the database cluster (ie, the group replication cluster), and adds these databases to the database cluster as standby nodes.
[0081] b1) Detecting the state of the cluster manager that is not in the cluster manager cluster and adding the failed-backed cluster manager to the cluster manager cluster as a cluster manager follower.
[0082] In this step, the cluster manager detects other cluster managers that are not in the cluster manager cluster (ie, the Raft cluster) and adds these managers to the cluster manager cluster as followers.
[0083] c1) Detect the application proxy that does not provide read / write services and set the properties of the failed application proxy to be readable and writable.
[0084] In this step, the cluster manager detects the application proxy node that does not provide read / write services, and sets it to provide read / write services.
[0085] For example, Figure 5 An example diagram of cluster recovery in the execution of a computer room disaster recovery processing method provided in the first embodiment of the present invention, such as Figure 5 As shown, 11. The client sends a cluster recovery request to the cluster manager; 12. The cluster manager sends a request to join the database cluster to the recovered database and receives the database's response to the request; 13. The recovered cluster manager joins the cluster manager cluster; 14. The recovered application agent is set to be readable and writable and receives the application agent's response to the request, thus completing the cluster recovery.
[0086] The above technical solution specifies the specific steps for cluster recovery.
[0087] Embodiment 2
[0088] Figure 6A flow chart of another method for disaster recovery processing in a computer room provided in Embodiment 2 of the present invention. This embodiment is a further optimization of the above embodiment. In this embodiment, "setting the first application agent in the main computer room to prohibit providing external write services and downgrading the database master node and the cluster manager leader in the main computer room respectively" is further limited and optimized, and "switching the database standby node in the standby computer room to a new database master node, switching the cluster manager follower to a new cluster manager leader, and setting the second application agent in the standby computer room to provide external write services" is further limited and optimized.
[0089] like Figure 6 As shown, this embodiment 2 provides a computer room disaster recovery processing method, which specifically includes the following steps:
[0090] S201. Receive a request for downgrading a computer room from a client.
[0091] S202: Send a first attribute setting request to a first application proxy and receive response information of the first application proxy to the first attribute setting request.
[0092] The first attribute setting request is to set the attribute of the first application agent to read-only.
[0093] In this embodiment, when the cluster manager receives a computer room downgrade request sent by a client, the cluster manager sets the application proxy in the computer room to read-only and rejects write requests. The application proxy in the computer room to be downgraded is recorded as the first application proxy. Specifically, a first attribute setting request is sent to the first application proxy to set the attribute of the first application proxy to read-only and reject write requests. Then, response information of the first application proxy to the first attribute setting request is received. If the response information indicates that the attribute setting is successful, it indicates that the first application proxy is set successfully.
[0094] For example, Figure 7 An example diagram of a main machine room degradation in the execution of a machine room disaster recovery processing method provided in the second embodiment of the present invention, such as Figure 7 As shown, 21. The client sends a request for downgrading the computer room to the cluster manager in the specified computer room; 22. The cluster manager sets the application agent in the specified computer room to read-only and receives a response from the application agent; 23. The cluster manager sends a downgrade request to the database in the computer room. The downgrade of the database can be divided into graceful switching and forced exit, and receives a response from the database; 24. The cluster manager performs graceful switching or forced exit on the cluster, thus completing the downgrade of the computer room.
[0095] S203: Send a database downgrade request to the database master node and receive response information of the database master node to the database downgrade request.
[0096] After setting the first application agent in the main computer room to read-only, the database master node in the main computer room needs to be downgraded. Specifically, the cluster manager sends a database downgrade request to the database master node in the main computer room to downgrade the database master node, such as switching the database master node to the standby computer room or exiting the database cluster, and receives the response information of the database master node to the database downgrade request. If the response information indicates that the database master node is downgraded successfully, it indicates that the database master node is downgraded successfully.
[0097] It should be noted that if the database master node is not located in the main computer room to be downgraded, but is located in another computer room, there is no need to downgrade the database master node.
[0098] As a specific implementation manner, sending a database downgrade request to a database master node and receiving response information of the database master node to the database downgrade request includes:
[0099] a2) sending a first graceful switching request to the database master node to enable the database master node to gracefully switch to the standby computer room.
[0100] In this embodiment, the cluster manager sends a downgrade request to the database in the designated downgraded main computer room. The downgrade of the database can be divided into graceful switching and forced exit. In this step, a graceful switching request is first sent to the database master node in the computer room, which is recorded as the first graceful switching request. Graceful switching means that the switching operation is performed after the currently executing transaction is normally committed. If the master node is located in the designated downgraded computer room, the master node is switched to another computer room.
[0101] For example, Figure 8 An example diagram of database degradation in the execution of a computer room disaster recovery processing method provided in the second embodiment of the present invention is shown as follows: Figure 8 As shown, the cluster manager sends a graceful switch request to the database of the designated degraded computer room and receives a graceful switch response.
[0102] b2) receiving response information of the database master node to the first graceful switch request.
[0103] Specifically, the cluster manager receives the response information of the database master node to the first graceful switch request, and the response information may be graceful switch success or graceful switch failure.
[0104] c2) If the response information to the first graceful switch request is that the graceful switch is successful, it is determined that the database master node is downgraded successfully.
[0105] Specifically, if the response information to the first graceful switching request is that the graceful switching is successful, it indicates that the database master node is downgraded successfully.
[0106] d2) If the response information to the first graceful switch request is graceful switch failure, it is determined that the database master node has failed to be downgraded, and a first forced exit request is sent to the database master node to force the database master node to exit the database cluster.
[0107] In this embodiment, if the response information to the first graceful switching request is graceful switching failure, indicating that the database master node fails to downgrade, you can continue to try to force exit, which will force the database master node to leave the database cluster. Specifically, a forced exit request is sent to the database master node, recorded as the first forced exit request, so that the database master node is forced to exit the database cluster.
[0108] For example, Fig. 9 An example diagram of database degradation in the execution of a computer room disaster recovery processing method provided in the second embodiment of the present invention is shown as follows: Fig. 9 As shown, the cluster manager sends a forced exit request to the database of the designated downgraded computer room, and receives a forced exit response.
[0109] e2) receiving response information of the database master node to the first forced exit request.
[0110] Specifically, the cluster manager receives the response information of the database master node to the first graceful switch request, and the response information may be graceful switch success or graceful switch failure.
[0111] f2) If the response information to the first forced exit request is that the forced exit is successful, it is determined that the database master node is downgraded successfully.
[0112] Specifically, if the response information to the first forced exit request is forced exit success, it indicates that the database master node is successfully downgraded. It can be understood that whether it is an elegant switch or a forced exit, as long as it is successful, the database node in the designated downgraded computer room can be downgraded.
[0113] The above technical solution specifies the steps of downgrading the database master node in the downgraded computer room.
[0114] S204: Send a manager downgrade request to the cluster manager leader and receive response information of the cluster manager leader to the manager downgrade request.
[0115] After setting the first application agent in the main computer room to read-only and downgrading the database master node in the main computer room, the cluster manager leader in the main computer room also needs to be downgraded. Specifically, the cluster manager sends a manager downgrade request to the cluster manager leader in the main computer room to downgrade the cluster manager leader, such as switching the cluster manager leader to the standby computer room or exiting the cluster manager cluster, and receives the cluster manager leader's response information to the manager downgrade request. If the response information indicates that the cluster manager leader is downgraded successfully, it indicates that the cluster manager leader is downgraded successfully.
[0116] It should be noted that if the cluster manager leader is not located in the main computer room to be downgraded, but in another computer room, there is no need to downgrade the cluster manager leader. If the cluster manager that receives the downgrade request is the leader, the "forced exit" of the cluster manager leader is completed by the cluster manager leader itself, and no request response will be received.
[0117] As a specific implementation manner, sending a manager downgrade request to a cluster manager leader and receiving response information of the cluster manager leader to the manager downgrade request include:
[0118] a3) Sending a second graceful switch request to the cluster manager leader to enable the cluster manager leader to gracefully switch to the standby computer room.
[0119] In this embodiment, the cluster manager sends a downgrade request to the cluster manager leader in the designated downgraded computer room. The downgrade of the cluster manager can be divided into graceful switching and forced exit. In this step, a graceful switching request is first sent to the cluster manager in the computer room, which is recorded as the second graceful switching request. Graceful switching means that the switching operation is performed after the currently executed log entry is submitted normally. If the cluster manager leader is located in the designated downgraded computer room, the leader is switched to another computer room.
[0120] b3) receiving a response message from the cluster manager leader to the second graceful switch request.
[0121] Specifically, the cluster manager receives the response information of the cluster manager leader to the second graceful switching request, and the response information may be graceful switching success or graceful switching failure.
[0122] c3) If the response information to the second graceful switch request is that the graceful switch is successful, it is determined that the cluster manager leader is downgraded successfully.
[0123] Specifically, if the response information to the second graceful switching request is graceful switching success, it indicates that the cluster manager leader is downgraded successfully.
[0124] d3) If the response information to the second graceful switching request is graceful switching failure, it is determined that the cluster manager leader has failed to downgrade, and a second forced exit request is sent to the cluster manager leader to force the cluster manager leader to forcefully exit the cluster manager cluster.
[0125] In this embodiment, if the response information to the second graceful switch request is graceful switch failure, indicating that the cluster manager leader fails to downgrade, you can continue to try to force exit, which will force the cluster manager leader to leave the database cluster. Specifically, send a forced exit request to the cluster manager leader, recorded as the second forced exit request, so that the cluster manager leader is forced to exit the database cluster.
[0126] S205: Receive a computer room upgrade request for the standby computer room sent by the client.
[0127] S206: Send a database upgrade request to the standby database node and receive response information of the standby database node to the database upgrade request.
[0128] In this embodiment, when the cluster manager receives the computer room upgrade request sent by the client, it is necessary to upgrade the database standby node in the standby computer room. Specifically, the cluster manager sends a database upgrade request to the database standby node in the standby computer room to upgrade the database standby node, such as switching the database master node to the current computer room or forcibly switching the master node, and receives the response information of the database standby node to the database upgrade request. If the response information indicates that the database standby node is successfully upgraded, it indicates that the database standby node is successfully upgraded.
[0129] It should be noted that if the database master node is not located in another computer room but in the standby computer room to be upgraded, there is no need to upgrade the database standby node.
[0130] For example, Fig.10 An example diagram of upgrading a backup computer room during the execution of a computer room disaster recovery processing method provided by an embodiment of the present invention is shown in FIG. Fig.10 As shown, 31. The client sends a cluster upgrade request to the cluster manager in the specified computer room; 32. The cluster manager sends a database upgrade request to the database in the computer room. The database upgrade can be divided into graceful switching and forced master switching, and receives the response of the database; 33. The cluster manager cluster performs graceful switching or forced master switching; 34. The cluster manager sets the application agent in the specified computer room to read and write, and receives the response of the application agent. At this point, the computer room upgrade is completed.
[0131] As a specific implementation manner, sending a database upgrade request to a standby database node and receiving response information of the standby database node to the database upgrade request includes:
[0132] a4) Sending a third graceful switch request to the database standby node to enable the database standby node to gracefully switch to the new master node.
[0133] In this embodiment, the cluster manager sends an upgrade request to the database in the designated upgrade standby computer room. The database upgrade can be divided into graceful switching and forced exit. This step first sends a graceful switching request to the database standby node in the computer room, which is recorded as the third graceful switching request. Graceful switching refers to performing a switching operation after the currently executing transaction is committed normally. If the master node is located in another computer room, the master node is switched to the current computer room. Specifically, a third graceful switching request is sent to the database standby node to enable the database standby node to gracefully switch to the new master node.
[0134] b4) receiving response information of the standby database node to the third graceful switch request.
[0135] Specifically, the cluster manager receives the response information of the database standby node to the third graceful switch request. The response information may be graceful switch success or graceful switch failure.
[0136] c4) If the response information to the third graceful switch request is that the graceful switch is successful, it is determined that the database standby node is upgraded successfully.
[0137] Specifically, if the response information to the third graceful switch request is graceful switch success, it indicates that the database standby node is upgraded successfully.
[0138] d4) If the response information to the third graceful switch request is graceful switch failure, it is determined that the database standby node upgrade has failed, and a first forced master switch request is sent to the database standby node to force the database standby node to exit the database cluster and form a new database cluster as a new master node.
[0139] In this embodiment, if the response information to the third graceful switching request is graceful switching failure, indicating that the database standby node upgrade failed, you can continue to try to force the master switch, which will force the database node to leave the group replication cluster, declare itself as the master node and reorganize a new cluster. Specifically, a forced master switch request is sent to the database master node, recorded as the first forced master switch request, so that the database standby node is forced to exit the database cluster and form a new database cluster as the new master node.
[0140] e4) receiving the response information of the database standby node to the establishment of a new database cluster.
[0141] Specifically, the response information of the standby database node to the establishment of a new database cluster is received.
[0142] f4) If the response information to the establishment of the new database cluster is establishment success, it is determined that the database standby node is upgraded successfully.
[0143] Specifically, if the response information indicates that the establishment is successful, it indicates that the database standby node is upgraded successfully.
[0144] g4) After confirming that the database standby node is upgraded successfully, set the minority writable label for the new database master node.
[0145] Specifically, after the database upgrade is successful, the cluster manager will set the minority writable label for the database so that the cluster consisting of a single master node can provide read and write services.
[0146] For example, Fig.11 An example diagram of a database upgrade in the execution of a computer room disaster recovery processing method provided by an embodiment of the present invention, such as Fig.11 As shown in the figure, the cluster manager sends a request to exit the database cluster to the database of the designated upgraded computer room and receives a response to exit. Then the database node declares itself as the new master node and reorganizes the new cluster, and receives a reorganization response. After the database upgrade is successful, the cluster manager sets the minority writable tag on the database so that the cluster consisting of a single master node can provide read and write services.
[0147] The above technical solution specifies the steps for upgrading the database standby node in the upgrade room.
[0148] S207: Send a manager upgrade request to the cluster manager follower and receive response information of the cluster manager follower to the manager upgrade request.
[0149] After upgrading the database standby node in the standby computer room, the cluster manager follower in the standby computer room also needs to be upgraded. Specifically, the cluster manager sends a manager upgrade request to the cluster manager follower in the standby computer room to upgrade the cluster manager follower, such as making the cluster manager leader gracefully switch to the current computer room or forcibly switch to the master, and receives the cluster manager follower's response information to the manager upgrade request. If the response information indicates that the cluster manager follower is successfully upgraded, it indicates that the cluster manager follower is successfully upgraded.
[0150] It should be noted that if the cluster manager leader is located in the standby computer room to be upgraded, there is no need to upgrade the cluster manager followers.
[0151] As a specific implementation manner, sending a manager upgrade request to a cluster manager follower and receiving response information of the cluster manager follower to the manager upgrade request includes:
[0152] a5) Sending a fourth graceful switch request to the cluster manager follower to enable the cluster manager follower to gracefully switch to the new cluster manager leader.
[0153] In this embodiment, the cluster manager sends an upgrade request to the cluster manager follower in the designated upgrade standby computer room. The upgrade of the cluster manager can be divided into graceful switching and forced exit. This step first sends a graceful switching request to the cluster manager in the computer room, which is recorded as the fourth graceful switching request. Graceful switching means that the switching operation is performed after the currently executed log entry is submitted normally. If the cluster manager leader is located in another computer room, the leader is switched to the current computer room.
[0154] b5) receiving response information from the cluster manager follower to the fourth graceful switch request.
[0155] Specifically, the cluster manager receives the response information of the cluster manager follower to the fourth graceful switching request. The response information may be graceful switching success or graceful switching failure.
[0156] c5) If the response information to the fourth graceful switch request is that the graceful switch is successful, it is determined that the cluster manager follower is upgraded successfully.
[0157] Specifically, if the response information to the fourth graceful switching request is graceful switching success, it indicates that the cluster manager follower is upgraded successfully.
[0158] d5) If the response information to the fourth graceful switch request is graceful switch failure, it is determined that the cluster manager follower upgrade has failed, and a second forced master switch request is sent to the cluster manager follower to force the cluster manager follower to exit the cluster manager cluster and form a new cluster manager cluster as the new cluster manager leader.
[0159] In this embodiment, if the response information to the fourth graceful switching request is graceful switching failure, indicating that the cluster manager follower upgrade failed, you can continue to try to force the master switch, and the forced exit will force the designated cluster manager located in the computer room to exit the cluster manager cluster and declare itself as the leader to create a new cluster. Specifically, a forced exit request is sent to the cluster manager follower, recorded as the second forced master switch request, so that the cluster manager follower is forced to exit the cluster manager cluster and form a new cluster manager cluster as the new cluster manager leader.
[0160] S208: Send a second attribute setting request to the second application proxy and receive response information of the second application proxy to the second attribute setting request.
[0161] The second attribute setting request is to set the attribute of the second application agent to be readable and writable.
[0162] After the database standby node in the standby computer room is upgraded and the cluster manager follower is upgraded, the application agent in the standby computer room needs to be set to be readable and writable so that it can provide services to the outside world normally. The application agent in the standby computer room to be upgraded is recorded as the second application agent. Specifically, a second attribute setting request is sent to the second application agent to set the attributes of the second application agent to be readable and writable so that it can provide services to the outside world normally. Then, the response information of the second application agent to the second attribute setting request is received. If the response information indicates that the attribute setting is successful, it indicates that the second application agent is set successfully.
[0163] The above technical solution specifies that the downgrade of the computer room mainly includes prohibiting the application agent located in the computer room from providing external write services, switching the cluster manager leader and the database master node in the computer room to other computer rooms or forcibly exiting the cluster. And the computer room upgrade operation includes switching the designated cluster manager follower in the computer room to the leader, switching the database standby node to the master node, and setting the application agent located in the computer room to provide external read and write services. The above technical solution is based on the dual computer room deployment in the database group replication cluster and manager Raft cluster mode. When the standby computer room fails, the cluster can remain healthy; when the main computer room fails, the computer room can be switched in seconds by downgrading the main computer room and upgrading the standby computer room; after the computer room failure is restored, the dual computer room cluster can be restored to normal through cluster recovery operations. The databases and manager nodes of the dual computer rooms are in the same cluster, and the nodes of the standby computer room will also participate in the data consistency voting and master election, enriching the functions of the standby node, which provides greater convenience for the management of the cluster topology structure. In addition, since the main and standby computer room databases use a group replication cluster, it also makes the upper-level business switching simpler. When a computer room failure occurs, the upper-layer business does not need to be rerouted to the new cluster entrance, and the business layer is almost unaware of it.
[0164] Embodiment 3
[0165] Fig.12 The structure diagram of a computer room disaster recovery processing system provided by the third embodiment of the present invention is as follows. Fig.12 As shown, the system includes at least a main machine room 10 and a standby machine room 20 deployed in the system, the main machine room 10 includes at least a database, a cluster manager and an application agent, and the standby machine room 20 includes at least a database, a cluster manager and an application agent. Each node in the main machine room 10 and each node in the standby machine room 20 are in the same cluster, the database of the main machine room and the database of the standby machine room are in the same database cluster, and the cluster manager of the main machine room and the cluster manager of the standby machine room are in the same cluster manager cluster; the cluster manager is specifically used to:
[0166] Receive a request from a client to downgrade the computer room of the main computer room;
[0167] Setting the first application agent in the computer room to prohibit providing external write services and downgrading the database master node and the cluster manager leader in the computer room respectively;
[0168] Receive a request from a client for upgrading the backup computer room;
[0169] The database standby node in the standby computer room is switched to a new database master node, the cluster manager follower is switched to a new cluster manager leader, and the second application agent in the standby computer room is set to provide external write services.
[0170] In this embodiment, the main computer room includes at least a database, a cluster manager, and an application agent, and the standby computer room also includes at least a database, a cluster manager, and an application agent. The computer room may also include a database agent. Different from the dual cluster mode in the prior art, in which the main and standby computer rooms are each deployed with a cluster, in this embodiment, each node of the dual computer room is in the same cluster.
[0171] It should be noted that, before performing the computer room disaster recovery process, this embodiment needs to initialize the cluster consisting of the main computer room and the backup computer room through the computer room management. Specifically, it includes: setting a computer room name for each server deployed in the cluster. When the database cluster is started, it will determine the computer room where it is located by judging the computer room name of the server, and then set the computer room label for each component in turn. For example, the computer room of the main computer room is numbered 1, and server A and server B are located in the main computer room. The computer room label of the database and cluster manager running on server A and server B is 1. Among them, the application agent and database agent are stateless, and the computer room information is stored in the memory after initialization. The cluster manager and database persist the computer room information to files. Continue to refer to Fig.12 , Server A and Server B are deployed in the main computer room, and Server C is deployed in the standby computer room. Application agent 1, cluster manager 1, database agent 1, and database 1 are deployed on Server A, application agent 2, cluster manager 2, database agent 2, and database 2 are deployed on Server B, and application agent 3, cluster manager 3, database agent 3, and database 3 are deployed on Server C.
[0172] Among them, the computer room with the majority nodes is recorded as the main computer room, and the computer room with the minority nodes is recorded as the backup computer room. It can be considered that in general, the main computer room provides services to the outside world, and when the main computer room fails, it switches to the backup computer room to provide services to the outside world. When the main computer room fails, disaster recovery processing is required, that is, the main computer room is retired and switched to the backup computer room to provide services to the outside world.
[0173] For matters not described in this embodiment, please refer to the contents of the method embodiment, and no repetitive description is made here.
[0174] The above technical solution is based on the deployment of dual computer rooms in the database cluster and cluster manager cluster mode. When the backup computer room fails, the cluster can remain healthy; when the main computer room fails, the computer room can be switched in seconds by downgrading the main computer room and upgrading the backup computer room. The nodes of the main and backup computer rooms are in the same cluster, which provides great convenience for the management of data and topology; and the databases of the main and backup computer rooms use a database cluster, which makes computer room switching simpler. When a computer room fails, the upper-layer business does not need to be rerouted to the new cluster entrance, and the business layer is almost unaware, which improves the user experience.
[0175] In addition to the centralized dual-computer room architecture above, this solution can also be used to expand to multiple computer rooms and distributed cluster architectures. The following are several common cluster expansion architectures:
[0176] Fig.13 A schematic diagram of the structure of another computer room disaster recovery processing system provided in Embodiment 3 of the present invention is shown in FIG. Fig.13 As shown, the computer room disaster recovery processing system is a case of multiple servers in the standby computer room. Based on the above architecture, the dual computer room architecture adds a server node in the standby computer room, and an application agent is installed in each node. Most cluster managers are installed in the standby computer room, and most databases are installed in the main computer room. The main computer room is deployed with server A (denoted as node A in the figure) and server B (denoted as node B in the figure), and the standby computer room is deployed with server C (denoted as node C in the figure) and server D (denoted as node D in the figure). Application agent 1, cluster manager 1, database agent 1 and database 1 are deployed on server A, application agent 2, database agent 2 and database 2 are deployed on server B, application agent 3, cluster manager 2, database agent 3 and database 3 are deployed on server C, and application agent 4 and cluster manager 3 are deployed on server D. The benefit of this solution is that the majority of the cluster manager can be separated from the majority of the database. When any computer room fails, it can ensure that the majority of the cluster manager or database survives, reducing the failure rate.
[0177] Fig.14 A structural diagram of another computer room disaster recovery processing system provided in Embodiment 3 of the present invention is shown as follows: Fig.14As shown in the figure, the computer room disaster recovery processing system is a multi-computer room architecture. This architecture adds a remote computer room on the basis of the dual computer rooms, in which the main computer room and the backup computer room are both installed with two nodes, and the remote computer room is installed with one node. The main computer room is deployed with server A (represented as node A in the figure) and server B (represented as node B in the figure), the backup computer room is deployed with server C (represented as node C in the figure) and server D (represented as node D in the figure), and the remote computer room is deployed with server E (represented as node E in the figure). Application agent 1, cluster manager 1, database agent 1 and database 1 are deployed on server A, application agent 2, cluster manager 2, database agent 2 and database 2 are deployed on server B, application agent 3, cluster manager 3, database agent 3 and database 3 are deployed on server C, application agent 4, cluster manager 4, database agent 4 and database 4 are deployed on server D, and application agent 5, cluster manager 5, database agent 5 and database 5 are deployed on server E. In this architecture, the failure of any computer room can ensure the survival of the majority, and the cluster can automatically complete disaster recovery without external intervention.
[0178] Fig.15 A structural diagram of another computer room disaster recovery processing system provided in Embodiment 3 of the present invention is shown as follows: Fig.15 As shown, the computer room disaster recovery processing system is a distributed dual computer room cluster. In a distributed database cluster, the database cluster appears in the form of shards, each shard is a database cluster (i.e., a group replication cluster), and the management component manages each database cluster in units of shards. The main computer room is deployed with server A (denoted as node A in the figure) and server B (denoted as node B in the figure), and the standby computer room is deployed with server C (denoted as node C in the figure). Application agent 1, cluster manager 1, database agent 1-1, database 1-1, database agent 2-1, and database 2-1 are deployed on server A, application agent 2, cluster manager 2, database agent 1-2, database 1-2, database agent 2-2, and database 2-2 are deployed on server B, and application agent 3, cluster manager 3, database agent 1-3, database 1-3, database agent 2-3, and database 2-3 are deployed on server C. Among them, database proxy 1-1, database 1-1, database proxy 1-2, database 1-2, database proxy 1-3, and database 1-3 belong to shard 1, and database proxy 2-1, database 2-1, database proxy 2-2, database 2-2, database proxy 2-3, and database 2-3 belong to shard 2. The advantage of this architecture is that data can be managed more efficiently.
[0179] It is important to know that based on the theory of dual-computer room architecture, it can be expanded to multi-computer room architecture and distributed architecture, making the cluster more scalable.
[0180] Embodiment 6
[0181] Fig.16 A schematic diagram of the structure of a scheduling node provided for Embodiment 4 of the present invention. In this embodiment, the cluster manager can be considered as a scheduling node. The scheduling node can be deployed separately on a server (computer) or deployed together with other components on the same computer. There is no specific limitation on the computer here, such as a laptop computer, a desktop computer, a workbench, a personal digital assistant, a server, a blade server, a mainframe computer, and other suitable computers. The scheduling node can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0182] like Fig.16 As shown, the scheduling node 40 includes at least one processor 41, and a memory connected to the at least one processor 41, such as a read-only memory (ROM) 42, a random access memory (RAM) 43, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 41 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 42 or the computer program loaded from the storage unit 48 to the random access memory (RAM) 43. In the RAM 43, various programs and data required for the operation of the scheduling node 40 can also be stored. The processor 41, the ROM 42, and the RAM 43 are connected to each other through a bus 44. An input / output (I / O) interface 45 is also connected to the bus 44.
[0183] A number of components in the scheduling node 40 are connected to the I / O interface 45, including: an input unit 46, such as a keyboard, a mouse, etc.; an output unit 47, such as various types of displays, speakers, etc.; a storage unit 48, such as a disk, an optical disk, etc.; and a communication unit 49, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 49 allows the scheduling node 40 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0184] The processor 41 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 41 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The processor 41 executes the various methods and processes described above, such as a computer room disaster recovery processing method for a participant in the data product circulation system, and a computer room disaster recovery processing method for a data trading platform in the data product circulation system.
[0185] In some embodiments, the computer room disaster recovery processing method can be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 48. In some embodiments, part or all of the computer program can be loaded and / or installed on the scheduling node 40 via the ROM 42 and / or the communication unit 49. When the computer program is loaded into the RAM 43 and executed by the processor 41, one or more steps in the computer room disaster recovery processing method described above can be executed. Alternatively, in other embodiments, the processor 41 can be configured to execute the computer room disaster recovery processing method in any other appropriate manner (for example, by means of firmware).
[0186] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0187] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0188] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0189] To provide interaction with a user, the systems and techniques described herein may be implemented on a scheduling node having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the scheduling node. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0190] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0191] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0192] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0193] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A computer room disaster recovery processing method, characterized in that: A cluster manager applied to a computer room disaster recovery processing system, wherein the computer room disaster recovery processing system is deployed with at least a main computer room and a backup computer room, wherein the main computer room and the backup computer room respectively include at least a database, a cluster manager and an application agent, wherein each node in the main computer room and each node in the backup computer room are in the same cluster, wherein the database of the main computer room and the database of the backup computer room are in the same database cluster, and the cluster manager of the main computer room and the cluster manager of the backup computer room are in the same cluster manager cluster, wherein the method comprises: Receive a request from a client to downgrade the computer room of the main computer room; Setting the first application agent in the computer room to prohibit providing external write services and downgrading the database master node and the cluster manager leader in the computer room respectively; Receive a request from a client for upgrading the backup computer room; Switching the database standby node in the standby computer room to a new database master node, switching the cluster manager follower to a new cluster manager leader, and setting the second application agent in the standby computer room to provide external write services; The step of setting the first application agent in the computer room to prohibit providing external write services and downgrading the database master node and the cluster manager leader in the computer room respectively includes: Sending a first property setting request to the first application proxy and receiving response information of the first application proxy to the first property setting request, wherein the first property setting request is to set the property of the first application proxy to read-only; Sending a database downgrade request to the database master node and receiving response information of the database master node to the database downgrade request; Sending a manager downgrade request to the cluster manager leader and receiving response information of the cluster manager leader to the manager downgrade request; The sending of the database downgrade request to the database master node and receiving response information of the database master node to the database downgrade request includes: Sending a first graceful switching request to the database master node to enable the database master node to gracefully switch to the standby computer room; Receiving response information of the database master node to the first graceful switching request; If the response information to the first graceful switching request is that the graceful switching is successful, it is determined that the database master node is downgraded successfully; graceful switching means that the switching operation is performed after the currently executed transaction is normally committed, and if the database master node is located in the designated downgraded computer room, the database master node is switched to another computer room; Otherwise, determining that the database master node fails to be downgraded, and sending a first forced exit request to the database master node to force the database master node to exit the database cluster; Receiving response information of the database master node to the first forced exit request; If the response information to the first forced exit request is that the forced exit is successful, it is determined that the database master node is downgraded successfully.
2. The method according to claim 1, characterized in that The database cluster is implemented based on database group replication technology, and the cluster manager cluster is implemented based on a distributed consistency protocol.
3. The method according to claim 1, characterized in that: The sending of the manager downgrade request to the cluster manager leader and receiving response information of the cluster manager leader to the manager downgrade request includes: Sending a second graceful switching request to the cluster manager leader to enable the cluster manager leader to gracefully switch to the standby computer room; receiving a response message from the cluster manager leader to the second graceful switching request; If the response information to the second graceful switching request is that the graceful switching is successful, it is determined that the cluster manager leader is downgraded successfully; Otherwise, it is determined that the cluster manager leader fails to be downgraded, and a second forced exit request is sent to the cluster manager leader to force the cluster manager leader to forcefully exit the cluster manager cluster.
4. The method according to claim 1, characterized in that: The switching of the database standby node in the standby computer room to a new database master node, the switching of the cluster manager follower to a new cluster manager leader, and the setting of the second application agent in the standby computer room to provide external write services include: Sending a database upgrade request to the database standby node and receiving response information of the database standby node to the database upgrade request; Sending a manager upgrade request to the cluster manager follower and receiving response information of the cluster manager follower to the manager upgrade request; A second attribute setting request is sent to the second application proxy and response information of the second application proxy to the second attribute setting request is received, wherein the second attribute setting request is to set the attribute of the second application proxy to be readable and writable.
5. The method according to claim 4, characterized in that The sending of the database upgrade request to the database standby node and receiving response information of the database standby node to the database upgrade request includes: Sending a third graceful switching request to the database standby node to enable the database standby node to gracefully switch to a new master node; Receiving response information of the database standby node to the third graceful switching request; If the response information to the third graceful switching request is that the graceful switching is successful, it is determined that the database standby node is upgraded successfully; Otherwise, it is determined that the upgrade of the database standby node fails, and a first forced master switching request is sent to the database standby node to force the database standby node to forcibly exit the database cluster and form a new database cluster as a new master node; Receiving response information from the standby database node to forming a new database cluster; If the response information to the establishment of the new database cluster is establishment success, it is determined that the database standby node is upgraded successfully; After determining that the database standby node is successfully upgraded, a minority writable label is set for the new database master node.
6. The method according to claim 4, characterized in that The sending of the manager upgrade request to the cluster manager follower and receiving response information of the cluster manager follower to the manager upgrade request includes: Sending a fourth graceful switch request to the cluster manager follower to enable the cluster manager follower to gracefully switch to a new cluster manager leader; receiving response information of the cluster manager follower to the fourth graceful switching request; If the response information to the fourth graceful switching request is that the graceful switching is successful, it is determined that the cluster manager follower is successfully upgraded; Otherwise, it is determined that the cluster manager follower upgrade fails, and a second forced master switching request is sent to the cluster manager follower to force the cluster manager follower to forcibly exit the cluster manager cluster and form a new cluster manager cluster as a new cluster manager leader.
7. The method according to claim 1, characterized in that Also includes: When a cluster recovery request sent by the client is received, the recovered database is added to the database cluster, the recovered cluster manager is added to the cluster manager cluster, and the attributes of the recovered application agent are set to be readable and writable.
8. The method according to claim 7, characterized in that The steps of adding the recovered database to the database cluster, adding the recovered cluster manager to the cluster manager cluster, and setting the attributes of the recovered application agent to be readable and writable include: Detecting the status of a database not in the database cluster and adding a failed-recovered database as a database standby node to the database cluster; detecting the state of cluster managers not in the cluster manager cluster and adding a failed-backed cluster manager to the cluster manager cluster as a cluster manager follower; Detect the application proxy that does not provide read and write services and set the properties of the failed application proxy to be read and write.
9. A computer room disaster recovery processing system, characterized in that: The system is deployed with at least a main machine room and a standby machine room, the main machine room and the standby machine room respectively include at least a database, a cluster manager and an application agent, each node in the main machine room and each node in the standby machine room are in the same cluster, the database of the main machine room and the database of the standby machine room are in the same database cluster, the cluster manager of the main machine room and the cluster manager of the standby machine room are in the same cluster manager cluster; the cluster manager is specifically used to: Receive a request from a client to downgrade the computer room of the main computer room; Setting the first application agent in the computer room to prohibit providing external write services and downgrading the database master node and the cluster manager leader in the computer room respectively; Receive a request from a client for upgrading the backup computer room; Switching the database standby node in the standby computer room to a new database master node, switching the cluster manager follower to a new cluster manager leader, and setting the second application agent in the standby computer room to provide external write services; The step of setting the first application agent in the computer room to prohibit providing external write services and downgrading the database master node and the cluster manager leader in the computer room respectively includes: Sending a first property setting request to the first application proxy and receiving response information of the first application proxy to the first property setting request, wherein the first property setting request is to set the property of the first application proxy to read-only; Sending a database downgrade request to the database master node and receiving response information of the database master node to the database downgrade request; Sending a manager downgrade request to the cluster manager leader and receiving response information of the cluster manager leader to the manager downgrade request; The sending of the database downgrade request to the database master node and receiving response information of the database master node to the database downgrade request includes: Sending a first graceful switching request to the database master node to enable the database master node to gracefully switch to the standby computer room; Receiving response information of the database master node to the first graceful switching request; If the response information to the first graceful switching request is that the graceful switching is successful, it is determined that the database master node is downgraded successfully; graceful switching means that the switching operation is performed after the currently executed transaction is normally committed, and if the database master node is located in the designated downgraded computer room, the database master node is switched to another computer room; Otherwise, determining that the database master node fails to be downgraded, and sending a first forced exit request to the database master node to force the database master node to exit the database cluster; Receiving response information of the database master node to the first forced exit request; If the response information to the first forced exit request is that the forced exit is successful, it is determined that the database master node is downgraded successfully.
10. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the computer room disaster recovery processing method according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the computer room disaster recovery processing method according to any one of claims 1 to 8 when executed.
