A master-slave control method, device, equipment and readable storage medium
By setting low priority nodes as primary nodes and high priority nodes as backup nodes in the virtual switch cluster, and using VRRP protocol to coordinate traffic takeover in the event of failure, the problem of low master and backup switching efficiency in HA is solved, and the continuity of business services is achieved.
Patent Information
- Application Number
- CN202211354037.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-31
- Publication Date
- 2025-08-08
- Estimated Expiration
- 2042-10-31
AI Technical Summary
In HA, the master-stop switching is inefficient, and it is impossible to quickly restore services or maintain continuity of business services.
By determining the priority of each node in the virtual switch cluster in the VRRP protocol, setting the low-priority node as the primary node, and setting the high-priority node as the backup node, the VRRP protocol is used to coordinate traffic takeover of multicast messages in the event of a failure.
Improve the efficiency of master-secure switching in HA and ensure the continuity of business services.
Smart Images

Figure CN115914088B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer application technology, and in particular to a master-slave control method, apparatus, device, and readable storage medium. Background Art
[0002] The emergence of virtualization technology has driven the rise of cloud computing commercialization. Virtual machine technology isolates physical resources, providing more secure and personalized services. In cloud computing scenarios, the management plane typically communicates with the virtual switch cluster through service ports to manage the virtual switch cluster.
[0003] Due to the limited number of physical interfaces on the service switch, the number of connected virtual switch cluster nodes is limited; only some hosts on the management plane can access the service port; all service traffic needs to be centrally managed, and the virtual switch cluster must be connected to the service port through a single network port. Due to physical resource constraints such as these, the management plane requires a unified physical port to take over the traffic of the virtual switch cluster when taking over the service port.
[0004] Binding virtual machine switches to service ports resolves physical resource issues. To maintain stability and avoid single points of failure, virtual machine switches must be configured with a primary and backup configuration to ensure HA traffic flow and complete disaster recovery in abnormal situations. HA (High Available) is typically used in a dual-machine cluster environment to provide a solution that ensures business continuity. This typically involves no fewer than two nodes, divided into a primary and backup node. However, during HA primary-backup switching, when a failure occurs, it's often impossible to quickly switch between the primary and backup nodes, making it impossible to quickly restore business or maintain continuous external services.
[0005] In summary, how to effectively solve the problems such as the efficiency of the master / slave switching in HA is a technical problem that those skilled in the art urgently need to solve. Summary of the Invention
[0006] The purpose of this application is to provide a master-slave control method, device, equipment and readable storage medium, which can improve the master-slave switching efficiency in HA, thereby ensuring the continuity of business services.
[0007] To solve the above technical problems, this application provides the following technical solutions:
[0008] A master-slave control method, comprising:
[0009] Using configuration information, determine the priority of each node in the virtual switch cluster in the VRRP protocol;
[0010] Selecting a first node with a low priority from the nodes, and setting the first node as a master node of the HA so that the first node takes over the traffic of the virtual switch cluster;
[0011] Selecting a second node with a high priority from the nodes, and setting the second node as a standby node of the HA;
[0012] When the virtual switch cluster fails, a node with a high priority in the VRRP protocol multicasts a message externally, so that each node coordinates traffic takeover objects of the virtual switch cluster based on the VRRP protocol.
[0013] Preferably, the method of multicasting a message externally based on a node with a high priority in the VRRP protocol so that each node coordinates traffic takeover objects of the virtual switch cluster based on the VRRP protocol includes:
[0014] After the master-slave switch is performed, the node with a high priority sends its own master status and a multicast message of the corresponding priority through the VRRP protocol, so that when each node receives the multicast message, it determines whether a master-slave switch has occurred externally based on the source IP and the corresponding priority of the message, and completes the master-slave switch reporting through the early warning mechanism.
[0015] Preferably, using a node with a high priority to send its own master status and a multicast message of a corresponding priority through the VRRP protocol includes:
[0016] In the event of a failure of the first node, raising the priority of the first node so that the first node can multicast a failure message externally;
[0017] When the second node receives the fault message, the second node is upgraded to a master node so that the second node takes over the traffic of the virtual switch cluster in place of the first node.
[0018] Preferably, using a node with a high priority to send its own master status and a multicast message of a corresponding priority through the VRRP protocol includes:
[0019] In the event of a communication connection failure between the first node and the second node, the second node is automatically upgraded to a master node, and a state change message is multicast externally so that the first node and the second node jointly take over the traffic of the virtual switch cluster.
[0020] Preferably, it also includes:
[0021] A BFD protocol is used to perform fault detection on the communication connection between the first node and the second node.
[0022] Preferably, it also includes:
[0023] A ping command is used to detect a fault in the communication connection between the first node and the second node.
[0024] Preferably, it also includes:
[0025] Using network virtualization technology, a processing tag is encapsulated on a message transmitted between the first node and the second node, so that the first node and the second node process the message based on the processing tag.
[0026] A master / standby control device, comprising:
[0027] A priority determination module is used to determine the priority of each node in the virtual switch cluster in the VRRP protocol using configuration information;
[0028] a master node setting module, configured to select a first node with a low priority from the nodes, and set the first node as a master node of the HA, so that the first node takes over the traffic of the virtual switch cluster;
[0029] A slave node setting module, configured to select a second node with a high priority from the nodes, and set the second node as a standby node of the HA;
[0030] The master-slave adjustment module is used to, when a failure occurs in the virtual switch cluster, broadcast a message to the outside based on the node with a high priority in the VRRP protocol, so that each node coordinates the flow takeover object of the virtual switch cluster based on the VRRP protocol.
[0031] An electronic device, comprising:
[0032] memory for storing computer programs;
[0033] A processor is used to implement the steps of the above-mentioned active-standby control method when executing the computer program.
[0034] A readable storage medium stores a computer program, which implements the steps of the above-mentioned active-standby control method when executed by a processor.
[0035] By applying the method provided in the embodiment of the present application, the priority of each node in the virtual switch cluster in the VRRP protocol is determined using configuration information; a first node with a low priority is selected from the nodes, and the first node is set as the master node of HA so that the first node takes over the traffic of the virtual switch cluster; a second node with a high priority is selected from the nodes, and the second node is set as the backup node of HA; in the event of a failure in the virtual switch cluster, a multicast message is sent to the outside based on the node with a high priority in the VRRP protocol, so that each node coordinates the traffic takeover object of the virtual switch cluster based on the VRRP protocol.
[0036] Considering that only nodes with high priority in the VRRP protocol can multicast messages externally, in general HA solutions, the master node is often set to a high priority, and only the master node multicasts messages externally. This results in the inability to effectively notify the master-slave state switch during the master-slave state switch process, resulting in low master-slave switching efficiency. Based on this, in the present application, the priority of each node in the virtual switch cluster is first determined using configuration information, and then the first node with low priority is set as the master node, and the first node takes over the traffic of the virtual switch cluster. The second node with high priority is set as the backup node. That is, the backup node has the function of broadcasting multicast messages for master-slave switching externally. In this way, in the event of a failure in the virtual switch cluster, the node with high priority in the VRRP protocol, that is, the non-host node, multicasts messages externally, so that each node coordinates the traffic takeover object of the virtual switch cluster based on the VRRP protocol. This can improve the efficiency of master-slave switching in HA, thereby ensuring the continuity of business services.
[0037] Correspondingly, the embodiments of the present application also provide a master-slave control device, equipment and readable storage medium corresponding to the above-mentioned master-slave control method, which have the above-mentioned technical effects and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following briefly introduces the drawings required for use in the embodiments or related technical descriptions. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0039] Figure 1 This is a flowchart of an implementation method of a master-slave control method in an embodiment of the present application;
[0040] Figure 2 This is a schematic diagram of a virtual switch cluster in an embodiment of the present application;
[0041] Figure 3 This is a timing diagram of a master-slave control method in an embodiment of the present application;
[0042] Figure 4 This is a structural diagram of a master-slave control device in an embodiment of the present application;
[0043] Figure 5 This is a schematic structural diagram of an electronic device according to an embodiment of the present application;
[0044] Figure 6 This is a schematic diagram of the specific structure of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION
[0045] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below in conjunction with the accompanying drawings and specific embodiments. Obviously, the embodiments described are only a part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without making any creative efforts are within the scope of protection of the present application.
[0046] Please refer to Figure 1 and Figure 3 , Figure 1 This is a flow chart of a master-slave control method in an embodiment of the present application. Figure 3 This is a timing diagram of a master-slave control method in an embodiment of the present application, which includes the following steps:
[0047] S101: Determine the priority of each node in the virtual switch cluster in the VRRP protocol using configuration information.
[0048] The configuration information may specifically include information specifying the priority of each node in the virtual switch cluster. The configuration information may be obtained directly from a configuration file or may be set by a user.
[0049] The virtual switch cluster can be any virtual switch cluster that needs to use the virtual machine switch to bind the service port to solve the physical resource problem and adopt the HA solution. For example, the virtual switch cluster can be as follows Figure 2 As shown, the external physical server needs to aggregate and monitor traffic for the three computing nodes (A, B, and C). To ensure high network availability, nodes A and B need to be used as the primary and backup nodes to implement the HA solution. That is, under normal circumstances, traffic is forwarded to the external physical server through the primary node (A), the backup node (B) does not forward traffic, and the virtual machine traffic of the backup node and other nodes (C) is forwarded to the primary node through the tunnel port. When an abnormal situation occurs, such as a failure of the primary node network port or a disconnection of the tunnel port between the primary and backup nodes, it is necessary to complete the primary-backup role switch between the primary and backup nodes to allow the backup node to take on the task of forwarding traffic, ensuring that the virtual machine traffic reaches the external physical server normally.
[0050] The configuration information is used to determine the priority of each node in the virtual switch cluster in the VRRP protocol. In this application, only two priorities can be set, namely high priority and low priority, or more than two priorities can be set.
[0051] For example, the management plane can receive user configuration to configure the master and backup nodes of HA. The controlled node obtains its own VRRP priority option by parsing the user configuration, so as to multicast VRRP data packets to complete the master and backup negotiation.
[0052] Among them, VRRP (Virtual Router Redundancy Protocol) adds a group of routers that can serve as gateways to a backup group to form a virtual router. The VRRP election mechanism determines which router takes on the forwarding task. Hosts in the LAN only need to configure the virtual router as the default gateway.
[0053] S102 : Select a first node with a low priority from the nodes, and set the first node as a master node of the HA, so that the first node takes over the traffic of the virtual switch cluster.
[0054] It should be noted that inspired by the idea of setting the high priority node as the master node in the VRRP protocol, and taking into account the disadvantage that only the master node can send VRRP in normal scenarios, in order to improve the efficiency of active-standby switching, in this embodiment, the node with low priority is set as the master node of HA (such as Figure 3 The master device shown in the figure), the node with higher priority is set as the standby node (such as Figure 3 slave device as shown).
[0055] Specifically, the first node with a low priority is selected from the nodes, and then the first node is set as the master node of HA. In this way, the first node with a low priority can take over the traffic of the virtual switch cluster.
[0056] S103 : Select a second node with a high priority from the nodes, and set the second node as a standby node of HA.
[0057] To enable the standby node to multicast messages externally, in this embodiment, a high-priority second node is selected from the nodes and set as the standby node of the HA. In other words, even though the second node is a standby node, it has the ability to multicast messages externally because its priority is high.
[0058] It should be noted that, in the present application, the first and the second in the first node and the second node are only used to distinguish the existence of two nodes and have no other limiting meaning.
[0059] S104 : When a virtual switch cluster fails, a node with a high priority in the VRRP protocol multicasts a message externally, so that each node coordinates traffic takeover objects of the virtual switch cluster based on the VRRP protocol.
[0060] Among them, the node with a high priority in the VRRP protocol multicasts the message externally.
[0061] In this embodiment, a virtual switch cluster failure refers to a failure that requires adjustment of the master and slave nodes in HA, such as a failure in which the master node cannot continue to provide external traffic takeover services, or a communication failure between the master node and the slave node.
[0062] When a virtual switch cluster fails, the VRRP protocol can be used to coordinate the traffic takeover of the virtual switch cluster, such as switching from active-standby mode to dual-active mode, or switching between active and standby nodes.
[0063] Specifically, in the event of a failure in the virtual switch cluster, after the master-slave switch is performed, the node with the highest priority uses the VRRP protocol to send a multicast message with its own master status and the corresponding priority. When each node receives the multicast message, it can determine whether a master-slave switch has occurred externally based on the source IP address and the corresponding priority of the message, and complete the master-slave switch reporting through the early warning mechanism. In other words, during the master-slave switch process between the master and standby nodes, if the node itself is the master, it can send a multicast message with its own master status and the corresponding priority through the VRRP protocol. When ordinary nodes receive the VRRP message, they can determine whether a master-slave switch has occurred externally based on the source IP address and the corresponding priority of the message, and complete the reporting processing through the early warning mechanism.
[0064] Generally, virtual switch cluster failures require adjustments to the primary and backup nodes for HA. These failures primarily occur when the primary node fails, or when communication between the primary and backup nodes fails. The following details how to coordinate traffic takeover in a virtual switch cluster using the VRRP protocol, targeting these two types of failures.
[0065] Case 1: The failure of the first node requires adjustment of the primary and backup nodes. The specific implementation process includes:
[0066] Step 1: When the first node fails, increase the priority of the first node so that the first node can multicast a failure message externally;
[0067] Step 2: When the second node receives a fault message, the second node is upgraded to a master node so that the second node takes over the traffic of the virtual switch cluster in place of the first node.
[0068] For ease of description, the above two steps are combined for explanation below.
[0069] In this embodiment, the failure of the first node means that it is unable to continue to take over the traffic of the virtual switch cluster. For example, the first node may have a failure in the service network port, which makes it unable to continue to take over the traffic of the virtual switch cluster. That is, when the first node encounters a situation such as a failure in the service network port, the priority of the first node can be increased. Through the master-slave scheduling algorithm of VRRP, it can be perceived that the current priority of the first node is greater than the received VRRP priority, and the first node can be set as a backup node, and the report is completed through the early warning mechanism. When the peer end (the original backup node, i.e., the second node) receives the VRRP message, it analyzes and finds that its own priority is lower, adjusts itself to the master node, and sends a multicast message to the outside to notify.
[0070] Scenario 2: A communication failure between the first and second nodes requires a primary / standby node adjustment. The specific implementation process includes: If the communication failure occurs between the first and second nodes, the second node is automatically promoted to the primary node and a state change message is multicasted externally, allowing the first and second nodes to jointly take over traffic for the virtual switch cluster.
[0071] In other words, if an abnormality occurs in the connection between the primary and backup nodes (such as a problem with the tunnel entrance or an issue with the external network between the primary and backup nodes), the secondary node can be adjusted to the primary position based on business needs, thus entering dual-active mode. This is reported through an early warning mechanism to assist operations and maintenance personnel in troubleshooting. In dual-active mode, the primary node continues to process its corresponding virtual machine traffic, while the secondary node handles its corresponding virtual machine traffic and traffic from other ordinary computing nodes. In other words, the primary and secondary nodes share the task of taking over traffic for the virtual switch cluster.
[0072] The VRRP protocol can be used to detect link failures between the first node and the second node, and detect abnormal connections between the primary and backup nodes.
[0073] Preferably, in order to improve the efficiency of fault detection of the communication connection between the first node and the second node, the BFD protocol can also be used to perform fault detection on the communication connection between the first node and the second node. Among them, the BFD (Bidirectional Forwarding Detection) protocol is a standardized media-independent and protocol-independent link fault detection mechanism. This mechanism can achieve: fault detection of any type of bidirectional forwarding path between network devices, including direct physical links, virtual circuits, tunnels, multi-hop routing paths, MPLS LSPs, and single links; provide consistent fault detection time for different upper-layer applications; provide a network detection time of 1 second, speed up network convergence, reduce application interruption time, and improve network reliability. In other words, the BFD protocol can detect faults faster than the VRRP protocol in detecting the communication connection between the first node and the second node.
[0074] Preferably, to improve the efficiency of detecting communication connection failures between the first node and the second node, the ping command can also be used to detect communication connection failures between the first node and the second node. Ping is a computer network diagnostic tool used to test the reachability of hosts on an Internet Protocol network. It is applicable to nearly all operating systems with network capabilities, including most embedded network management software. Using the ping command can more accurately detect communication connection failures between the first node and the second node.
[0075] Of course, in practical applications, other protocols or detection methods besides the VRRP protocol may also be used to quickly and effectively detect a communication connection failure between the first node and the second node.
[0076] By applying the method provided in the embodiment of the present application, the priority of each node in the virtual switch cluster in the VRRP protocol is determined using configuration information; a first node with a low priority is selected from the nodes, and the first node is set as the master node of HA so that the first node takes over the traffic of the virtual switch cluster; a second node with a high priority is selected from the nodes, and the second node is set as the backup node of HA; in the event of a failure in the virtual switch cluster, a multicast message is sent to the outside based on the node with a high priority in the VRRP protocol, so that each node coordinates the traffic takeover object of the virtual switch cluster based on the VRRP protocol.
[0077] Considering that only nodes with high priority in the VRRP protocol can multicast messages externally, in general HA solutions, the master node is often set to a high priority, and only the master node multicasts messages externally. This results in the inability to effectively notify the master-slave state switch during the master-slave state switch process, resulting in low master-slave switching efficiency. Based on this, in the present application, the priority of each node in the virtual switch cluster is first determined using configuration information, and then the first node with low priority is set as the master node, and the first node takes over the traffic of the virtual switch cluster. The second node with high priority is set as the backup node. That is, the backup node has the function of broadcasting multicast messages for master-slave switching externally. In this way, in the event of a failure in the virtual switch cluster, the node with high priority in the VRRP protocol, that is, the non-host node, multicasts messages externally, so that each node coordinates the traffic takeover object of the virtual switch cluster based on the VRRP protocol. This can improve the efficiency of master-slave switching in HA, thereby ensuring the continuity of business services.
[0078] It should be noted that, based on the above embodiments, the embodiments of the present application also provide corresponding improved solutions. In the preferred / improved embodiments, the same steps or corresponding steps as those in the above embodiments can be referenced to each other, and the corresponding beneficial effects can also be referenced to each other, and will not be described in detail in the preferred / improved embodiments of this document.
[0079] In a specific implementation of the present application, in order to prevent a broadcast storm from forming between the primary and backup nodes, network virtualization technology can also be used to encapsulate a processing tag on the message transmitted between the first node and the second node so that the first node and the second node process the message based on the processing tag.
[0080] That is, in this embodiment, the traffic flowing through the primary and backup nodes (i.e., the first node and the second node) can be subjected to loop destruction processing to prevent loops. The devices between the primary and backup nodes complete the encapsulation of the message through the vxlan technology, and can use the reserved field in the vxlan message header to complete the message identification: when the message passes through the primary node and then flows through the vxlan port, the vxlan message header is marked. If the vxlan port of the backup node finds that the vxlan header carries a relevant mark when parsing the vxlan message, it is considered that the message has been processed at the primary node and no longer processed. Through loop destruction processing, the formation of broadcast storms between the primary and backup nodes can be prevented, and normal business can be guaranteed.
[0081] VXLAN (Virtual Extensible LAN) is a network virtualization technology designed to improve scalability in large-scale cloud computing deployments. It can be considered an extension of VLANs. However, due to the 12-bit maximum length of the VLAN header, the number of VLANs is limited to 2^12 = 4096, which cannot meet the growing demand. VXLAN packet headers contain 24 bits, which can support a maximum of 2^24 VNIs (VNIs are used for identification in VXLAN, equivalent to VLAN IDs).
[0082] Corresponding to the above method embodiment, the embodiment of the present application further provides a master-slave control device. The master-slave control device described below and the master-slave control method described above can refer to each other.
[0083] See also Figure 4 As shown, the device includes the following modules:
[0084] The priority determination module 101 is used to determine the priority of each node in the virtual switch cluster in the VRRP protocol using the configuration information;
[0085] A master node setting module 102 is configured to select a first node with a low priority from the nodes and set the first node as the master node of the HA so that the first node takes over the traffic of the virtual switch cluster;
[0086] A slave node setting module 103 is configured to select a second node with a high priority from the nodes and set the second node as a backup node of the HA;
[0087] The master-slave adjustment module 104 is used to, when a virtual switch cluster fails, broadcast a message to the external node based on a high priority in the VRRP protocol, so that each node coordinates the flow takeover object of the virtual switch cluster based on the VRRP protocol.
[0088] By applying the device provided in the embodiment of the present application, the priority of each node in the virtual switch cluster in the VRRP protocol is determined using configuration information; a first node with a low priority is selected from the nodes, and the first node is set as the master node of HA so that the first node takes over the traffic of the virtual switch cluster; a second node with a high priority is selected from the nodes, and the second node is set as the backup node of HA; in the event of a failure in the virtual switch cluster, a multicast message is sent to the outside based on the node with a high priority in the VRRP protocol, so that each node coordinates the traffic takeover object of the virtual switch cluster based on the VRRP protocol.
[0089] Considering that only nodes with high priority in the VRRP protocol can multicast messages externally, in general HA solutions, the master node is often set to a high priority, and only the master node multicasts messages externally. This results in the inability to effectively notify the master-slave state switch during the master-slave state switch process, resulting in low master-slave switching efficiency. Based on this, in the present application, the priority of each node in the virtual switch cluster is first determined using configuration information, and then the first node with low priority is set as the master node, and the first node takes over the traffic of the virtual switch cluster. The second node with high priority is set as the backup node. That is, the backup node has the function of broadcasting multicast messages for master-slave switching externally. In this way, in the event of a failure in the virtual switch cluster, the node with high priority in the VRRP protocol, that is, the non-host node, multicasts messages externally, so that each node coordinates the traffic takeover object of the virtual switch cluster based on the VRRP protocol. This can improve the efficiency of master-slave switching in HA, thereby ensuring the continuity of business services.
[0090] In a specific embodiment of the present application, the master-slave adjustment module 104 is specifically used to use the node with high priority to send its own master status and multicast message of corresponding priority through the VRRP protocol after the master-slave switching is performed, so that when each node receives the multicast message, it can judge whether the master-slave switching occurs externally based on the source IP and corresponding priority of the message, and complete the master-slave switching reporting through the early warning mechanism.
[0091] In a specific embodiment of the present application, the master-slave adjustment module 104 is specifically configured to increase the priority of the first node when the first node fails, so that the first node can multicast a fault message externally;
[0092] When the second node receives the fault message, the second node is upgraded to a master node so that the second node takes over the traffic of the virtual switch cluster in place of the first node.
[0093] In a specific embodiment of the present application, the master-slave adjustment module 104 is specifically used to automatically upgrade the second node to the master node when the communication connection between the first node and the second node fails, and to multicast a status change message to the outside so that the first node and the second node can jointly take over the traffic of the virtual switch cluster.
[0094] In a specific embodiment of the present application, it also includes:
[0095] The BFD fault detection module is configured to perform fault detection on the communication connection between the first node and the second node using the BFD protocol.
[0096] In a specific embodiment of the present application, it also includes:
[0097] The Ping fault detection module is used to perform fault detection on the communication connection between the first node and the second node using the ping command.
[0098] In a specific embodiment of the present application, it also includes:
[0099] The broadcast storm blocking module is used to encapsulate a processing mark on the message transmitted between the first node and the second node by using the network virtualization technology, so that the first node and the second node process the message based on the processing mark.
[0100] Corresponding to the above method embodiment, an embodiment of the present application further provides an electronic device. The electronic device described below and the master-slave control method described above can refer to each other.
[0101] See also Figure 5 As shown, the electronic device includes:
[0102] Memory 332, for storing computer programs;
[0103] The processor 322 is configured to implement the steps of the active / standby control method of the above method embodiment when executing a computer program.
[0104] For details, please refer to Figure 6 , Figure 6 This is a schematic diagram of the specific structure of an electronic device provided in this embodiment. The electronic device may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 322 (for example, one or more processors) and a memory 332, and the memory 332 stores one or more computer applications 342 or data 344. Among them, the memory 332 can be a temporary storage or a permanent storage. The program stored in the memory 332 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the data processing device. Furthermore, the central processing unit 322 can be configured to communicate with the memory 332 to execute a series of instruction operations in the memory 332 on the electronic device 301.
[0105] The electronic device 301 may further include one or more power supplies 326 , one or more wired or wireless network interfaces 350 , one or more input / output interfaces 358 , and / or one or more operating systems 341 .
[0106] The steps in the master-slave control method described above can be implemented by the structure of an electronic device.
[0107] Corresponding to the above method embodiment, an embodiment of the present application further provides a readable storage medium. The readable storage medium described below and the active-standby control method described above can refer to each other.
[0108] A readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the active-standby control method of the above method embodiment.
[0109] The readable storage medium may specifically be any readable storage medium that can store program code, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0110] Those skilled in the art may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the composition and steps of each example according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
Claims
1. A master-slave control method, characterized in that: include: Using configuration information, determine the priority of each node in the virtual switch cluster in the VRRP protocol; Selecting a first node with a low priority from the nodes, and setting the first node as a master node of the HA so that the first node takes over the traffic of the virtual switch cluster; Selecting a second node with a high priority from the nodes, and setting the second node as a standby node of the HA; When a fault occurs in the virtual switch cluster that requires adjustment of the master and backup nodes in the HA, after the master-slave switching is performed, the node with a high priority is used to send its own master status and multicast message of the corresponding priority through the VRRP protocol, so that when each node receives the multicast message, it determines whether the master-slave switching occurs externally based on the source IP and corresponding priority of the message, and completes the master-slave switching reporting through the early warning mechanism.
2. The active / standby control method according to claim 1, wherein: Utilizing a node with a high priority to send a multicast message of its own master status and corresponding priority through the VRRP protocol includes: In the event of a failure of the first node, raising the priority of the first node so that the first node can multicast a failure message externally; When the second node receives the fault message, the second node is upgraded to a master node so that the second node takes over the traffic of the virtual switch cluster in place of the first node.
3. The active / standby control method according to claim 1, wherein: Utilizing a node with a high priority to send a multicast message of its own master status and corresponding priority through the VRRP protocol includes: In the event of a communication connection failure between the first node and the second node, the second node is automatically upgraded to a master node, and a state change message is multicast externally so that the first node and the second node jointly take over the traffic of the virtual switch cluster.
4. The active / standby control method according to claim 3, wherein: Also includes: A BFD protocol is used to perform fault detection on the communication connection between the first node and the second node.
5. The active / standby control method according to claim 3, wherein: Also includes: A ping command is used to detect a fault in the communication connection between the first node and the second node.
6. The active / standby control method according to any one of claims 1 to 5, characterized in that: Also includes: Using network virtualization technology, a processing tag is encapsulated on a message transmitted between the first node and the second node, so that the first node and the second node process the message based on the processing tag.
7. A master / slave control device, characterized in that: include: A priority determination module is used to determine the priority of each node in the virtual switch cluster in the VRRP protocol using configuration information; a master node setting module, configured to select a first node with a low priority from the nodes, and set the first node as a master node of the HA, so that the first node takes over the traffic of the virtual switch cluster; A slave node setting module, configured to select a second node with a high priority from the nodes, and set the second node as a standby node of the HA; The master-slave adjustment module is used to, when a fault occurs in the virtual switch cluster that requires adjustment of the master and standby nodes in the HA, perform master-slave switching, and use the node with high priority to send its own master status and multicast message of corresponding priority through the VRRP protocol, so that when each node receives the multicast message, it can judge whether a master-slave switching occurs externally based on the source IP and corresponding priority of the message, and complete the master-slave switching reporting through the early warning mechanism.
8. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the active-standby control method according to any one of claims 1 to 6 when executing the computer program.
9. A readable storage medium, characterized in that: The readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the active-standby control method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Multicast switching method and device and machine readable memory medium
CN107547367A
VRRP router and control method thereof
KR1020170122637A