Node active / standby switching method, device, system and equipment

CN122933388APending Publication Date: 2026-10-16DAWNING NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611096447.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-22
Publication Date
2026-10-16

AI Technical Summary

Technical Problem

[0005]本申请提供一种节点主备切换方法、装置、系统及设备,用以解决通过人工在计算机设备上,为主节点配置静态高优先级,并为备节点配置静态低优先级的优先级策略,容易导致切换决策滞后,无法快速适应网络波动或局部故障,从而降低了节点主备切换效率的技术问题

Benefits of technology

[0035] The memory stores computer-executed instructions;

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122933388A_ABST
    Figure CN122933388A_ABST
Patent Text Reader

Abstract

The application provides a node master-slave switching method, device, system and equipment. The method comprises the following steps: obtaining a node state and a pre-generated first health degree announcement message of a node, and determining a node priority of the node according to the first health degree announcement message; obtaining a second health degree announcement message corresponding to a neighbor node of the node, and determining a neighbor node priority corresponding to the neighbor node according to the second health degree announcement message; comparing the node priority with the neighbor node priority to obtain a priority comparison result; and switching the master-slave state of the node and the neighbor node according to the comparison result and the node state to obtain a master-slave state switching result. The method improves the node master-slave switching efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of big data technology, and in particular to a method, apparatus, system and device for node master-slave switching. Background Technology

[0002] Node failover is a crucial mechanism in high-availability clusters for ensuring business continuity. When the primary node becomes unavailable due to failure, maintenance, or other reasons, the workload is switched to the standby node. The standby node must synchronize its data with the primary node beforehand, and verify the status of the new primary node after the switchover to ensure normal business operation.

[0003] In existing technologies, the traditional node primary / backup failover method involves manually configuring a static high priority for the primary node and a static low priority for the backup node on a computer device, so that when the primary node fails during data processing, the system can automatically switch to the backup node.

[0004] However, in the existing technology, the priority policy of manually configuring a static high priority for the primary node and a static low priority for the backup node on a computer device can easily lead to a delay in the switching decision and make it difficult to quickly adapt to network fluctuations or local failures, thereby reducing the efficiency of node primary-backup switching. Summary of the Invention

[0005] This application provides a node primary / standby switchover method, apparatus, system, and device to solve the technical problem that manually configuring a static high priority for the primary node and a static low priority for the standby node on a computer device can easily lead to a delay in switchover decisions, making it difficult to quickly adapt to network fluctuations or local failures, thereby reducing the efficiency of node primary / standby switchover.

[0006] Firstly, this application provides a node master-slave failover method, applicable to any node in a high-availability cluster, including:

[0007] Obtain the node status of the node and the pre-generated first health notification message, and determine the node priority of the node based on the first health notification message;

[0008] Obtain the second health notification message corresponding to the neighbor node of the node, and determine the priority of the neighbor node corresponding to the neighbor node based on the second health notification message;

[0009] The priority of the node is compared with the priority of the neighboring nodes to obtain the priority comparison result;

[0010] Based on the comparison results and the node status, the node and its neighboring nodes are switched between primary and backup states to obtain the primary / backup state switching result.

[0011] Optionally, in the method described above, the priority comparison result indicates that the node's priority is lower than the neighbor node's priority, and the node's state is either a master state or a standby state. The step of switching the master / standby state of the node and the neighbor node based on the comparison result and the node's state to obtain a master / standby state switching result includes: if the node's state is a master state, then converting the master state to a standby state; if the node's state is a standby state, then updating the standby state conversion time stamp; determining whether a third health notification message corresponding to the neighbor node can be obtained within a preset time period after the standby state conversion time stamp, wherein the third health notification message indicates that the neighbor node's priority is higher than the node's priority; if no third health notification message corresponding to the neighbor node is obtained, then updating the standby state to a master state.

[0012] The above technical solution, by switching the primary and backup states of the node and its neighboring nodes according to the comparison results and the node status, achieves rapid takeover of primary and backup nodes and seamless traffic migration, significantly improving business continuity.

[0013] Optionally, as described above, the process of generating the first health notification message includes: obtaining a random number, message content data, and a shared key corresponding to the node; generating a first message authentication code based on the random number, the message content data, and the shared key; and generating the first health notification message based on the random number, the message content data, and the first message authentication code.

[0014] The above technical solution generates the first health notification message by using the random number corresponding to the node, the message content data, and the shared key, thus avoiding the problem of man-in-the-middle attacks on the health notification message.

[0015] Optionally, in the method described above, the neighboring node is configured with a local node priority table; after obtaining the node status of the node and the pre-generated first health announcement message, the method further includes: sending the first health announcement message to the neighboring node through a preset multicast method, so that the neighboring node calculates a second message authentication code based on the shared key, the random number and the message content data, and compares the second message authentication code with the first message authentication code, so as to update the local node priority table according to the first health announcement message, or discard the first health announcement message.

[0016] The above technical solution verifies the first health notification message to determine whether to accept or discard it, ensuring that the master-slave switchover is based on real health information, thereby improving the security and reliability of high-availability cluster collaboration.

[0017] Optionally, in the method described above, obtaining the second health announcement message corresponding to the neighboring nodes of the node includes: in a multicast communication mechanism, obtaining the real-time network topology of the high-availability cluster through a dynamic routing protocol; analyzing the link data corresponding to each path in the real-time network topology through a link state database; determining the target path between the node and the neighboring nodes from each path based on the link data through a preset path algorithm; and obtaining the second health announcement message corresponding to the neighboring nodes based on the target path.

[0018] The above technical solution obtains the second health notification message corresponding to the neighbor node through the calculated target path, ensuring the real-time transmission of the health notification message and reducing the delay of configuration synchronization and state synchronization.

[0019] Optionally, in the method described above, the link data includes load data and latency data of one or more links; the step of determining the target path between the node and the neighboring node from each path based on the link data using a preset path algorithm includes: calculating the corresponding comprehensive cost value based on the load data and latency data of each link in each path using a preset path algorithm; selecting a target cost value from each comprehensive cost value; and determining the target path between the node and the neighboring node from each path based on the target cost value.

[0020] The above technical solution determines the target path between the node and its neighboring nodes by calculating the comprehensive cost value of each path, thus ensuring the accuracy of the target path selection.

[0021] Optionally, the method described above further includes: obtaining a state synchronization message corresponding to the neighbor node, wherein the state synchronization message is generated based on a newly established session on the neighbor node, and the state synchronization message includes a neighbor node identifier; querying a local state database based on the neighbor node identifier to determine whether state information corresponding to the neighbor node identifier exists; if it is determined that the state information does not exist, storing the state synchronization message in the local state database.

[0022] The above technical solution updates the local state database by updating the state synchronization messages corresponding to neighboring nodes, avoiding the time-consuming process of reconstructing session states and improving business continuity and user experience.

[0023] Secondly, this application provides a node master-slave switching device, applicable to any node in a high-availability cluster, comprising:

[0024] The determination module is used to obtain the node status of the node and the pre-generated first health notification message, and determine the node priority of the node based on the first health notification message.

[0025] The first acquisition module is used to acquire the second health notification message corresponding to the neighbor node of the node, and determine the priority of the neighbor node corresponding to the neighbor node based on the second health notification message.

[0026] The comparison module is used to compare the priority of the node with the priority of the neighboring nodes to obtain the priority comparison result;

[0027] The switching module is used to perform a primary / backup state switch between the node and the neighboring node based on the comparison results and the node status, so as to obtain the primary / backup state switch result.

[0028] Thirdly, the application provides a node primary / backup switching system, including: a client cluster, a switch cluster, a high-availability cluster, and a server cluster. The client cluster includes multiple clients, the switch cluster includes a first switch, a second switch, and a third switch, the high-availability cluster includes multiple nodes, and the server cluster includes multiple servers.

[0029] Each client in the client cluster communicates with the first switch.

[0030] The first switch communicates with each node in the high-availability cluster.

[0031] The nodes in the high-availability cluster communicate with each other, and each node in the high-availability cluster communicates with the second switch.

[0032] The second switch communicates with each server in the server cluster;

[0033] The third switch is connected to each node in the high-availability cluster.

[0034] Fourthly, this application provides an electronic device, comprising: at least one processor and a memory;

[0035] The memory stores computer-executed instructions;

[0036] The at least one processor executes computer execution instructions stored in the memory, causing the at least one processor to perform the method described in the first aspect above and various possible designs of the first aspect.

[0037] The node master / standby switchover method, apparatus, system, and device provided in this application obtain the node status and pre-generated first health announcement message of the node, and determine the node priority of the node based on the first health announcement message; obtain the second health announcement message corresponding to the node's neighboring nodes, and determine the neighboring node priority based on the second health announcement message; compare the node priority with the neighboring node priority to obtain a priority comparison result; and perform master / standby switchover on the node and neighboring nodes based on the comparison result and the node status to obtain the master / standby switchover result. By processing the first health announcement message of the node and the second health announcement message of the neighboring nodes, the dynamic priorities of the node and neighboring nodes are obtained to determine the master / standby switchover result. This method not only eliminates the need for manual intervention but also replaces static priorities, making it adaptable to network fluctuations or local faults, thereby improving the efficiency of node master / standby switchover. Attached Figure Description

[0038] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0039] Figure 1 This is a schematic diagram illustrating an application scenario of the node primary / standby switching method provided in the embodiments of this application;

[0040] Figure 2 A flowchart illustrating the node master / slave switchover method provided in this application embodiment. Figure 1 ;

[0041] Figure 3 A flowchart illustrating the node master / slave switchover method provided in this application embodiment. Figure 2 ;

[0042] Figure 4 This is a schematic diagram of the node master / slave switching device provided in the embodiments of this application;

[0043] Figure 5 This is a schematic diagram of the node master / slave switching system provided in the embodiments of this application;

[0044] Figure 6 This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this application.

[0045] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation

[0046] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0047] Node failover is a crucial mechanism in high-availability clusters for ensuring business continuity. When the primary node becomes unavailable due to failure, maintenance, or other reasons, the workload is switched to the standby node. The standby node must synchronize its data with the primary node beforehand and verify the status of the new primary node after the switchover to ensure normal business operation. In existing technologies, traditional node failover methods involve manually configuring a static high priority for the primary node and a static low priority for the standby node on computer equipment. This allows for automatic switching to the standby node if the primary node fails during data processing. However, this priority strategy, which relies on manual configuration, can lead to delayed switchover decisions and an inability to quickly adapt to network fluctuations or localized failures, thus reducing the efficiency of node failover.

[0048] To address the aforementioned technical problems, this application proposes the following technical concept: determining the node priority based on the node's first health announcement message, determining the corresponding neighbor node priority using the neighbor node's second health announcement message, comparing the node priority with the neighbor node priority to obtain a priority comparison result, and using the comparison result and node status to switch the primary / standby status of the node and its neighbor nodes, thereby improving the node primary / standby switching efficiency.

[0049] Figure 1 This is a schematic diagram illustrating an application scenario of the node primary / backup switching method provided in this application embodiment.

[0050] like Figure 1 As shown, the high-availability cluster 10 in this scenario includes: node 101 and neighbor node 102.

[0051] Node 101 can be a single physical server or other hardware devices.

[0052] Neighbor node 102 can be a single physical server or a cluster of multiple physical servers.

[0053] In the high-availability cluster 10, any node 101 obtains its node status and a pre-generated first health announcement message, and determines its node priority based on the first health announcement message. It then obtains the second health announcement message corresponding to its neighbor node 102, and determines its neighbor node priority based on the second health announcement message. The node priority is compared with the neighbor node priority to obtain a priority comparison result. Based on the comparison result and the node status, a primary / standby switch is performed between node 101 and its neighbor node 102 to obtain the primary / standby switch result. A detailed implementation example is provided below.

[0054] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will be described below with reference to the accompanying drawings.

[0055] Figure 2 A flowchart illustrating the node master / slave switchover method provided in this application embodiment. Figure 1 The execution entity in this embodiment can be Figure 1 The high-availability cluster shown in the embodiment is not specifically limited to any node in this embodiment. Figure 2 As shown, the method includes:

[0056] S201: Obtain the node status and pre-generated first health notification message of the node, and determine the node priority of the node based on the first health notification message.

[0057] In this embodiment, each node in the high-availability cluster is used to access different internal and external networks, run high-availability programs, send multicast group join messages, run health monitoring programs, and periodically send health notification messages to neighboring nodes to inform them of the node's status.

[0058] High Availability Cluster is a widely used standard technical term in the field of information technology. It describes a server cluster technology that minimizes service interruption time and ensures business continuity through mechanisms such as redundant node design, automatic fault detection and switching.

[0059] Specifically, the node status and first health notification message of the node are obtained through the health monitoring program, and the health score is extracted from the first health notification message to determine the node priority based on the health score.

[0060] In this embodiment, the process of generating the first health notification message specifically includes steps a~c:

[0061] Step a: Obtain the random number, message content data, and shared key corresponding to the node.

[0062] In this embodiment, the message content data includes an Ethernet header, an IP header, a User Datagram Protocol (UDP) header, a data structure format, an identifier, and a health status.

[0063] For example, the Ethernet header is ETHERNET HEADER; the IP header is IP HEADER; the User Datagram Protocol is UDP; the data structure format is TLV; and the identifier is ID.

[0064] Step b: Generate the first message authentication code based on the random number, message content data, and shared key.

[0065] For example, the first message authentication code is the HMAC value corresponding to the message content data.

[0066] Step c: Generate the first health notification message based on the random number, message content data, and first message authentication code.

[0067] For example, the first health notification message is as follows:

[0068]

[0069] The above technical solution generates the first health notification message by using the random number corresponding to the node, the message content data, and the shared key, thus avoiding the problem of man-in-the-middle attacks on the health notification message.

[0070] In addition, the neighboring nodes are configured with a local node priority table; after step S201, the method further includes: sending the first health announcement message to the neighboring nodes through a preset multicast method, so that the neighboring nodes can calculate the second message authentication code based on the shared key, random number and message content data, and compare the second message authentication code with the first message authentication code, so as to update the local node priority table according to the first health announcement message, or discard the first health announcement message.

[0071] Specifically, the first health announcement message is sent to neighboring nodes via a preset multicast method, so that the neighboring nodes can calculate the second message authentication code based on the shared key, random number and message content data, and determine whether the second message authentication code is consistent with the first message authentication code. If the second message authentication code is consistent with the first message authentication code, the local node priority table is updated according to the first health announcement message. If the second message authentication code is inconsistent with the first message authentication code, the first health announcement message is discarded.

[0072] In addition, hardware acceleration modules can be introduced during the HMAC verification process to improve the efficiency of HMAC verification.

[0073] For example, the hardware acceleration module is a TPM chip or a dedicated encryption coprocessor.

[0074] In addition, nodes need to periodically send health notification messages to the bus to inform neighboring nodes of their status. Neighboring nodes then decide whether to change their network forwarding actions based on the health notification messages.

[0075] The above technical solution verifies the first health notification message to determine whether to accept or discard it, ensuring that the master-slave switchover is based on real health information, thereby improving the security and reliability of high-availability cluster collaboration.

[0076] S202: Obtain the second health announcement message corresponding to the neighbor node of the node, and determine the priority of the neighbor node corresponding to the neighbor node based on the second health announcement message.

[0077] In this embodiment, a neighboring node is a node that is directly connected to the node through communication. It can be one node or multiple nodes.

[0078] For example, a neighbor node is a single node.

[0079] Specifically, step S202, obtaining the second health notification message corresponding to the neighboring nodes of the node, includes steps a~d:

[0080] Step a: In the multicast communication mechanism, obtain the real-time network topology of the high-availability cluster through a dynamic routing protocol.

[0081] In this embodiment, the multicast communication mechanism refers to a network communication method based on the IP multicast protocol, which is used to send data packets to multiple nodes simultaneously.

[0082] For example, the dynamic routing protocol is OSPF or BGP.

[0083] Step b: Analyze the link data corresponding to each path in the real-time network topology using the link state database.

[0084] In this embodiment, the link state database can be an LSDB database or other databases.

[0085] Among them, the LSDB database is the core database used in the link-state routing protocol to store network topology information.

[0086] Step c: Using a preset path algorithm, determine the target path between the node and its neighboring nodes from each path based on the link data.

[0087] Specifically, the link data includes load data and latency data for one or more links; step c specifically includes steps c1 to c3:

[0088] Step c1: Calculate the corresponding comprehensive cost based on the load data and latency data of each link in each path using a preset path algorithm.

[0089] In this embodiment, the comprehensive cost value is the cumulative comprehensive cost of all links along the entire path.

[0090] In this embodiment, the preset path algorithm can be Dijkstra's algorithm or other algorithms.

[0091] Step c2: Select the target value from the comprehensive value.

[0092] For example, the smallest comprehensive cost value among all comprehensive cost values ​​is selected as the target cost value.

[0093] Step c3: Based on the target value, determine the target path between the node and its neighboring nodes from each path.

[0094] For example, the target path is the shortest path.

[0095] The above technical solution determines the target path between a node and its neighboring nodes by calculating the comprehensive cost value of each path, thus ensuring the accuracy of target path selection.

[0096] Step d: Obtain the second health notification message corresponding to the neighboring nodes based on the target path.

[0097] The above technical solution obtains the second health notification message corresponding to the neighbor node through the calculated target path, ensuring the real-time transmission of the health notification message and reducing the delay of configuration synchronization and state synchronization.

[0098] In addition, step S202 specifically includes steps e~h:

[0099] Step e: Initially obtain the second health announcement message corresponding to the neighbor node, wherein the second health announcement message is generated based on the random number corresponding to the neighbor node, the content data of the first message, and the third message authentication code; the third message authentication code is generated based on the random number corresponding to the neighbor node, the content data of the first message, and the shared key.

[0100] In this embodiment, the first message content data includes an Ethernet header, an IP header, a User Datagram Protocol (UDP) header, a data structure format, an identifier, and a health status.

[0101] For example, the third message authentication code is the HMAC value corresponding to the content data of the first message.

[0102] Step f: Calculate the fourth message authentication code based on the shared key, random number, and first message content data of the neighboring node.

[0103] Step g: Determine whether the fourth message authentication code is consistent with the third message authentication code.

[0104] Step h: If the fourth message authentication code is determined to be consistent with the third message authentication code, then update the local node priority table according to the second health announcement message, and complete the acquisition of the second health announcement message sent by the neighboring node.

[0105] Furthermore, if the fourth message authentication code is determined to be inconsistent with the third message authentication code, the second health notification message is discarded.

[0106] Specifically, in step S202, the priority of the neighboring node is determined according to the second health notification message. Specifically, the health status is extracted from the second health notification message, and the priority of the neighboring node is determined according to the health status.

[0107] S203: Compare the node priority with the priorities of neighboring nodes to obtain the priority comparison result.

[0108] In this embodiment, the priority comparison result can be that the node priority is higher than or equal to the neighbor node priority, or the node priority is lower than the neighbor node priority.

[0109] S204: Based on the comparison results and node status, perform a primary / backup state switch on the node and its neighboring nodes to obtain the primary / backup state switch result.

[0110] In addition, steps a~c are also included:

[0111] Step a: Obtain the state synchronization message corresponding to the neighbor node. The state synchronization message is generated based on the newly established session on the neighbor node and includes the neighbor node identifier.

[0112] Specifically, obtaining the state synchronization message corresponding to the neighbor node includes steps a1 to a4:

[0113] Step a1: Initially obtain the state synchronization message corresponding to the neighbor node, wherein the state synchronization message is generated based on the random number corresponding to the neighbor node, the content data of the second message, and the fifth message authentication code; the fifth message authentication code is generated based on the random number corresponding to the neighbor node, the content data of the second message, and the shared key.

[0114] In this embodiment, the second message content data includes an Ethernet header, an IP header, a User Datagram Protocol (UDP) header, a data structure format, an identifier, and operation and synchronization status information.

[0115] For example, the Ethernet header is ETHERNET HEADER; the IP header is IP HEADER; the User Datagram Protocol is UDP; the data structure format is TLV; and the identifier is ID.

[0116] For example, the fifth message authentication code is the HMAC value corresponding to the content data of the second message.

[0117] For example, the state synchronization message is:

[0118]

[0119] Step a2: Calculate the sixth message authentication code based on the shared key, random number, and second message content data of the neighboring node.

[0120] Step a3: Determine whether the sixth message authentication code is consistent with the fifth message authentication code.

[0121] Step a4: If the sixth message authentication code is found to be consistent with the fifth message authentication code, then the acquisition of the state synchronization message corresponding to the neighbor node is completed.

[0122] Furthermore, if the sixth message authentication code is determined to be inconsistent with the fifth message authentication code, the state synchronization message is discarded.

[0123] Step b: Query the local state database based on the neighbor node identifier to determine whether there is state information corresponding to the neighbor node identifier.

[0124] In this embodiment, the status information can be status synchronization information or other information.

[0125] Furthermore, when a neighboring node is abnormal, traffic data will be redirected to that node, enabling rapid forwarding without the need to match security policies.

[0126] In addition, when a deletion message is received from a neighboring node, the corresponding session is deleted according to the description in the deletion message.

[0127] Step c: If it is determined that no state information exists, the state synchronization message is stored in the local state database.

[0128] Specifically, if it is determined that no state information exists, the corresponding session is stored in the local connection table of the local state database according to the state synchronization message, so that the corresponding session traffic forwarded by the neighbor node can be quickly received when a master-slave switch occurs.

[0129] The above technical solution updates the local state database by updating the state synchronization messages corresponding to neighboring nodes, avoiding the time-consuming process of reconstructing session states and improving business continuity and user experience.

[0130] Furthermore, during session synchronization of state synchronization messages, the state synchronization frequency is dynamically adjusted based on the session's activity level to reduce redundant synchronization operations. For example, a high-frequency synchronization strategy is used for active sessions, while a low-frequency synchronization strategy is used for inactive sessions.

[0131] In addition, steps d~f are also included:

[0132] Step d: Receive configuration synchronization messages sent by neighboring nodes via domain broadcast.

[0133] Specifically, receiving configuration synchronization messages sent by neighboring nodes includes steps d1 to d4:

[0134] Step d1: Initially receive the configuration synchronization message sent by the neighbor node. The configuration synchronization message is generated based on the random number corresponding to the neighbor node, the content data of the third message, and the seventh message authentication code. The seventh message authentication code is generated based on the random number corresponding to the neighbor node, the content data of the third message, and the shared key.

[0135] In this embodiment, the second message content data includes an Ethernet header, an IP header, a User Datagram Protocol (UDP) header, a data structure format, identifiers, operations, and configurations.

[0136] For example, the Ethernet header is ETHERNET HEADER; the IP header is IP HEADER; the User Datagram Protocol is UDP; the data structure format is TLV; and the identifier is ID.

[0137] For example, the seventh message authentication code is the HMAC value corresponding to the content data of the third message.

[0138] For example, the synchronization message is configured as follows:

[0139]

[0140] Step d2: Calculate the eighth message authentication code based on the shared key, random number, and third message content data of the neighboring node.

[0141] Step d3: Determine whether the eighth message authentication code is consistent with the seventh message authentication code.

[0142] Step d4: If the eighth message authentication code is found to be consistent with the seventh message authentication code, then the configuration synchronization message sent by the neighbor node is received.

[0143] In addition, if the eighth message authentication code is determined to be inconsistent with the seventh message authentication code, the configuration synchronization message is discarded.

[0144] Step e: Obtain the configuration data corresponding to the node.

[0145] Step f: Update the configuration data according to the configuration synchronization message to complete the configuration data update.

[0146] In addition, a version number identifier can be introduced during the process of updating configuration data based on configuration synchronization messages to avoid configuration conflicts caused by network partitions or node offline. That is, each configuration synchronization message contains a version number identifier, and the node determines whether to update the local configuration based on the version difference.

[0147] In addition, machine learning models can be introduced to predict the health trend of each node and pre-trigger the primary / backup switch of the node before the health declines, so as to avoid business interruption.

[0148] In summary, the node primary / standby switchover method provided in this embodiment obtains the node status and a pre-generated first health announcement message, and determines the node priority based on the first health announcement message; obtains the second health announcement messages corresponding to the node's neighboring nodes, and determines the neighboring node priority based on the second health announcement messages; compares the node priority with the neighboring node priority to obtain a priority comparison result; and performs primary / standby switchover on the node and neighboring nodes based on the comparison result and the node status to obtain the primary / standby switchover result. By processing the first health announcement message of the node and the second health announcement message of the neighboring nodes, the dynamic priorities of the node and neighboring nodes are obtained to determine the primary / standby switchover result. This method not only eliminates the need for manual intervention but also replaces static priorities, making it adaptable to network fluctuations or local faults, thereby improving the efficiency of node primary / standby switchover.

[0149] Figure 3 A flowchart illustrating the node master / slave switchover method provided in this application embodiment. Figure 2 In the embodiments of this application, in Figure 2 Based on the provided embodiments, the specific implementation method of switching the primary / standby status of a node and its neighboring nodes according to the comparison results and node status in step S207 is described in detail to obtain the primary / standby status switching result. For example... Figure 3 As shown, the method includes:

[0150] S301: If the node status is master status, then change the master status to standby status.

[0151] Specifically, if a node is in the host state, it will be switched to the standby state. The standby state is used to instruct high-priority nodes in the high-availability cluster to send network protocol data units to neighboring nodes, so that the neighboring nodes can take over the mapping between the unique physical identifier and the gateway address and take over the traffic.

[0152] For example, the network protocol data unit is gratuitous ARP; the unique physical identifier is MAC.

[0153] S302: If the node status is standby, then update the standby transition time stamp.

[0154] In this embodiment, the standby machine conversion time stamp is used to represent the time node of the current standby machine status.

[0155] In addition, if a node's priority is higher than or equal to that of its neighboring nodes and its state is master, then the master state is maintained; if a node's priority is higher than or equal to that of its neighboring nodes and its state is standby, then the standby state is updated to master.

[0156] S303: Determine whether the third health notification message corresponding to the neighbor node can be obtained within the preset time after the standby conversion time stamp, wherein the third health notification message is used to indicate that the neighbor node has a higher priority than the node priority.

[0157] In this embodiment, the preset duration can be any of 1 second, 3 seconds, or 5 seconds, or other times.

[0158] For example, the preset time is 3 seconds.

[0159] S304: If the third health notification message corresponding to the neighbor node is not obtained, the standby status will be updated to the master status.

[0160] In addition, after updating to host status and receiving health notification messages with low priority, it will send a gratuitous ARP to the network it has taken over, taking over the original forwarding network so that neighboring nodes will no longer forward packets from the corresponding subnet.

[0161] In summary, the node primary / standby switchover method provided in this embodiment, by switching the node status from primary to standby if the node is in primary status, and updating the standby switchover time stamp if the node is in standby status, determines whether a third health notification message corresponding to a neighboring node can be obtained within a preset time after the standby switchover time stamp. The third health notification message indicates that the neighboring node has a higher priority than the node. If no third health notification message corresponding to a neighboring node is obtained, the standby status is updated to primary status. By switching the primary / standby status of the node and its neighboring nodes based on the comparison results and the node status, the method achieves rapid takeover of primary and standby nodes and seamless traffic migration, significantly improving business continuity.

[0162] Figure 4 This is a schematic diagram of the node master / slave switching device provided in an embodiment of this application. Figure 4As shown, the node master / slave switching device includes: a determination module 401, a first acquisition module 402, a comparison module 403, and a switching module 404.

[0163] The determination module 401 is used to obtain the node status of the node and the pre-generated first health notification message, and determine the node priority of the node based on the first health notification message.

[0164] The first acquisition module 402 is used to acquire the second health announcement message corresponding to the neighbor node of the node, and determine the priority of the neighbor node corresponding to the neighbor node based on the second health announcement message.

[0165] The comparison module 403 is used to compare the node priority with the priority of neighboring nodes to obtain the priority comparison result.

[0166] The switching module 404 is used to switch the primary and backup states of a node and its neighboring nodes based on the comparison results and node status, so as to obtain the primary and backup state switching results.

[0167] In one possible implementation, the priority comparison result shows that the node's priority is lower than that of its neighboring nodes, and the node's state is either master or standby; correspondingly, the switching module 404 specifically includes:

[0168] The conversion unit is used to convert the node status from master to standby if the node status is master.

[0169] The first update unit is used to update the standby transition time stamp if the node status is standby.

[0170] The judgment unit is used to determine whether the third health notification message corresponding to the neighbor node can be obtained within a preset time period after the standby machine conversion time stamp. The third health notification message is used to indicate that the neighbor node has a higher priority than the node priority.

[0171] The second update unit is used to update the standby status to the master status if the third health announcement message corresponding to the neighbor node is not obtained.

[0172] In one possible implementation, the device further includes:

[0173] The second acquisition module is used to acquire the random number, message content data and shared key corresponding to the node.

[0174] The first generation module is used to generate the first message authentication code based on the random number, message content data, and shared key.

[0175] The second generation module is used to generate the first health notification message based on the random number, message content data, and the first message authentication code.

[0176] In one possible implementation, neighboring nodes are configured with local node priority tables; the apparatus also includes:

[0177] The sending module is used to send the first health announcement message to neighboring nodes through a preset multicast method, so that the neighboring nodes can calculate the second message authentication code based on the shared key, random number and message content data, and compare the second message authentication code with the first message authentication code, so as to update the local node priority table according to the first health announcement message, or discard the first health announcement message.

[0178] In one possible implementation, the first acquisition module 402 specifically includes:

[0179] The acquisition unit is used to obtain the real-time network topology of a high-availability cluster through a dynamic routing protocol in a multicast communication mechanism.

[0180] The analysis unit is used to analyze the link data corresponding to each path in the real-time network topology through the link state database.

[0181] The determination unit is used to determine the target path between a node and its neighboring nodes from each path based on the link data using a preset path algorithm.

[0182] The acquisition unit is used to obtain the second health notification message corresponding to the neighboring node according to the target path.

[0183] In one possible implementation, the link data includes load data and latency data for one or more links; the determining unit specifically includes:

[0184] The calculation unit is used to calculate the corresponding comprehensive cost value based on the load data and delay data of each link in each path using a preset path algorithm.

[0185] The selection unit is used to select the target value from the comprehensive value.

[0186] The determining unit is used to determine the target path between a node and its neighboring nodes from among the paths based on the target cost value.

[0187] In one possible implementation, the device further includes:

[0188] The third acquisition module is used to acquire the state synchronization message corresponding to the neighbor node. The state synchronization message is generated based on the newly established session on the neighbor node and includes the neighbor node identifier.

[0189] The query module is used to query the local state database based on the neighbor node identifier to determine whether the state information corresponding to the neighbor node identifier exists.

[0190] The storage module is used to store the state synchronization message to the local state database if it is determined that no state information exists.

[0191] The apparatus provided in this embodiment can be used to execute the technical solutions of the above method embodiments. Its implementation principle and technical effects are similar, and will not be described again here.

[0192] Figure 5 This is a schematic diagram of the node master / slave failover system provided in an embodiment of this application. Figure 5 As shown, the node master / slave switching system of this embodiment includes: client cluster 20, switch cluster 30, high availability cluster 10 and server cluster 40. Client cluster 20 includes multiple clients, switch cluster 30 includes a first switch, a second switch and a third switch, high availability cluster 10 includes multiple nodes, and server cluster 40 includes multiple servers.

[0193] Each client in the client cluster 20 communicates with the first switch.

[0194] For example, each client is Client0, Client1, and Client2.

[0195] For example, the first switch is SW1.

[0196] The first switch communicates with each node in the high-availability cluster 10.

[0197] For example, the nodes are Node0, Node1, and Node2.

[0198] The nodes in the high-availability cluster 10 communicate with each other, and each node in the high-availability cluster 10 communicates with the second switch.

[0199] For example, the second switch is SW2.

[0200] Specifically, each node in the high-availability cluster 10 communicates with the second switch through the HA interface.

[0201] Each node is used to forward traffic data from different subnets.

[0202] The HA interface is a key channel for communication and state synchronization between nodes, ensuring that the cluster can quickly and reliably switch services when a failure occurs.

[0203] The second switch communicates with each server in server cluster 40.

[0204] For example, each server is Server1, Server2 and Server3.

[0205] The third switch communicates with each node in the high-availability cluster 10.

[0206] For example, the third switch is SW3.

[0207] In addition, each node can only transmit data in one direction to the second switch, which avoids the overhead of the collision detection mechanism and improves transmission stability.

[0208] Figure 6 This is a schematic diagram of the hardware structure of the electronic device provided in an embodiment of this application. Figure 6 As shown, the electronic device of this embodiment includes: a processor 601 and a memory 602; the memory stores computer execution instructions; at least one processor executes the computer execution instructions stored in the memory, causing at least one processor to execute the node master / slave switching method described above.

[0209] Alternatively, the memory 602 can be either standalone or integrated with the processor 601.

[0210] When the memory 602 is set up independently, the electronic device also includes a bus 603 for connecting the memory 602 and the processor 601.

[0211] This application also provides a computer-readable storage medium storing computer-executable instructions. When the processor executes the computer-executable instructions, the above-described node master / slave switching method is implemented.

[0212] This application also provides a computer program product, including a computer program, which, when executed by a processor, implements the above-described node master / slave switching method.

[0213] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily essential to this application.

[0214] It should be further noted that although the steps in the flowchart are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowchart may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.

[0215] It should be understood that the above-described device embodiments are merely illustrative, and the device of this application can also be implemented in other ways. For example, the division of units / modules in the above embodiments is only a logical functional division, and there may be other division methods in actual implementation. For example, multiple units, modules, or components may be combined, or integrated into another system, or some features may be ignored or not executed.

[0216] Furthermore, unless otherwise specified, the functional units / modules in the various embodiments of this application can be integrated into one unit / module, or each unit / module can exist physically separately, or two or more units / modules can be integrated together. The integrated units / modules described above can be implemented in hardware or as software program modules.

[0217] When integrated units / modules are implemented in hardware, the hardware can be digital circuits, analog circuits, etc. The physical implementation of the hardware structure includes, but is not limited to, transistors, memristors, etc. Unless otherwise specified, the processor can be any suitable hardware processor, such as a CPU, GPU, FPGA, DSP, and ASIC, etc. Unless otherwise specified, the storage unit can be any suitable magnetic or magneto-optical storage medium, such as Resistive Random Access Memory (RRAM), Dynamic Random Access Memory (DRAM), Static Random Access Memory (SRAM), Enhanced Dynamic Random Access Memory (EDRAM), High-Bandwidth Memory (HBM), Hybrid Memory Cube (HMC), etc.

[0218] If the integrated unit / module is implemented as a software program module and sold or used as an independent product, it can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned memory includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.

[0219] In the above embodiments, the descriptions of each embodiment have their own emphasis. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments. The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as the combination of these technical features does not contradict each other, it should be considered within the scope of this specification.

[0220] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.

[0221] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.

Claims

1. A node primary / standby switchover method, characterized in that, Applied to any node in a high-availability cluster, including: Obtain the node status of the node and the pre-generated first health notification message, and determine the node priority of the node based on the first health notification message; Obtain the second health notification message corresponding to the neighbor node of the node, and determine the priority of the neighbor node corresponding to the neighbor node based on the second health notification message; The priority of the node is compared with the priority of the neighboring nodes to obtain the priority comparison result; Based on the comparison results and the node status, the node and its neighboring nodes are switched between primary and backup states to obtain the primary / backup state switching result.

2. The method according to claim 1, characterized in that, The priority comparison result is that the priority of the node is lower than the priority of the neighbor node, and the node status is either host status or standby status. The step of performing a primary / standby state switch on the node and its neighboring nodes based on the comparison result and the node status to obtain the primary / standby state switch result includes: If the node status is master status, then the master status is changed to standby status; If the node status is standby, then update the standby transition time stamp; Determine whether a third health notification message corresponding to the neighbor node can be obtained within a preset time period after the standby machine conversion time stamp, wherein the third health notification message is used to indicate that the neighbor node has a higher priority than the node priority; If the third health notification message corresponding to the neighbor node is not obtained, the standby status will be updated to the master status.

3. The method according to claim 1, characterized in that, The process of generating the first health notification message includes: Obtain the random number, message content data, and shared key corresponding to the node; A first message authentication code is generated based on the random number, the message content data, and the shared key; The first health notification message is generated based on the random number, message content data, and the first message authentication code.

4. The method according to claim 3, characterized in that, The neighboring nodes are configured with a local node priority table; After obtaining the node status of the node and the pre-generated first health notification message, the method further includes: The first health notification message is sent to neighboring nodes via a preset multicast method, so that the neighboring nodes can calculate the second message authentication code based on the shared key, the random number and the message content data, and compare the second message authentication code with the first message authentication code, so as to update the local node priority table according to the first health notification message, or discard the first health notification message.

5. The method according to claim 1, characterized in that, The step of obtaining the second health notification message corresponding to the neighboring nodes of the node includes: In the multicast communication mechanism, the real-time network topology of the high-availability cluster is obtained through a dynamic routing protocol; The link data corresponding to each path in the real-time network topology is analyzed using a link state database. Using a preset path algorithm, the target path between the node and its neighboring nodes is determined from each path based on the link data. Obtain the second health notification message corresponding to the neighbor node according to the target path.

6. The method according to claim 5, characterized in that, The link data includes load data and latency data for one or more links; The step of determining the target path between the node and its neighboring nodes from each path based on each link data using a preset path algorithm includes: The comprehensive cost is calculated based on the load and latency data of each link in each path using a preset path algorithm. Select the target value from the comprehensive value; Based on the target cost value, the target path between the node and its neighboring nodes is determined from each path.

7. The method according to claim 1, characterized in that, Also includes: Obtain the state synchronization message corresponding to the neighbor node, wherein the state synchronization message is generated based on the newly established session on the neighbor node, and the state synchronization message includes the neighbor node identifier; The local status database is queried based on the neighbor node identifier to determine whether the status information corresponding to the neighbor node identifier exists. If it is determined that the status information does not exist, the status synchronization message is stored in the local status database.

8. A node master / slave switching device, characterized in that, Applied to any node in a high-availability cluster, including: The determination module is used to obtain the node status of the node and the pre-generated first health notification message, and determine the node priority of the node based on the first health notification message. The first acquisition module is used to acquire the second health notification message corresponding to the neighbor node of the node, and determine the priority of the neighbor node corresponding to the neighbor node based on the second health notification message. The comparison module is used to compare the priority of the node with the priority of the neighboring nodes to obtain the priority comparison result; The switching module is used to perform a primary / backup state switch between the node and the neighboring node based on the comparison result and the node status, so as to obtain the primary / backup state switch result.

9. A node master / slave failover system, characterized in that, include: The system comprises a client cluster, a switch cluster, a high-availability cluster, and a server cluster. The client cluster includes multiple clients, the switch cluster includes a first switch, a second switch, and a third switch, the high-availability cluster includes multiple nodes, and the server cluster includes multiple servers. Each client in the client cluster communicates with the first switch. The first switch communicates with each node in the high-availability cluster; The nodes in the high-availability cluster communicate with each other, and each node in the high-availability cluster communicates with the second switch. The second switch communicates with each server in the server cluster; The third switch is connected to each node in the high-availability cluster.

10. An electronic device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1 to 7.