Database cluster management method and related product
By generating message version numbers and obtaining rules in the database cluster, the error handling problems caused by target node changes during cross-node message delay are solved, and the robustness and system security of the cluster are improved.
Patent Information
- Application Number
- CN202510428945.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-07
- Publication Date
- 2025-08-01
AI Technical Summary
During the delay period of cross-node messages in the database cluster, the target node may change, resulting in error handling of message receiving nodes and affecting the security of the cluster system.
Each node of the database cluster generates message version numbers and message acquisition rules. The message version numbers are updated synchronously with the rule version. The message sending node carries version information. The message receiving node checks the version number to judge and handles cross-node messages.
This avoids message receiving nodes incorrectly dealing with cross-node messages, and enhances the robustness of the cluster and system security.
Smart Images

Figure CN120407228A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of databases, and particularly to a method for managing a database cluster, a computer-readable storage medium, a computer program product, and a computer device. Background Art
[0002] A database cluster usually includes multiple nodes, and communication between nodes is often required, which requires sending and receiving cross-node messages. For example, when a certain node needs to synchronize certain data to the cluster or needs to remotely wake up the process of other nodes, this node will act as a message sending node to send a cross-node message to the target node. When the message receiving node receives a cross-node message, it will perform specific operations according to the content of the message. The sending and receiving of cross-node messages in the cluster is not instantaneous. The cross-node message cannot be received and consumed by the receiving node instantly at the moment of sending. There is a certain time delay between sending and being received and consumed.
[0003] The identities of the nodes in the database cluster (such as the master node, slave node, coordination node, lock control node, etc.) may change dynamically. During the time delay of the cross-node message, the target node may change. For example, the original target node is the lock control node. When the cross-node message is sent, the lock control node is node 1. After the message sending node sends the message to node 1, the lock control node becomes node 2, but this cross-node message will still be received by node 1. This cross-node message should have been received and consumed by node 2 as the lock control node. After node 1 receives and consumes this cross-node message, it is very likely to cause unexpected problems and even seriously affect the system security of the cluster. Summary of the Invention
[0004] An object of the present invention is to provide a method for managing a database cluster, a computer-readable storage medium, a computer program product, and a computer device to prevent the message receiving node from misprocessing the cross-node message, thereby enhancing the robustness of the cluster and improving the system security of the cluster.
[0005] Specifically, according to one aspect of the present invention, a method for managing a database cluster includes:
[0006] Generating a message version number and a message acquisition rule at each node of the database cluster, where the message version number is configured to be synchronously updated with the version of the message acquisition rule, and the message acquisition rule reflects the index of the message receiving node;
[0007] Any node with a cross-node communication requirement acts as a message sending node to determine a target message receiving node according to the message acquisition rule of the message sending node; and adding version information to the cross-node message to be sent, where the version information reflects the message version number of the message sending node;
[0008] When any of the nodes receives the cross-node message as a message receiving node, the message receiving node disposes of the cross-node message according to the version information in the cross-node message and the message version number of the message receiving node.
[0009] Optionally, generating a message version number for each node in the database cluster includes:
[0010] In response to triggering a preset generation condition, each of the nodes generates the same message version number, and the preset generation condition includes a start instruction for starting the database cluster;
[0011] Each of the nodes sends a first broadcast for declaring that the node has generated the message version number;
[0012] When each of the nodes has received the first broadcast from all other nodes, it is determined that all the nodes in the database cluster have generated the message version number.
[0013] Optionally, the steps of synchronously updating the message version number and the message acquisition rule include:
[0014] In response to a need to update the message acquisition rule triggered by any of the nodes as an update node, the update node performs a relocation operation; and
[0015] The update node sends a second broadcast to notify each of the other nodes to perform the relocation operation.
[0016] Wherein, the steps of the relocation operation include:
[0017] Updating the message version number of the node according to a preset update rule, and the preset update rule includes an equal increment rule; and
[0018] Updating the message acquisition rule of the node.
[0019] Optionally, the message receiving node disposing of the cross-node message according to the version information in the cross-node message and the message version number of the message receiving node includes:
[0020] Obtaining the message version number of the cross-node message; and
[0021] Obtaining the message version number of the message receiving node;
[0022] Judging whether the message version number of the message receiving node is greater than the message version number of the cross-node message;
[0023] If it is greater than, reject the cross-node message to the message sending node, or determine a new target message receiving node according to the message acquisition rule of the message receiving node, and forward the cross-node message to the new target message receiving node;
[0024] If it is less than or equal to, the message receiving node consumes the cross-node message.
[0025] Optionally, before obtaining the message version number of the message receiving node, the management method further includes:
[0026] Lock the message version number of the message receiving node in shared mode; and
[0027] After obtaining the message version number of the message receiving node, the management method further includes:
[0028] Release the lock on the message version number of the message receiving node.
[0029] Optionally, before updating the message version number of the local node according to the preset update rule, it further includes:
[0030] Lock the message version number of the local node in exclusive mode;
[0031] Obtain the message version number of the local node; and
[0032] After updating the message acquisition rule of the local node, it further includes:
[0033] Release the lock on the message version number of the local node.
[0034] Optionally, before adding the version information to the cross-node message to be sent, the management method further includes:
[0035] Lock the message version number of the message sending node in shared mode;
[0036] Obtain the message version number of the message sending node;
[0037] Generate the version information according to the message version number of the message sending node;
[0038] Release the lock on the message version number of the message sending node; and
[0039] After adding the version information to the cross-node message to be sent, the management method further includes:
[0040] Send the cross-node message to the target message receiving node.
[0041] According to another aspect of the present invention, there is also provided a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the management method of any one of the above database clusters are implemented.
[0042] According to still another aspect of the present invention, there is also provided a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the management method of any one of the above database clusters are implemented.
[0043] According to yet another aspect of the present invention, there is also provided a computer device, including a memory, a processor, and a computer program stored on the memory, and the processor executes the computer program to implement the steps of the management method of any one of the above database clusters.
[0044] In the management method of the database cluster of the present invention, a message acquisition rule and a message version number updated with the version of the message acquisition rule are generated at each node of the cluster. When generating a cross-node message, the message sending node carries the message version number of the message sending node, and when receiving a cross-node message, the message receiving node verifies the local message version number and the message version number of the cross-node message. According to these two message version numbers, the message receiving node can determine whether the message acquisition rule of the cluster has changed during the time delay between the generation and the reception of the cross-node message, and then perform corresponding processing on the cross-node message. This management method avoids the message receiving node from wrongly processing the cross-node message, enhances the robustness of the cluster, and improves the system security of the cluster.
[0045] Those skilled in the art will become more apparent from the following detailed description of the specific embodiments of the present invention in conjunction with the accompanying drawings of the above and other objects, advantages and features of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Some specific embodiments of the present invention will be described in detail hereinafter with reference to the accompanying drawings in an exemplary and non-limiting manner. The same reference numerals in the drawings denote the same or similar components or parts. Those skilled in the art should understand that these drawings are not necessarily drawn to scale. In the drawings:
[0047] Figure 1 is a schematic flowchart of the management method according to an embodiment of the present invention;
[0048] Figure 2 is a schematic flowchart of generating a message version number at each node of the management method according to an embodiment of the present invention;
[0049] Figure 3 is a schematic flowchart of the message sending node sending a cross-node message of the management method according to an embodiment of the present invention;
[0050] Figure 4 It is a schematic flow diagram of a message receiving node in a management method according to an embodiment of the present invention for handling cross-node messages;
[0051] Figure 5 It is a schematic flow diagram of an update message acquisition rule in a management method according to an embodiment of the present invention;
[0052] Figure 6 It is a schematic flow diagram of a node performing a relocation operation in a management method according to an embodiment of the present invention;
[0053] Figure 7 It is a schematic diagram of a computer program product according to an embodiment of the present invention;
[0054] Figure 8 It is a schematic diagram of a computer-readable storage medium according to an embodiment of the present invention; and
[0055] Figure 9 It is a schematic diagram of a computer device according to an embodiment of the present invention. Detailed implementation manners
[0056] The purpose of the management method of the database cluster in this embodiment is to prevent the message receiving node from incorrectly handling cross-node messages, thereby enhancing the robustness of the cluster and improving the system security of the cluster.
[0057] Figure 1 It is a schematic flow diagram of a management method according to an embodiment of the present invention, and the method generally may include:
[0058] S100, generating a message version number and a message acquisition rule at each node of the database cluster, the message version number being configured to be synchronously updated with the version of the message acquisition rule, and the message acquisition rule reflecting the index of the message receiving node;
[0059] S200, any node with a cross-node communication requirement serves as a message sending node to determine a target message receiving node according to the message acquisition rule of the message sending node;
[0060] S300, the message sending node adds version information to the cross-node message to be sent, and the version information reflects the message version number of the message sending node;
[0061] S400, when any node serves as a message receiving node and receives a cross-node message, the message receiving node handles the cross-node message according to the version information in the cross-node message and the message version number of the message receiving node.
[0062] Communication based on cross-node messages in a database cluster is usually implemented in the form of a queue for caching messages plus a socket. Specifically, there are two message queues on each node in the cluster, namely the sending queue and the receiving queue. When a node needs to send a cross-node message, it will first cache the message in the sending queue and then send the message through socket technology at the corresponding moment. When the remote message receiving node receives a cross-node message, it will first push the message into the receiving queue and then consume the message at the corresponding moment to perform the corresponding operations.
[0063] In a centralized database cluster (such as a Real Application Cluster, abbreviated as RAC), coordinator nodes, lock control nodes (used to control the distribution and use of cache locks for each data object in the cluster), etc. are usually selected among the nodes to maintain the consistency of each data in the cluster. To determine the current identities of the nodes in the cluster, the cluster usually sets corresponding indexes (such as a consistent hashing index). Among them, the message acquisition rule is an index related to the message receiving node. When each node in the cluster sends a cross-node message, for example, when requesting lock resources from the lock control node of a certain data object, it needs to first determine which is the lock control node of the data object through the message acquisition rule, and then generate the corresponding message and send it out.
[0064] In some cases, the coordinator node, lock control node, etc. may be dynamically adjusted (such as Dynamic Resource management, abbreviated as DRM). Taking the dynamic adjustment of the lock control node as an example, the lock control node corresponding to a certain data object may change from node 1 to node 2. When the cluster performs dynamic adjustment of the lock control node, it will update the version of the message acquisition rule.
[0065] The sending and receiving of cross-node messages in the cluster are not instantaneous, and there is a certain time delay between when a cross-node message is sent and when it is received and consumed. Exemplarily, node 3 needs to request lock resources from the lock control node of a certain data object. The current message acquisition rule shows that the lock control node of this data object is node 1. Node 3 will generate this cross-node message with node 1 as the target message receiving node. After this cross-node message is generated and before it is received by node 1, the cluster performs dynamic adjustment of the lock control node and converts the lock control node of this data object to node 2. At this time, this cross-node message will still be received by node 1. After node 1 receives and consumes this cross-node message, it is very likely to cause unexpected problems and even seriously affect the system security of the cluster.
[0066] In this embodiment, a message version number is set to solve the above problems. Specifically, each node in the cluster generates the same message version number locally (e.g., when the cluster starts), and generates the same message acquisition rule locally. The message version number is globally unique and is synchronized and updated with the version of the message acquisition rule. Exemplarily, when the cluster dynamically adjusts the lock control node and updates the version of the message acquisition rule, the message version number can change accordingly.
[0067] When generating and sending a cross-node message, the message sending node can first determine the target message receiving node according to the message acquisition rule of the message sending node, and then encapsulate the message. Exemplarily, when encapsulating the message, the message header can be generated first according to the target message receiving node, and then the version information is concatenated after the message header. That is to say, the version information can be concatenated as the first message in the message content. The version information can be the message version number of the message sending node itself, or can be converted through data, format, etc., which is not limited here.
[0068] When receiving a cross-node message, the message receiving node does not directly consume it. Instead, it first obtains the message version number included in the cross-node message, and obtains the message version number of the message receiving node, and then determines how to handle the cross-node message according to these two message version numbers. Exemplarily, the message receiving node can first parse the message header, then obtain the first message in the cross-node message, that is, the version information, then obtain the message version number of the message sending node according to the version information, and then compare the message version number of the message sending node and the message version number of the message receiving node. If the two message version numbers are the same, it indicates that the message acquisition rule of the cluster has not changed at the moment when the cross-node message is generated and received, and the message can be directly consumed. If the two message version numbers are different, it is necessary to further determine which of the two message version numbers is newer. If the message version number of the message sending node is newer, it is considered that it is consistent with the version of the current message acquisition rule, and the message receiving node can directly consume the message. If the message version number of the message receiving node is newer, it is considered that the message sending node uses the version of the old message acquisition rule when generating the message, and the message receiving node cannot directly consume the message, otherwise consistency problems may occur.
[0069] The management method of the database cluster in this embodiment generates a message acquisition rule and a message version number that is updated with the version of the message acquisition rule at each node of the cluster. When generating a cross-node message, the message sending node carries the message version number of the message sending node. When receiving a cross-node message, the message receiving node verifies the local message version number and the message version number of the cross-node message. Based on these two message version numbers, the message receiving node can determine whether the message acquisition rule of the cluster has changed during the time delay between the generation and reception of the cross-node message, and then perform corresponding processing on the cross-node message. This management method avoids the message receiving node from incorrectly processing cross-node messages, enhances the robustness of the cluster, and improves the system security of the cluster.
[0070] In some embodiments of the management method of the present invention, as Figure 2 shown, the generation of the message version number at each node of the database cluster includes:
[0071] S111, in response to triggering a preset generation condition, each node generates the same message version number, and the preset generation condition includes a startup instruction for starting the database cluster;
[0072] S113, each node issues a first broadcast for declaring that the node has generated the message version number;
[0073] S115, determine whether each node has received the first broadcasts from all other nodes;
[0074] S117, if so, determine that all nodes of the database cluster have generated the message version number.
[0075] In this embodiment, when the cluster is started or initialized, the same message version number can be generated at all nodes to ensure the consistency of the message version numbers of each node. Exemplarily, the initial message version number can be 0.
[0076] In this embodiment, before all necessary modules of the cluster have been started and are sufficient to provide services externally, it is necessary to ensure that each node has completed the generation of the message version number through broadcasting. Before it is determined that all nodes have completed the generation of the message version number, the cluster will not be able to provide services externally to prevent consistency problems.
[0077] In some embodiments of the management method of the present invention, as Figure 5 and Figure 6 shown, the steps of synchronously updating the message version number and the message acquisition rule include:
[0078] S511, in response to a demand from any node as an update node to trigger an update of the message acquisition rule, the update node performs a relocation operation; and
[0079] S513, the updating node sends out a second broadcast to notify other nodes to perform relocation operations.
[0080] Among them, the steps of the relocation operation include:
[0081] S523, update the message version number of this node according to a preset update rule, and the preset update rule includes an equal increment rule; and
[0082] S525, update the message acquisition rule of this node.
[0083] In this embodiment, when a certain node needs to update the message acquisition rule (for example, a certain node requests to perform dynamic resource management), it needs to first perform a relocation operation on this node. Specifically, the updating node first updates the message version number of this node according to a preset update rule. For example, the value of the message version number is updated from 0 to 1, and the message acquisition rule of this node is updated. Exemplarily, when the updating node updates the message acquisition rule of this node, it can first clear the message acquisition rule in the local cache, and then obtain a new version of the message acquisition rule from the coordinator node and cache it locally. After the updating node completes the relocation operation, it sends out a second broadcast to notify other nodes to perform relocation operations. Other nodes will respond to the second broadcast and perform relocation operations on this node to update the message version number and message acquisition rule of this node, so that all nodes in the cluster adopt consistent message version numbers and message acquisition rules.
[0084] In some embodiments of the management method of the present invention, as Figure 4 shown, the message receiving node disposes of the cross-node message according to the version information in the cross-node message and the message version number of the message receiving node, including:
[0085] S411, obtain the message version number of the cross-node message; and
[0086] S413, obtain the message version number of the message receiving node;
[0087] S415, determine whether the message version number of the message receiving node is greater than the message version number of the cross-node message;
[0088] S417, if it is greater, reject the cross-node message to the message sending node, or determine a new target message receiving node according to the message acquisition rule of the message receiving node, and forward the cross-node message to the new target message receiving node;
[0089] S419, if it is less than or equal, consume the cross-node message at the message receiving node.
[0090] In this embodiment, the preset update rule for the message version number is the equal increment rule, also known as the cumulative counting rule, where the same value is added each time an update occurs. Exemplarily, if the original message version number is 1, it becomes 2 after the update. In this way, it can be ensured that each node can update the message version number consistently, ensuring that the message version number is globally unique and that the new message version number is always greater than the old one, thus providing a basis for determining the newness and oldness of two message version numbers.
[0091] In this embodiment, if it is determined that the message version number of the message receiving node is equal to the message version number of the cross-node message, it indicates that the message acquisition rules of the cluster at the time of generation and reception of the cross-node message have not changed, and the message can be consumed directly. If it is determined that the message version number of the message receiving node is less than the message version number of the cross-node message, it indicates that the message version number of the message sending node is newer and the message version number of the message receiving node is older (for example: the message sending node has completed the relocation operation, but the message receiving node has not yet executed or is executing the relocation operation). The message acquisition rules of the cluster at the time of generation and reception of the cross-node message have not changed, and the message can be consumed directly.
[0092] If it is determined that the message version number of the message receiving node is greater than the message version number of the cross-node message, it indicates that the message version number of the message sending node is older and the message version number of the message receiving node is newer. The message acquisition rules of the cluster at the time of generation and reception of the cross-node message have changed, and the target message receiving node may not be the same as the actual message receiving node. At this time, the message receiving node can reject the cross-node message to the message sending node and let the message sending node resend the message. The message receiving node can also re-determine the target receiving node according to the updated message acquisition rule and then forward the cross-node message to the new target message receiving node.
[0093] It should be noted that in general, when the cluster dynamically adjusts the control lock nodes, only a small number of nodes are adjusted. Therefore, in most cases, even if the message acquisition rule changes at the time of generation and reception of the cross-node message, the target receiving node will not change. Once the message receiving node determines that the new target receiving node is itself, it can directly consume the message at this node.
[0094] In some embodiments of the management method of the present invention, as Figure 4 shown, before obtaining the message version number of the message receiving node, the management method further includes:
[0095] S412, locking the message version number of the message receiving node in shared mode; and
[0096] after obtaining the message version number of the message receiving node, the management method further includes:
[0097] S414, lift the blockade on the message version number of the message receiving node.
[0098] Block the message version number of the message receiving node in shared mode, that is, obtain the shared mode lock (also called the shared lock) of the message version number of the message receiving node, which can prevent other processes from changing the message version number during the process of the message receiving node reading the message version number, thereby preventing consistency problems with the message version number of the message receiving node.
[0099] In some embodiments of the management method of the present invention, as Figure 6 shown, before updating the message version number of the present node according to the preset update rule, it further includes:
[0100] S521, block the message version number of the present node in exclusive mode;
[0101] S522, obtain the message version number of the present node; and
[0102] After updating the message acquisition rule of the present node, it further includes:
[0103] S526, lift the blockade on the message version number of the present node.
[0104] Block the message version number of the present node in exclusive mode, that is, obtain the exclusive mode lock (also called the exclusive lock) of the message version number of the present node. The exclusive lock can freeze the message version number, which can prevent other processes from reading or changing the message version number during the process of the present node reading the message version number, thereby preventing consistency problems with the message version number of the present node.
[0105] In some embodiments of the management method of the present invention, as Figure 3 shown, before adding the version information to the cross-node message to be sent, the management method further includes:
[0106] S311, block the message version number of the message sending node in shared mode;
[0107] S313, obtain the message version number of the message sending node;
[0108] S315, generate version information according to the message version number of the message sending node;
[0109] S317, lift the blockade on the message version number of the message sending node; and
[0110] After adding the version information to the cross-node message to be sent, the management method further includes:
[0111] S321, send the cross-node message to the target message receiving node.
[0112] Lock the message version number of the message sending node in a shared mode, that is, obtain a shared lock on the message version number of the message sending node, which can prevent other processes from changing the message version number during the process of the message sending node reading the message version number, thereby preventing consistency problems with the message version number of the message sending node.
[0113] After the message sending node adds the version information to the cross-node message to be sent, it can put the cross-node message into the sending queue of this node and wait for an opportunity to send it to the target message receiving node.
[0114] The flowchart provided in this embodiment is not intended to indicate that the operations of the method will be executed in any specific order, or that all operations of the method are included in every case. In addition, the method may include additional operations. Within the scope of the technical idea provided by the method in this embodiment, additional changes can be made to the above method.
[0115] It should be understood that in some embodiments, each part can be implemented by hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system.
[0116] The embodiment of the present invention also provides a computer program product 10, a computer-readable storage medium 20, and a computer device 30. Figure 7 It is a schematic diagram of a computer program product 10 according to an embodiment of the present invention. Figure 8 It is a schematic diagram of a computer-readable storage medium 20 according to an embodiment of the present invention. Figure 9 It is a schematic diagram of a computer device 30 according to an embodiment of the present invention. The computer program product 10 includes a computer program 11, and when the computer program 11 is executed by a processor 32, it implements the steps of any one of the above management methods. The computer-readable storage medium 20 stores the above computer program 11, and when the computer program 11 is executed by a processor 32, it implements the steps of the management method of any one of the above embodiments. The computer device 30 may include a memory 31, a processor 32, and a computer program 11 stored on the memory 31 and running on the processor 32.
[0117] The computer program 11 for performing the operations of the present invention may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, configuration data of an integrated circuit, or source code or object code written in any combination of one or more programming languages and procedural programming languages. The computer program 11 may be executed entirely on the user's computer, partially on the user's computer, executed as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the latter case, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using the Internet through an Internet service provider). In some embodiments, in order to perform aspects of the present invention, an electronic circuit, including, for example, a programmable logic circuit, a field-programmable gate array (FPGA), or a programmable logic array (PLA), may execute computer-readable program instructions by utilizing the state information of the computer-readable program instructions to personalize the electronic circuit.
[0118] For the description of this embodiment, the computer program product 10 is a related product containing the computer program 11.
[0119] For the description of this embodiment, the computer-readable storage medium 20 is a tangible device capable of retaining and storing the computer program 11, which may be any device that can contain, store, communicate, propagate, or transport the computer program 11 for use by or in connection with an instruction execution system, apparatus, or device. More specific examples (non-exhaustive list) of the computer-readable storage medium 20 include the following: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disc read-only memory (CD-ROM), digital versatile disc (DVD), memory stick, floppy disk, mechanically encoded device, and any suitable combination of the above.
[0120] The computer device 30 can be, for example, a server, a desktop computer, a laptop computer, a tablet computer, or a smart phone. In some examples, the computer device 30 can be a cloud computing node. The computer device 30 can be described in the general context of computer system executable instructions, such as program modules, executed by a computer system. Generally, program modules can include routines, programs, object programs, components, logic, data structures, etc. that perform particular tasks or implement particular abstract data types. The computer device 30 can be implemented in a distributed cloud computing environment where tasks are performed by remote processing devices linked through a communication network. In a distributed cloud computing environment, program modules can be located on local or remote computing system storage media including storage devices.
[0121] The computer device 30 can include a processor 32 adapted to execute stored instructions and a memory 31 that provides temporary storage space for the operation of the instructions during operation. The processor 32 can be a single-core processor, a multi-core processor, a computing cluster, or any number of other configurations. The memory 31 can include random access memory (RAM), read-only memory, flash memory, or any other suitable storage system.
[0122] The computer device 30 can also include a network adapter / interface and an input / output (I / O) interface. The I / O interface allows data to be input and output with external devices that can be connected to the computer device. The network adapter / interface can provide communication between the computer device and a network, which is typically shown as a communication network.
[0123] At this point, those skilled in the art should recognize that although numerous exemplary embodiments of the present invention have been shown and described in detail herein, many other variations or modifications consistent with the principles of the present invention can still be directly determined or derived from the disclosure of the present invention without departing from the spirit and scope of the present invention. Therefore, the scope of the present invention should be understood and construed to cover all such other variations or modifications.
Claims
1. A management method for a database cluster, characterized in that, Including: Generating a message version number and a message acquisition rule at each node of the database cluster, the message version number being configured to be synchronously updated with the version of the message acquisition rule, and the message acquisition rule reflecting the index of the message receiving node; Any node with cross-node communication requirements serves as a message sending node, and determines a target message receiving node according to the message acquisition rule of the message sending node; And adding version information to the cross-node message to be sent, the version information reflecting the message version number of the message sending node; When any node serves as a message receiving node and receives the cross-node message, the message receiving node disposes of the cross-node message according to the version information in the cross-node message and the message version number of the message receiving node.
2. The management method according to claim 1, characterized in that The generating the message version number at each node of the database cluster includes: In response to triggering a preset generation condition, each node generates the same message version number, and the preset generation condition includes a start instruction for starting the database cluster; Each node sends a first broadcast for declaring that the node has generated the message version number; When each node has received the first broadcasts of all other nodes, it is determined that all nodes of the database cluster have generated the message version number.
3. The management method according to claim 2, wherein The steps of synchronously updating the message version number and the message acquisition rule include: In response to a need for any node to serve as an update node to trigger an update of the message acquisition rule, the update node performs a relocation operation; and The update node sends a second broadcast to notify other nodes to perform the relocation operation; Wherein, the steps of the relocation operation include: Updating the message version number of the node itself according to a preset update rule, and the preset update rule includes an equal increment rule; and Updating the message acquisition rule of the node itself.
4. The management method according to claim 3, wherein The message receiving node disposing of the cross-node message according to the version information in the cross-node message and the message version number of the message receiving node includes: Obtaining the message version number of the cross-node message; and Obtaining the message version number of the message receiving node; Judging whether the message version number of the message receiving node is greater than the message version number of the cross-node message; If it is greater, rejecting the cross-node message to the message sending node, or determining a new target message receiving node according to the message acquisition rule of the message receiving node, and forwarding the cross-node message to the new target message receiving node; If it is less than or equal, consuming the cross-node message at the message receiving node.
5. The management method according to claim 4, characterized in that Before obtaining the message version number of the message receiving node, the management method further includes: Locking the message version number of the message receiving node in a shared mode; and After obtaining the message version number of the message receiving node, the management method further includes: Remove the block on the message version number of the message receiving node.
6. The management method according to claim 3, wherein before updating the message version number of this node according to the preset update rule, it further includes: blocking the message version number of this node in an exclusive mode; obtaining the message version number of this node; and after updating the message acquisition rule of this node, it further includes: removing the block on the message version number of this node.
7. The management method according to claim 1, wherein before adding the version information to the cross-node message to be sent, the management method further includes: blocking the message version number of the message sending node in a shared mode; obtaining the message version number of the message sending node; generating the version information according to the message version number of the message sending node; removing the block on the message version number of the message sending node; and after adding the version information to the cross-node message to be sent, the management method further includes: sending the cross-node message to the target message receiving node.
8. A computer-readable storage medium, characterized in that, A computer program is stored thereon, and when the computer program is executed by a processor, it implements the steps of the management method of the database cluster according to any one of claims 1 to 7.
9. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the management method of the database cluster according to any one of claims 1 to 7.
10. A computer device, characterized in that, It includes a memory, a processor, and a computer program stored on the memory, and the processor executes the computer program to implement the steps of the management method of the database cluster according to any one of claims 1 to 7.