Method, device, storage medium and electronic device for taking over a service
By identifying alternative nodes in the cluster system and using them to replace the main control module to execute the operations of the target main control module, the problem of being unable to take over the business of abnormal nodes was solved, achieving efficient business takeover and performance improvement.
Patent Information
- Application Number
- CN202210096690.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-26
- Publication Date
- 2026-02-24
- Estimated Expiration
- 2042-01-26
AI Technical Summary
In a cluster system, existing technologies cannot effectively take over the services of a faulty node when it fails.
When the target node fails, a first replacement node is determined from the cluster according to preset rules. The replacement node's replacement master control module then executes the operations of the target master control module, thereby taking over the business.
The efficient takeover of services from abnormal nodes improved the overall performance and service response speed of the cluster, and reduced latency.
Smart Images

Figure CN114490195B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of communications, and more specifically, to a service takeover method, apparatus, storage medium, and electronic device. Background Technology
[0002] In a cluster system, when a node fails, another healthy node is needed to take over the services of the malfunctioning node. However, current technologies lack an effective switchover mechanism to handle the occurrence of a faulty host node.
[0003] This indicates that there is a problem with the relevant technology that it cannot take over the business operations executed by abnormal nodes.
[0004] There is currently no effective solution to the aforementioned problems in the relevant technologies. Summary of the Invention
[0005] This invention provides a method, apparatus, storage medium, and electronic device for taking over services, to at least solve the problem in the related art of being unable to take over services executed by abnormal nodes.
[0006] According to an embodiment of the present invention, a service takeover method is provided, comprising: in the event that the target master control module of a target node fails, determining a first alternative node for taking over the target node from the cluster where the target node is located according to a preset rule, wherein the cluster includes multiple nodes and the multiple nodes are connected according to a preset connection relationship; and using the alternative master control module of the first alternative node to perform the operations performed by the target master control module.
[0007] According to another embodiment of the present invention, a service takeover device is provided, comprising: a determining module, configured to determine, in the event of a failure of the target master control module of a target node, a first alternative node for taking over the target node from the cluster where the target node is located, according to a preset rule, wherein the cluster includes multiple nodes and the storage units of the multiple nodes form a structure of a predetermined shape; and a takeover module, configured to execute the operations performed by the target master control module using the alternative master control module of the first alternative node.
[0008] According to yet another embodiment of the present invention, a computer-readable storage medium is also provided, wherein a computer program is stored therein, wherein the computer program, when executed by a processor, implements the steps of the method described in any of the preceding claims.
[0009] According to yet another embodiment of the present invention, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.
[0010] This invention addresses the issue of a first replacement node being unable to take over operations from a target node's main control module when that module fails. The first replacement node, according to preset rules, determines a replacement node from the target node's cluster to take over. The replacement node's replacement main control module then executes the operations performed by the target main control module. Because a first replacement node can be determined according to preset rules when the target main control system fails, and its replacement main control system replaces the target main control system, this invention solves the problem in related technologies where it cannot take over the services executed by abnormal nodes, achieving efficient takeover of abnormal nodes. Attached Figure Description
[0011] Figure 1 This is a hardware structure block diagram of a mobile terminal for a service takeover method according to an embodiment of the present invention.
[0012] Figure 2 This is a flowchart of a service takeover method according to an embodiment of the present invention;
[0013] Figure 3 This is a schematic diagram of the cluster where the target node is located according to an embodiment of the present invention;
[0014] Figure 4 This is a flowchart of a business takeover method according to a specific embodiment of the present invention;
[0015] Figure 5 This is a schematic diagram of service takeover according to a specific embodiment of the present invention. Figure 1 ;
[0016] Figure 6 This is a schematic diagram of service takeover according to a specific embodiment of the present invention. Figure 2 ;
[0017] Figure 7 This is a structural block diagram of a service takeover device according to an embodiment of the present invention. Detailed Implementation
[0018] The embodiments of the present invention will be described in detail below with reference to the accompanying drawings and examples.
[0019] It should be noted that the terms "first," "second," etc., in the specification, claims, and drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.
[0020] The methods and embodiments provided in this application can be executed on a mobile terminal, computer terminal, or similar computing device. Taking running on a mobile terminal as an example, Figure 1 This is a hardware structure block diagram of a mobile terminal for a service takeover method according to an embodiment of the present invention. Figure 1 As shown, a mobile terminal may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. The mobile terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the mobile terminal described above. For example, the mobile terminal may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0021] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the service takeover method in this embodiment of the invention. The processor 102 executes various functional applications and data processing by running the computer programs stored in the memory 104, thereby implementing the above-described method. The memory 104 may include high-speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the mobile terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0022] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the mobile terminal's communication provider. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module used for wireless communication with the Internet.
[0023] This embodiment provides a method for taking over services. Figure 2 This is a flowchart of a service takeover method according to an embodiment of the present invention, such as... Figure 2 As shown, the process includes the following steps:
[0024] Step S202: In the event of a failure of the target master control module of the target node, a first replacement node for taking over the target node is determined from the cluster where the target node is located according to a preset rule. The cluster includes multiple nodes, and the multiple nodes are connected according to a preset connection relationship.
[0025] Step S204: The operation performed by the target master control module is executed by the substitute master control module using the substitute master control module of the first substitute node.
[0026] In the above embodiments, the cluster where the target node resides can be a storage cluster, meaning the nodes in the cluster can be storage devices used to store data generated by other devices and to support other devices in pulling data from the storage devices. The cluster where the target node resides can include multiple nodes, and each pair of nodes can be directly connected via a network or connected to a switch via a network to enable communication between each pair of nodes. In other words, the nodes in the cluster can detect whether other nodes are experiencing failures.
[0027] In the above embodiments, the multiple nodes included in the cluster can be connected according to a preset connection relationship. This preset connection relationship can refer to the storage units of each node being connected according to a preset connection relationship. The storage units of each node can be connected via SAS (Search Engine Array). For example, the preset connection relationship can be a linear connection or a ring connection. When the preset connection relationship is a ring connection, a schematic diagram of the cluster where the target node is located can be found in the appendix. Figure 3 ,like Figure 3 As shown, the cluster consists of 5 host nodes: A, B, C, D, and E. Each host node includes a master control module (corresponding to the aforementioned master control system) and a disk management module. The disk management modules form a ring structure via SAS connections. Distance + 1 represents the additional latency required for the master control module to access the disk management module of the adjacent node. For example, if nodes A and B are adjacent, the time required for master control A to access the adjacent node's disk management module B is greater than the time required to access its local disk management module A. Similarly, the time required for master control A to access disk management module C is greater than the time required to access disk management module B. The time difference is considered as distance + 1. In this cluster scheme, when one or more master control modules malfunction, disk module resources and master control services need to be handed over to normal host nodes. This can be achieved based on the principle of proximity to the taking-over host, thereby improving the overall cluster performance after takeover and achieving optimal performance. That is, the preset rule can be a proximity-based takeover rule. The maximum cluster distance is the maximum distance the master control module can travel to access disk resource modules. For example, in... Figure 3For node A, its furthest accessible disk management resource is either C or D, with a maximum distance of +2. A scan of all nodes in the cluster is performed, and the nearest node is determined by distance greater than the maximum distance. The conditions for a first replacement node to take over the target node are: the taking-over host must be running normally and not currently taking over other services, or, assuming all current services are running normally, it must still have the resource capacity to take over other services.
[0028] In the above embodiments, the first replacement node can determine the number of target nodes it can take over based on its own CPU capabilities. For example, the first replacement node can only take over the services of one other host in addition to its own services. Of course, depending on the capabilities of the first replacement node host, it can also take over the services of multiple target nodes in addition to handling its own services.
[0029] Optionally, the entity performing the above steps can be any node in the cluster other than the target node, but is not limited to this.
[0030] This invention addresses the issue of a first replacement node being unable to take over operations from a target node's main control module when that module fails. The first replacement node, according to preset rules, determines a replacement node from the target node's cluster to take over. The replacement node's replacement main control module then executes the operations performed by the target main control module. Because a first replacement node can be determined according to preset rules when the target main control system fails, and its replacement main control system replaces the target main control system, this invention solves the problem in related technologies where it cannot take over the services executed by abnormal nodes, achieving efficient takeover of abnormal nodes.
[0031] In an exemplary embodiment, determining a first alternative node to take over the target node from the cluster where the target node is located, according to a preset principle, includes: determining first candidate nodes included in the cluster, wherein the first candidate node is a node located at a first position relative to the target node; and determining the first alternative node from the first candidate nodes. In this embodiment, when determining the first alternative node, the first candidate node located at a first position relative to the target node can be determined first, and the first alternative node can be determined from the first candidate nodes. The first position can be any one of the left, right, top, or bottom positions. For example, when the first position is the left, when the target node fails, the node located to the left of the target node can be determined first as the first candidate node.
[0032] In an exemplary embodiment, determining the first replacement node from the first candidate nodes includes: determining a first resource state of the first candidate node; if the first resource state satisfies a first predetermined condition, determining a first number of nodes taken over by the first candidate node; and if the first number is less than or equal to a predetermined threshold, determining the first candidate node as the first replacement node. In this embodiment, when the first resource state of the first candidate node satisfies the first predetermined condition, it can also be determined whether the first number of nodes taken over by the first candidate node satisfies the condition. For example, if the first number is less than the predetermined threshold, it is determined that the first number satisfies the condition, and the first candidate node is determined as the first replacement node. The predetermined threshold can be a pre-determined maximum number of nodes that a candidate node can take over. For example, the predetermined threshold can be 2, 3, etc., which is only an illustrative example; it can also be 4, 5, etc., and this invention does not limit this.
[0033] In an exemplary embodiment, after determining the first resource state of a first candidate node located at a first location of the target node in the cluster, the method further includes: if the first resource state does not meet the first predetermined condition, determining a second candidate node located at a second location of the target node in the cluster, and determining the second resource state of the second candidate node, wherein the first location and the second location are different; if the second resource state meets the first predetermined condition, determining the second candidate node as the first replacement node. In this embodiment, when the first resource state of the first candidate node does not meet the first predetermined condition, the second resource state of the second candidate node located at a second location of the target node in the cluster can be determined, and when the second resource state meets the first predetermined condition, the second candidate node is determined as a replacement node. The second location can be any one of the left, right, top, or bottom. For example, when the first location is the left and the second location is the right, when the target node fails, it can be first determined whether the first candidate node located to the left of the target node can take over the target node; if so, the first candidate node is determined as a replacement node. If not, determine whether the second candidate node located to the right of the target node can take over the target node. If it can, then determine the second candidate node as the target node.
[0034] In an exemplary embodiment, before determining the first candidate node as the first replacement node, the method further includes: determining the remaining resource amount included in the first resource state; determining the resource occupancy required to take over the target node; determining that the first resource state satisfies the first predetermined condition if the resource occupancy is less than or equal to the remaining resource amount; and determining that the first resource state does not satisfy the first predetermined condition if the resource occupancy is greater than the remaining resource amount. In this embodiment, when determining whether the first resource state satisfies the first predetermined condition, the remaining resource amount included in the first resource state can be determined, and then the resource occupancy required to take over the target node can be determined. If the resource occupancy is less than or equal to the remaining resource amount, then the first resource state is determined to satisfy the first predetermined condition. The method for determining whether the second resource state satisfies the first predetermined condition is the same as the method for determining whether the first resource state satisfies the first predetermined condition, and will not be described again here.
[0035] In an exemplary embodiment, determining a first alternative node to take over the target node from the cluster where the target node is located according to a preset principle includes: repeatedly executing the following steps until the first alternative node is determined: determining a second candidate node whose distance to the target node is a first distance; determining a second resource state of the second candidate node; if a resource state satisfying a first predetermined condition exists in the second resource state, determining the candidate node corresponding to the resource state satisfying the first predetermined condition as the first alternative node; if no resource state satisfying the first predetermined condition exists in the second resource state, increasing the first distance by a predetermined distance to obtain a second distance; and determining the second distance as the first distance. In this embodiment, when determining the first alternative node, a second candidate node whose distance to the target node is a first distance can be determined, and it can be determined whether an alternative node exists among the second candidate nodes. If no alternative node exists, the first distance is increased by a predetermined distance to obtain a second distance, and the second distance is determined as the first distance, i.e., the first distance is updated, and it is determined whether an alternative node exists among the nodes whose distance to the target node is the updated first distance.
[0036] In the above embodiment, the first distance can be 1, and the predetermined distance can be 1. That is, when a node at a distance of 1 from the target node cannot take over the target node, the first distance can be increased by 1 to determine whether a replacement node is included among the nodes at a distance of 2 from the target node. If no replacement node is found, the distance is increased by 1 again to determine a replacement node.
[0037] In the above embodiments, the nodes at a distance of the first distance from the target node may include multiple nodes. When determining a replacement node, it can first be determined whether the node in the first position can be a replacement node. If it can, the node located in the first position of the target node and at a distance of the first distance from the target node is determined as the replacement node. When the node located in the first position of the target node cannot take over, it can be determined whether the node located in the second position of the target node and at a distance of the second distance from the target node can take over. If it can, it is determined as the replacement node. If it cannot, it is determined whether the node located in the first position of the target node and at a distance of the second distance from the target node can take over. If it can, it is determined as the replacement node. If it cannot, it is determined whether the node located in the second position of the target node and at a distance of the second distance from the target node can take over. If it can, it is determined as the replacement node. If it cannot, the distance is increased, and the above steps are repeated until a replacement node is determined.
[0038] In an exemplary embodiment, the first distance is less than or equal to the maximum access distance of the target node, where the maximum access distance is the maximum distance the target master control module can travel to access the storage modules of other nodes included in the cluster. In this embodiment, the maximum cluster access distance is the maximum distance the master control module can travel to access the hard disk resource modules, for example, in... Figure 3 In this example, for node A, its furthest accessible disk management resource is either C or D, with a maximum distance of +2. A scan of all nodes in the cluster is performed to determine which is closer than the maximum distance.
[0039] In an exemplary embodiment, before determining the first candidate node as the first replacement node, the method further includes: determining a second number of nodes taken over by the first candidate node; and determining the first candidate node as the first replacement node if the second number is less than or equal to the predetermined threshold. In this embodiment, when the first resource state of the first candidate node satisfies a first predetermined condition, it can also be determined whether the second number of nodes taken over by the first candidate node satisfies the condition. For example, if the second number is less than or equal to the predetermined threshold, it is determined that the second number satisfies the condition, and the first candidate node is determined as the first replacement node. The predetermined threshold can be a pre-determined maximum number of nodes that a candidate node can take over. For example, the predetermined threshold can be 2, 3, etc., which is only an illustrative example; it can also be 4, 5, etc., and this invention does not limit this.
[0040] In an exemplary embodiment, after the substitute master control module of the first substitute node executes the operations performed by the target master control module, the method further includes: detecting the status information of the target node; and, if the status information indicates that the target node is in a normal state, controlling the first substitute node to stop taking over the target node. In this embodiment, after the substitute master control module of the first substitute node executes the operations performed by the target master control module, the status information of the target node can be detected. When the status information indicates that the target node is in a normal state, the first substitute node can be controlled to stop taking over the target node.
[0041] In an exemplary embodiment, after the substitute master control module of the first substitute node executes the operations performed by the target master control module, the method further includes: in the event of a failure of the substitute master control module, determining a second substitute node to take over the target node, and determining a third substitute node to take over the first substitute node; controlling the second substitute node to take over the target node, and controlling the third substitute node to take over the first substitute node. In this embodiment, if the substitute master control module fails after the substitute master control module of the first substitute node executes the operations performed by the target master control module, a second substitute node to take over the target node and a third substitute node to take over the first substitute node can be determined. The methods for determining the second and third substitute nodes are the same as the method for determining the first substitute node, and will not be described again.
[0042] In the above embodiments, if in Figure 3 In the event that the main control hardware of node B malfunctions, that is, both main control A and main control B running on motherboard B fail, then according to the policy, main control A is taken over by node E, which is 1 node to the left, and main control B is taken over by node C, which is 1 node to the right of main control B.
[0043] The following describes the business takeover method in conjunction with specific implementation methods:
[0044] Figure 4 This is a flowchart of a service takeover method according to a specific embodiment of the present invention, such as... Figure 4 As shown, the method includes:
[0045] 1. The cluster system detects a failure in a node host by using a heartbeat monitoring method.
[0046] 2. Prioritize taking over the normal host that is +1 (closest) away from the faulty host.
[0047] 3. If the distance +1 is sufficient, select the host to the right of the faulty host. If the host to the right is normal and is not currently taking over the services of other hosts besides its own, then select the host to the right to take over the services and hard disk resource modules of the faulty host.
[0048] 4. If the +1 host to the right of the faulty host is faulty or has taken over other services, then consider the +1 host to the left. If the +1 host to the left is normal and has not taken over other service hosts, then select the +1 host to the left to take over the services and hard disk resource modules of the faulty host.
[0049] 5. If, after steps 3 and 4, neither the left nor right nodes of the faulty host can take over, then consider the left and right nodes of the faulty host at a distance of +2. Again, prioritize the right node and then select the left node until a node that meets the requirements is found (the node with the latest distance, the host is normal, and it has not taken over other services).
[0050] 6. If no suitable host node is found after scanning the entire cluster system, and the host's CPU, memory, and other resource capabilities are assessed to be such that it can only support a maximum of two host services, then no abnormal node takeover action will be performed. If the assessment indicates that it can support more than two host services, then a second round of scanning will be conducted. Then, the appropriate takeover host will be selected following the steps above.
[0051] For example, appendix Figure 3 If node A fails, then the right node B, located at a distance of +1, will take over the services and hard disk resource module A of host A. Figure 5 As shown. If the main control hardware of node B malfunctions, meaning both main control A and main control B running on motherboard B fail, then according to the strategy, main control A will be taken over by node E (leftmost node +1), and main control B will be taken over by node C (rightmost node b). Figure 6 As shown.
[0052] In the above embodiment, the takeover host is selected based on the principle of proximity to the faulty host's hard disk management module. The current host's CPU, memory, and other resources and capabilities are assessed. If the host is capable of taking over other host services while ensuring all current services operate normally, a suitable takeover host is selected in multiple rounds based on the proximity principle within the cluster. If no suitable host is ultimately found, the faulty host's services are not taken over, prioritizing the normal operation of existing services in the cluster. In other words, when a faulty host occurs, a suitable takeover host is selected based on the proximity principle of the faulty host's hard disk management module. The takeover host is continuously polled based on proximity to check if it meets the takeover requirements, and multiple rounds of coverage are performed based on the takeover node's capabilities. Using this remote takeover host allows for the fastest possible access to the faulty host's hard disk management module, enabling low-latency continuation of cluster services. This method significantly improves overall cluster performance compared to other methods, resulting in high service responsiveness and low latency.
[0053] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0054] This embodiment also provides a service takeover device for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0055] Figure 7 This is a structural block diagram of a service takeover device according to an embodiment of the present invention, such as... Figure 7 As shown, the device includes:
[0056] The determination module 72 is used to determine, in the event of a failure of the target master control module of the target node, a first replacement node to take over the target node from the cluster where the target node is located according to a preset rule, wherein the cluster includes multiple nodes and the multiple nodes are connected according to a preset connection relationship;
[0057] The takeover module 74 is used to execute the operations performed by the target master control module using the substitute master control module of the first substitute node.
[0058] In an exemplary embodiment, the determining module 72 may determine the first alternative node for taking over the target node from the cluster where the target node is located according to a preset rule in the following manner: determining a first candidate node included in the cluster, wherein the first candidate node is a node located in a first position of the target node; and determining the first alternative node from the first candidate node.
[0059] In an exemplary embodiment, the determining module 72 may determine the first alternative node from the first candidate nodes by: determining a first resource state of the first candidate node; determining a first number of nodes taken over by the first candidate node when the first resource state satisfies a first predetermined condition; and determining the first candidate node as the first alternative node when the first number is less than or equal to a predetermined threshold.
[0060] In an exemplary embodiment, the apparatus may be configured to, after determining a first resource state of a first candidate node, determine a second resource state of a second candidate node located at a second location of the target node in the cluster if the first resource state does not satisfy the first predetermined condition, and determine the second candidate node, wherein the first location is different from the second location; and if the second resource state satisfies the first predetermined condition, determine the second candidate node as the first alternative node.
[0061] In an exemplary embodiment, the apparatus may be configured to, before determining the first candidate node as the first replacement node, determine the remaining resource amount included in the first resource state; determine the resource occupancy required to take over the target node; if the resource occupancy is less than or equal to the remaining resource amount, determine that the first resource state satisfies the first predetermined condition; and if the resource occupancy is greater than the remaining resource amount, determine that the first resource state does not satisfy the first predetermined condition.
[0062] In an exemplary embodiment, the determining module 72 can determine a first alternative node for taking over the target node from the cluster where the target node is located according to a preset principle in the following manner: repeatedly executing the following steps until the first alternative node is determined: determining a second candidate node whose distance to the target node is a first distance; determining a second resource state of the second candidate node; if there is a resource state in the second resource state that satisfies a first predetermined condition, determining the candidate node corresponding to the resource state that satisfies the first predetermined condition as the first alternative node; if there is no resource state in the second resource state that satisfies the first predetermined condition, increasing the first distance by a predetermined distance to obtain a second distance; and determining the second distance as the first distance.
[0063] In one exemplary embodiment, the first distance is less than or equal to the maximum access distance of the target node, where the maximum access distance is the maximum distance that the target master control module can travel to the storage modules of other nodes included in the cluster.
[0064] In an exemplary embodiment, the apparatus may be configured to detect the status information of the target node after the target control module performs the operation by the alternative control module of the first alternative node; and, if the status information indicates that the target node is in a normal state, control the first alternative node to stop taking over the target node.
[0065] In an exemplary embodiment, the apparatus may be configured to, after executing the operations performed by the target master module using the alternative master module of the first alternative node, determine a second alternative node for taking over the target node and a third alternative node for taking over the first alternative node in the event of a failure of the alternative master module; control the second alternative node to take over the target node and control the third alternative node to take over the first alternative node.
[0066] It should be noted that the above modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to: all the above modules are located in the same processor; or, the above modules are located in different processors in any combination.
[0067] Embodiments of the present invention also provide a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of the method described in any of the preceding claims.
[0068] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.
[0069] Embodiments of the present invention also provide an electronic device including a memory and a processor, the memory storing a computer program and the processor being configured to run the computer program to perform the steps in any of the above method embodiments.
[0070] In one exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.
[0071] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.
[0072] It is obvious to those skilled in the art that the modules or steps of the present invention described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those described herein, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.
[0073] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, or improvements made within the principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for taking over a business, characterized in that, include: In the event of a failure of the target master control module of the target node, a first replacement node for taking over the target node is determined from the cluster where the target node is located according to a preset rule. The cluster includes multiple nodes, which are connected according to a preset connection relationship. The operation performed by the target main control module is executed by the substitute main control module using the substitute main control module of the first substitute node; Determining a first alternative node to take over the target node from the cluster where the target node is located according to preset rules includes: determining a first candidate node included in the cluster, wherein the first candidate node is a node located in a first position of the target node; and determining the first alternative node from the first candidate node.
2. The method according to claim 1, characterized in that, The first alternative node is determined from the first candidate node as follows: Determine the first resource status of the first candidate node; If the first resource state meets the first predetermined condition, determine the first number of nodes taken over by the first candidate node; If the first number is less than or equal to a predetermined threshold, the first candidate node is determined as the first replacement node.
3. The method according to claim 2, characterized in that, After determining the first resource state of the first candidate node, the method further includes: If the first resource state does not meet the first predetermined condition, a second candidate node located at a second position of the target node in the cluster is determined, and a second resource state of the second candidate node is determined, wherein the first position and the second position are different; If the second resource status meets the first predetermined condition, the second candidate node will be determined as the first alternative node.
4. The method according to claim 2, characterized in that, Before determining the first candidate node as the first replacement node, the method further includes: Determine the remaining amount of resources included in the first resource status; Determine the resource requirements for taking over the target node; If the resource usage is less than or equal to the remaining resource, it is determined that the first resource status satisfies the first predetermined condition. If the resource usage is greater than the remaining resource, it is determined that the first resource status does not meet the first predetermined condition.
5. The method according to claim 1, characterized in that, The first replacement node to take over the target node is determined from the cluster where the target node is located according to preset principles, including: Repeat the following steps until the first replacement node is determined: Determine a second candidate node whose distance to the target node is a first distance; Determine the second resource status of the second candidate node; If there is a resource state in the second resource state that satisfies the first predetermined condition, the candidate node corresponding to the resource state that satisfies the first predetermined condition is determined as the first alternative node. If no resource state that meets the first predetermined condition exists in the second resource state, the first distance is increased by a predetermined distance to obtain the second distance; The second distance is determined as the first distance.
6. The method according to claim 5, characterized in that, The first distance is less than or equal to the maximum access distance of the target node, where the maximum access distance is the maximum distance that the target master control module can travel to access the storage modules of other nodes included in the cluster.
7. The method according to claim 1, characterized in that, After the replacement master control module of the first replacement node executes the operations performed by the target master control module, the method further includes: Detect the status information of the target node; If the status information indicates that the target node is in a normal state, control the first replacement node to stop taking over the target node.
8. The method according to claim 1, characterized in that, After the replacement master control module of the first replacement node executes the operations performed by the target master control module, the method further includes: In the event of a failure of the alternative master control module, a second alternative node is determined to take over the target node, and a third alternative node is determined to take over the first alternative node. Control the second alternative node to take over the target node, and control the third alternative node to take over the first alternative node.
9. A business takeover device, characterized in that, include: The determination module is used to determine, in the event of a failure of the target master control module of the target node, a first replacement node to take over the target node from the cluster where the target node is located according to a preset rule, wherein the cluster includes multiple nodes and the multiple nodes are connected according to a preset connection relationship; The takeover module is used to execute the operations performed by the target master control module using the substitute master control module of the first substitute node; The determining module determines the first alternative node to take over the target node from the cluster where the target node is located according to preset rules in the following manner: determining the first candidate node included in the cluster, wherein the first candidate node is the node located in the first direction of the target node; determining the first alternative node from the first candidate node.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the method described in any one of claims 1 to 8.
11. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to run the computer program to perform the method as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Node switching method and device, computer equipment and storage medium
CN111294845A