Multi-machine hot standby method, device, electronic equipment and storage medium
By scanning the work order list to query unprocessed timeout work orders and switching backup equipment, the problem of too many system switching judgment conditions in the prior art is solved, and the stability of the system and uninterrupted service of the business are achieved.
Patent Information
- Application Number
- CN202010663279.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-10
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2040-07-10
AI Technical Summary
In the distributed system, the reasons why system services cannot provide services normally are complex, including unknown factors such as attacks, hardware damage and software bugs, resulting in too many system switching judgment conditions, making it difficult to ensure system stability.
By scanning the work order list, querying unprocessed timeout work orders. If there is, query the executable backup machine and sending a switching command to switch it to the main device. At the same time, switch the original main device to the backup device to simplify the judgment conditions. Relying only on whether the work order processing timed out to ensure system stability.
It reduces the judgment conditions for system switching, improves the stability of the system, avoids system paralysis caused by other unknown reasons, and ensures uninterrupted service of the business.
Smart Images

Figure CN111813610B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer network technology, and in particular to a multi-machine hot standby method, device, electronic device and storage medium. Background Art
[0002] Currently, in distributed systems, hot backup is mostly implemented by deciding whether to switch to the backup system based on whether the system hardware is normal and the software is alive to ensure uninterrupted service. This method has certain problems, such as the process is still running, but due to other unknown reasons (such as being attacked, hardware damaged, and software bugs, etc.), the system business cannot provide normal services.
[0003] Therefore, the prior art has defects and is in urgent need of improvement. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a multi-machine hot standby method, device, electronic device and storage medium, which can improve the stability of the system.
[0005] In a first aspect, a multi-machine hot standby method in an embodiment of the present application comprises the following steps:
[0006] Scan the work order list to check whether there are any unprocessed timeout work orders;
[0007] If there is an unprocessed timeout work order, query whether there is at least one standby machine that can execute the business corresponding to the timeout work order;
[0008] If there is an executable standby device, sending a first switching instruction to a standby device in the at least one standby machine to switch the standby device to the main device;
[0009] A second switching instruction is sent to the original active device to switch it to the standby device.
[0010] Optionally, in the multi-machine hot standby method described in the embodiment of the present application, if there is at least one executable standby device, the step of sending a first switching instruction to a standby device in the at least one standby machine to switch it from a standby device to a primary device includes:
[0011] If there are standby executable standby devices, obtain the work order information to be executed of each of the standby devices;
[0012] A backup device is selected from the at least one backup device according to the to-be-executed work order information, and a first switching instruction is sent to the selected backup device, so that the selected backup device is switched to the main device.
[0013] Optionally, in the multi-machine hot standby method described in the embodiment of the present application, the to-be-executed work order information includes work order identification information of the to-be-executed work order and the work hours required for each of the work orders;
[0014] The step of selecting a standby device from the at least one standby device according to the work order information to be executed includes:
[0015] Calculate the time required for each standby device to complete all pending work orders based on the pending work order information;
[0016] A backup device that takes the least time to complete the work order to be executed is selected from the at least one backup device.
[0017] Optionally, in the multi-machine hot standby method described in the embodiment of the present application, the to-be-executed work order information includes a to-be-executed list of the to-be-executed work orders;
[0018] The step of selecting a standby device from the at least one standby device according to the work order information to be executed includes:
[0019] According to the to-be-executed list, a standby device with the least number of work orders in the to-be-executed list is selected from the at least one standby device.
[0020] Optionally, in the multi-machine hot standby method described in the embodiment of the present application, if there is a timed work order to be processed, the step of querying whether there is at least one standby machine that can execute the business corresponding to the timed work order includes:
[0021] If there is a timed-out work order that has not been processed, obtain the hardware requirement information of the timed-out work order;
[0022] According to the hardware requirement information, it is queried whether there is at least one standby machine that can execute the business corresponding to the timed work order.
[0023] Optionally, in the multi-machine hot standby method described in the embodiment of the present application, after the step of sending the second switching instruction to the original active device to switch it to the standby device, the method further includes:
[0024] The original main device is detected to obtain fault information of the original main device.
[0025] In a second aspect, the embodiment of the present application further provides a multi-machine hot standby device, including:
[0026] Scanning module, used to scan the work order list to check whether there are unprocessed timeout work orders;
[0027] A query module, for querying whether there is at least one standby machine that can execute the business corresponding to the timed work order if there is an unprocessed timed work order;
[0028] A first sending module, configured to send a first switching instruction to a backup device in the at least one backup machine if there is an executable backup device, so that the backup device switches to a primary device;
[0029] The second sending module is used to send a second switching instruction to the original active device to switch it to the standby device.
[0030] Optionally, in the multi-machine hot standby device described in the embodiment of the present application, the first sending mode is used to:
[0031] If there are standby executable standby devices, obtain the work order information to be executed of each of the standby devices;
[0032] A backup device is selected from the at least one backup device according to the to-be-executed work order information, and a first switching instruction is sent to the selected backup device, so that the selected backup device is switched to the main device.
[0033] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor and a memory, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the steps in the method provided in the first aspect are performed.
[0034] In a fourth aspect, an embodiment of the present application provides a storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the steps in the method provided in the first aspect are performed.
[0035] From the above, it can be seen that the multi-machine hot standby method provided in the embodiment of the present application scans the work order list to query whether there is an unprocessed timed work order; if there is an unprocessed timed work order, it queries whether there is at least one executable standby machine for the business corresponding to the timed work order; if there is an executable standby device, a first switching instruction is sent to a standby device in the at least one standby machine to switch it from a standby device to a main device; a second switching instruction is sent to the original main device to switch it to a standby device, thereby reducing the problem of too many judgment conditions for system switching. There is no need to judge various other conditions that may cause system paralysis, and the stability of the system can be guaranteed only by whether the work order processing has timed out.
[0036] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or be understood by practicing the embodiments of the present application. The purpose and other advantages of the present application can be realized and obtained by the structures specifically pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0038] Figure 1 A flow chart of a multi-machine hot standby method provided in an embodiment of the present application.
[0039] Figure 2 A schematic diagram of the structure of a multi-machine hot standby device provided in an embodiment of the present application.
[0040] Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0041] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0042] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0043] Please refer to Figure 1 , Figure 1 1 is a flowchart of a multi-machine hot standby method in some embodiments of the present application, and the multi-machine hot standby method includes the following steps:
[0044] S101, scanning the work order list to check whether there are unprocessed timed work orders;
[0045] S102: If there is an unprocessed timeout work order, query whether there is at least one standby machine that can execute the business corresponding to the timeout work order;
[0046] S103: If there is an executable standby device, send a first switching instruction to a standby device in the at least one standby machine to switch the standby device to a primary device;
[0047] S104: Send a second switching instruction to the original active device to switch it to the standby device.
[0048] Optionally, in the multi-machine hot standby method described in the embodiment of the present application, if there is at least one executable standby device, the step of sending a first switching instruction to a standby device in the at least one standby machine to switch it from a standby device to a main device includes: if there is a standby executable standby device, obtaining the to-be-executed work order information of each of the standby devices; screening out a standby device from the at least one standby device according to the to-be-executed work order information, and sending a first switching instruction to the screened standby device so that the screened standby device is switched to the main device.
[0049] Optionally, in the multi-machine hot standby method described in the embodiment of the present application, the work order information to be executed includes the work order identification information of the work order to be executed and the working hours required for each of the work orders; and the step of selecting a backup device from the at least one backup device based on the work order information to be executed includes: calculating the time required for each backup device to execute all work orders to be executed based on the work order information to be executed; and selecting the backup device with the least time required to execute the work order to be executed from the at least one backup device.
[0050] Optionally, in the multi-machine hot standby method described in an embodiment of the present application, the to-be-executed work order information includes a to-be-executed list of work orders to be executed; and the step of selecting a backup device from the at least one backup device based on the to-be-executed work order information includes: selecting the backup device with the least number of work orders in the to-be-executed list from the at least one backup device based on the to-be-executed list.
[0051] Optionally, in the multi-machine hot standby method described in the embodiment of the present application, if there is a processed timeout work order, the step of querying whether there is at least one executable standby machine for the business corresponding to the timeout work order includes: if there is a timed-out and unprocessed work order, obtaining the hardware requirement information of the timeout work order; and querying whether there is at least one executable standby machine for the business corresponding to the timeout work order based on the hardware requirement information.
[0052] Optionally, in the multi-machine hot standby method described in the embodiment of the present application, after the step of sending a second switching instruction to the original active device to switch it to a standby device, it also includes: detecting the original active device to obtain fault information of the original active device.
[0053] From the above, it can be seen that the multi-machine hot standby method provided in the embodiment of the present application scans the work order list to query whether there is an unprocessed timed work order; if there is an unprocessed timed work order, it queries whether there is at least one executable standby machine for the business corresponding to the timed work order; if there is an executable standby device, a first switching instruction is sent to a standby device in the at least one standby machine to switch it from a standby device to a main device; a second switching instruction is sent to the original main device to switch it to a standby device, thereby reducing the problem of too many judgment conditions for system switching. There is no need to judge various other conditions that may cause system paralysis, and the stability of the system can be guaranteed only by whether the work order processing has timed out.
[0054] Please refer to Figure 2 , Figure 2 2 is a schematic diagram of a multi-machine hot standby device in some embodiments of the present application. The multi-machine hot standby device includes: a scanning module 201, a query module 202, a first sending module 203 and a second sending module 204.
[0055] The scanning module 201 is used to scan the work order list to check whether there are any unprocessed timed work orders.
[0056] The query module 202 is used to query whether there is at least one standby machine that can execute the business corresponding to the timed work order if there is an unprocessed timed work order.
[0057] The first sending module 203 is used to send a first switching instruction to a backup device in the at least one backup machine if there is an executable backup device, so that the backup device switches to the main device.
[0058] The second sending module 204 is used to send a second switching instruction to the original active device to switch it to the standby device.
[0059] Optionally, in the multi-machine hot standby device described in the embodiment of the present application, the first sending module is used to: if there is a standby executable standby device, obtain the to-be-executed work order information of each of the standby devices; filter out a standby device from the at least one standby device according to the to-be-executed work order information, and send a first switching instruction to the filtered standby device so that the filtered standby device is switched to the main device.
[0060] From the above, it can be seen that the multi-machine hot standby device provided in the embodiment of the present application scans the work order list to query whether there is an unprocessed timed work order; if there is an unprocessed timed work order, it queries whether there is at least one executable standby machine for the business corresponding to the timed work order; if there is an executable standby device, a first switching instruction is sent to a standby device in the at least one standby machine to switch it from a standby device to a main device; a second switching instruction is sent to the original main device to switch it to a standby device, thereby reducing the problem of too many judgment conditions for system switching. There is no need to judge various other conditions that may cause system paralysis, and the stability of the system can be guaranteed only by whether the work order processing has timed out.
[0061] Please refer to Figure 3 , Figure 3 A structural diagram of an electronic device provided in an embodiment of the present application, the present application provides an electronic device 3, including: a processor 301 and a memory 302, the processor 301 and the memory 302 are interconnected and communicate with each other through a communication bus 303 and / or other forms of connection mechanisms (not marked), the memory 302 stores a computer program executable by the processor 301, when the computing device is running, the processor 301 executes the computer program to execute the method in any optional implementation of the above embodiment to achieve the following functions: scan the work order list to query whether there are unprocessed timed work orders; if there are unprocessed timed work orders, query whether there is at least one executable standby machine for the business corresponding to the timed work order; if there is an executable standby device, send a first switching instruction to a standby device in the at least one standby machine to switch it from a standby device to a primary device; send a second switching instruction to the original primary device to switch it to a standby device.
[0062] An embodiment of the present application provides a storage medium. When the computer program is executed by a processor, the method in any optional implementation of the above embodiment is executed to achieve the following functions: scanning a work order list to query whether there is an unprocessed timed work order; if there is an unprocessed timed work order, querying whether there is at least one executable standby machine for the business corresponding to the timed work order; if there is an executable standby device, sending a first switching instruction to a standby device in the at least one standby machine to switch it from a standby device to a primary device; sending a second switching instruction to the original primary device to switch it to a standby device.
[0063] Among them, the storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable red-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, disk or optical disk.
[0064] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0065] In addition, the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0066] Furthermore, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0067] In this document, relational terms such as first and second, etc. are used merely to distinguish one entity or operation from another entity or operation, but do not necessarily require or imply any such actual relationship or order between these entities or operations.
[0068] The above description is only an embodiment of the present application and is not intended to limit the protection scope of the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A multi-machine hot standby method, characterized in that: The following steps are involved: Scan the work order list to check whether there are unprocessed timeout work orders; If there is an unprocessed timeout work order, query whether there is at least one standby machine that can execute the business corresponding to the timeout work order; If there is an executable standby device, sending a first switching instruction to a standby device in the at least one standby machine to switch the standby device to the main device; Sending a second switching instruction to the original active device to switch it to the standby device; If there is at least one executable standby device, the step of sending a first switching instruction to a standby device in the at least one standby machine to switch the standby device to the main device includes: If there are standby executable standby devices, obtain the work order information to be executed of each of the standby devices; A backup device is selected from the at least one backup device according to the to-be-executed work order information, and a first switching instruction is sent to the selected backup device, so that the selected backup device is switched to the main device.
2. The multi-machine hot standby method according to claim 1, characterized in that: The work order information to be executed includes the work order identification information of the work order to be executed and the working hours required for each of the work orders; The step of selecting a standby device from the at least one standby device according to the work order information to be executed includes: Calculate the time required for each standby device to complete all pending work orders based on the pending work order information; A backup device that takes the least time to complete the work order to be executed is selected from the at least one backup device.
3. The multi-machine hot standby method according to claim 1, characterized in that: The to-be-executed work order information includes a to-be-executed list of the to-be-executed work orders; The step of selecting a standby device from the at least one standby device according to the work order information to be executed includes: According to the to-be-executed list, a standby device with the least number of work orders in the to-be-executed list is selected from the at least one standby device.
4. The multi-machine hot standby method according to claim 1, characterized in that: If there is an unprocessed timeout work order, the step of querying whether there is at least one standby machine that can execute the business corresponding to the timeout work order includes: If there is a timed-out work order that has not been processed, obtain the hardware requirement information of the timed-out work order; According to the hardware requirement information, it is queried whether there is at least one standby machine that can execute the business corresponding to the timed work order.
5. The multi-machine hot standby method according to claim 1, characterized in that: After the step of sending the second switching instruction to the original active device to switch it to the standby device, the method further includes: The original main device is detected to obtain fault information of the original main device.
6. A multi-machine hot standby device, characterized in that: include: Scanning module, used to scan the work order list to check whether there are unprocessed timeout work orders; A query module, for querying whether there is at least one standby machine that can execute the business corresponding to the timed work order if there is an unprocessed timed work order; A first sending module, configured to send a first switching instruction to a backup device in the at least one backup machine if there is an executable backup device, so that the backup device switches to a primary device; A second sending module is used to send a second switching instruction to the original active device to switch it to the standby device; The first sending mode is used for: If there are standby executable standby devices, obtain the work order information to be executed of each of the standby devices; A backup device is selected from the at least one backup device according to the to-be-executed work order information, and a first switching instruction is sent to the selected backup device, so that the selected backup device is switched to the main device.
7. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores computer-readable instructions. When the computer-readable instructions are executed by the processor, the steps in the method according to any one of claims 1 to 5 are executed.
8. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are executed.
