Dual-machine hot standby control method, device and dual-machine hot standby system
By establishing multiple communication channels between the first device and the second device in a dual-machine hot standby system, detecting communication connection interruptions and automatically switching the hot standby state, the dual-master phenomenon and the problem of third-party arbitration device dependence are solved, and the Provides higher system availability and reliability.
Patent Information
- Application Number
- CN202110814048.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-19
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2041-07-19
AI Technical Summary
The existing dual-machine hot standby system is prone to dual-master phenomenon when communication between the master machine and the backup machine is interrupted, and relies on third-party arbitration equipment, resulting in system failure and high costs.
By establishing multiple communication channels between the first device and the second device in a dual-machine hot standby system, it detects communication connection interruptions and automatically switches to the hot standby state to avoid the occurrence of dual-master phenomena without the need for third-party arbitration equipment.
It effectively avoids the dual-master phenomenon, reduces the failure risk and control cost of the dual-machine hot standby system, and improves the availability and reliability of the system.
Smart Images

Figure CN113625540B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer control technology, and in particular to a dual-machine hot standby control method, device and dual-machine hot standby system. Background Art
[0002] Hot standby technology is a technology that improves the availability of key equipment. A hot standby system usually contains two identical devices that run simultaneously, one of which is the host and the other is the standby. The host and the standby are connected in communication. The host and the standby receive the same input data, perform the same logical processing, and generate the same output information, but only the host actually outputs the output information, and the standby does not actually output it. When the host fails, the host is downgraded and stops outputting, and the original standby is upgraded to the host and starts outputting. Since the standby runs synchronously with the host, the master-standby switch can be completed in a very short time, usually within one control cycle of the hot standby system, so that the hot standby system appears to be seamlessly switched to the outside, thereby effectively improving the availability of the hot standby system.
[0003] However, when the communication between the master and the standby is interrupted in the dual-machine hot standby system, a dual-master phenomenon will occur, that is, the master and the standby both believe that the other has failed, and believe that they should upgrade to the master output control. The existing technology generally avoids the dual-master phenomenon through a third-party arbitration device, that is, when the standby is upgraded to the master, it needs to be recognized by the third-party arbitration device, and the third-party arbitration device ensures that there will be no dual masters. This method relies on a third-party arbitration device, and has high requirements for the reliability, availability and security of the third-party arbitration device. Moreover, when the third-party arbitration device fails, the dual-machine hot standby system will fail. Summary of the invention
[0004] The present invention provides a dual-machine hot standby control method, device and dual-machine hot standby system to solve the defects in the prior art.
[0005] The present invention provides a dual-machine hot standby control method, comprising:
[0006] Determining a hot standby state of a first device and a hot standby state of a second device in a dual-machine hot standby system, wherein the first device and the second device in the dual-machine hot standby system are communicatively connected via a plurality of communication channels;
[0007] If the hot standby state of the first device is the standby state and the hot standby state of the second device is the host state, and the first device detects that the communication connection on all communication channels between the first device and the second device is interrupted, the first device switches the hot standby state of the first device to the host state.
[0008] According to a dual-machine hot standby control method provided by the present invention, the first device switches the hot standby state of the local device to the master state, including:
[0009] Acquire a plurality of first health values corresponding to the first device and a plurality of second health values corresponding to the second device, wherein the first health values correspond to the second health values one by one;
[0010] For any first health value, if the first health value is greater than or equal to the corresponding second health value, the first device switches the hot standby state of the local device to the host state.
[0011] According to a dual-machine hot standby control method provided by the present invention, there is a target first health value among all first health values corresponding to the first device, and the difference between the target first health value and the corresponding target second health value is greater than a preset threshold.
[0012] According to a dual-machine hot standby control method provided by the present invention, a reverse switch is further connected between the first device and the second device;
[0013] The first device switches the hot standby state of the local device to the host state, and further includes:
[0014] Receiving an application request instruction for master-slave switching or a switch-off instruction corresponding to the switch-off switch;
[0015] Based on the reverse switch instruction or the application request instruction, the first device switches the hot standby state of the local device to the host state.
[0016] According to a dual-machine hot standby control method provided by the present invention, the first device and the second device in the dual-machine hot standby system are determined, and then the method further includes:
[0017] If the first device switches the hot standby state of the local device from the host state to the offline state and the duration of the offline state is greater than or equal to the first preset duration, and the hot standby state of the second device is not the host state or the host ready state, then the first device switches the hot standby state of the local device to the host ready state.
[0018] According to a dual-machine hot standby control method provided by the present invention, the first device switches the hot standby state of the local device to the host ready state, and then further includes:
[0019] If the duration of the hot standby state of the first device being the host ready state is greater than or equal to a second preset duration, and the hot standby state of the second device is not the host ready state, the first device switches the hot standby state of the device to the host state.
[0020] The present invention also provides a dual-machine hot standby control device, comprising:
[0021] A determination module, used to determine a hot standby state of a first device and a hot standby state of a second device in a dual-machine hot standby system, wherein the first device and the second device in the dual-machine hot standby system are communicatively connected via a plurality of communication channels;
[0022] A switching module is used for switching the hot standby state of the first device to the host state if the hot standby state of the first device is the standby state, the hot standby state of the second device is the host state, and the first device detects that the communication connection on all communication channels between the first device and the second device is interrupted.
[0023] The present invention also provides a dual-machine hot standby system, comprising: a first device and a second device, wherein the first device and the second device are connected via a plurality of communication channels;
[0024] The first device and the second device are both configured with the dual-machine hot standby control device described above.
[0025] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any of the above-mentioned dual-machine hot standby control methods when executing the computer program.
[0026] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of any of the above-mentioned dual-machine hot standby control methods are implemented.
[0027] The dual-machine hot standby control method, device and dual-machine hot standby system provided by the present invention first determine the hot standby state of the first device and the hot standby state of the second device in the dual-machine hot standby system, and the first device and the second device in the dual-machine hot standby system are connected in communication through multiple communication channels; then when the hot standby state of the first device is the standby state, the hot standby state of the second device is the host state, and the first device detects that the communication connection on all communication channels between the first device and the second device is interrupted, the hot standby state of the first device is switched to the host state. Since the communication connection is established between the first device and the second device through multiple communication channels, the standby machine considers the host failure only when the communication with the host is interrupted in all communication channels, and is upgraded to the host. This can effectively avoid the occurrence of the dual-master phenomenon in the dual-machine hot standby system without introducing a third-party arbitration device, save the dual-machine hot standby control cost, and reduce the failure risk of the dual-machine hot standby system. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0029] Figure 1 It is a flow chart of the dual-machine hot standby control method provided by the present invention;
[0030] Figure 2 It is a schematic diagram of hot standby state switching of the first device in the dual-machine hot standby system provided by the present invention;
[0031] Figure 3 It is a structural schematic diagram of a dual-machine hot standby control device provided by the present invention;
[0032] Figure 4 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0033] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0034] When the communication between the master and the standby is interrupted in the dual-machine hot standby system, a dual-master phenomenon will occur, that is, the master and the standby both believe that the other party has failed, and believe that they should be upgraded to the master output control. The prior art generally avoids the dual-master phenomenon through a third-party arbitration device, that is, when the standby machine is upgraded to the master, it needs to be recognized by the third-party arbitration device, and the third-party arbitration device ensures that there will be no dual masters. This method relies on a third-party arbitration device, and has high requirements on the reliability, availability and security of the third-party arbitration device. Moreover, when the third-party arbitration device fails, the dual-machine hot standby system will fail. To this end, a dual-machine hot standby control method is provided in an embodiment of the present invention.
[0035] Figure 1 FIG. 1 is a flow chart of a dual-machine hot standby control method provided in an embodiment of the present invention, such as Figure 1 As shown, the method includes:
[0036] S1, determining a hot standby state of a first device and a hot standby state of a second device in a dual-machine hot standby system, wherein the first device and the second device in the dual-machine hot standby system are communicatively connected via a plurality of communication channels;
[0037] S2: If the hot standby state of the first device is the standby state and the hot standby state of the second device is the host state, and the first device detects that the communication connection on all communication channels between the first device and the second device is interrupted, the first device switches the hot standby state of the first device to the host state.
[0038] Optionally, the dual-machine hot standby control method provided in the embodiment of the present invention is executed by the first device in the dual-machine hot standby system, and the first device can be any device in the dual-machine hot standby system. In addition to the first device, the dual-machine hot standby system also includes a second device. The first device can realize the master-slave switching without relying on a third-party arbitration device. In the embodiment of the present invention, the first device and the second device are connected to each other through multiple independent communication channels, and the first device and the second device can simultaneously perform continuous two-way communication on multiple communication channels. The number of communication channels can be set as needed, for example, it can be set to be greater than or equal to 3.
[0039] First, step S1 is performed. The first device determines the hot standby state of the first device (i.e., the local device) and the hot standby state of the second device (i.e., the opposite device). The hot standby state is used to characterize the state of the device, and may include a downtime state, an offline state, a host state, a standby state, and a host preparation state. Among them, the downtime state refers to the state in which the device has a first-class fault and needs to wait for manual intervention to be processed. The first-class fault may be an intolerable fault. The offline state refers to the state in which the device has a second-class fault or the dual-machine hot standby system is initially powered on and is waiting to enter other available states. The second-class fault may be a tolerable fault. The host state refers to the state in which the device is working normally and outputting control information to the outside. The standby state refers to the state in which the device is working normally and has been synchronized with the device in the host state and can replace the device in the host state to work at any time. In the embodiment of the present invention, the device in the standby state can be called a standby machine, and the device in the host state can be called a host. The host preparation state refers to the device recovering from the offline state and there is no device in the host state in the current dual-machine hot standby system. The device is preparing to be called a device in the host state.
[0040] In the embodiment of the present invention, the first device can directly determine the hot standby status of the local device, and because the first device and the second device are communicatively connected via multiple communication channels, the first device can obtain the hot standby status of the counterpart device via channel communication.
[0041] Then execute step S2, the first device determines whether the hot standby state of the local machine is the standby state, and determines whether the hot standby state of the opposite machine is the host state. If the hot standby state of the local machine is the standby state, it means that the local machine is the standby machine, and if the hot standby state of the opposite machine is the host state, it means that the opposite machine is the host. When the local machine is the standby machine and the opposite machine is the host, it is further determined whether it is detected that the communication connection on all communication channels between the local machine and the opposite machine is interrupted. Since the probability of simultaneous interruption of communication connections on multiple independent communication channels is almost zero, if the local machine detects that the communication connection is interrupted on all communication channels, it is considered that the opposite machine has failed and cannot output control information as the host. The opposite machine needs to stop working and the local machine needs to output control information as the host. At this time, the first device automatically switches the hot standby state of the local machine to the host state, that is, the local machine outputs control information as the host.
[0042] The dual-machine hot standby control method provided in the embodiment of the present invention first determines the hot standby state of the first device and the hot standby state of the second device in the dual-machine hot standby system, and the first device and the second device in the dual-machine hot standby system are connected in communication through multiple communication channels; then when the hot standby state of the first device is the standby state, the hot standby state of the second device is the host state, and the first device detects that the communication connection on all communication channels between the first device and the second device is interrupted, the hot standby state of the first device is switched to the host state. Since the communication connection is established between the first device and the second device through multiple communication channels, the standby machine considers the host failure only when the communication with the host is interrupted in all communication channels, and is upgraded to the host. This can effectively avoid the occurrence of the dual-master phenomenon in the dual-machine hot standby system without introducing a third-party arbitration device, save the dual-machine hot standby control cost, and reduce the failure risk of the dual-machine hot standby system.
[0043] Since a dual-machine hot standby system usually controls multiple controlled objects at the same time, it becomes very difficult to decide whether to perform a master-slave switch when different faults occur in the master and standby machines. Existing dual-machine hot standby systems generally decide whether to perform a master-slave switch based on the health of the master and standby machines, that is, the health of the master and standby machines is calculated separately, and the master-slave switch is performed when the partial health of the standby machine is significantly better than the corresponding health of the master. While this method improves the availability of some controlled objects, it may also make other originally available controlled objects unavailable, which is not conducive to the overall control of all controlled objects by the dual-machine hot standby system and reduces the availability of the dual-machine hot standby system.
[0044] Therefore, based on the above embodiment, in the dual-machine hot standby control method provided in the embodiment of the present invention, the first device switches the hot standby state of the local device to the master state, including:
[0045] Acquire a plurality of first health values corresponding to the first device and a plurality of second health values corresponding to the second device, wherein the first health values correspond to the second health values one by one;
[0046] For any first health value, if the first health value is greater than or equal to the corresponding second health value, the first device switches the hot standby state of the local device to the host state.
[0047] Optionally, in an embodiment of the present invention, when the first device switches the hot standby state of the local device to the host state, it can first determine multiple first health values corresponding to the first device and multiple second health values of the second device. Among them, the first device is the same as the second device, and both can include multiple substructures. For example, the substructure can be an independent information acquisition component in the dual-machine hot standby system, and the failure of the component can cause the failure of a specific function. The first device and the second device can both control multiple controlled objects, such as the control of a certain train by a signal system. Each substructure corresponds to a health value, and each controlled object also corresponds to a health value. In an embodiment of the present invention, the health value corresponding to the first device is recorded as the first health value, and the health value corresponding to the second device is recorded as the second health value. The number of the first health value and the second health value is equal and one-to-one corresponding. In an embodiment of the present invention, the number of the first health value can be equal to the sum of the number of the substructures included in the first device and the number of the controlled objects controlled by the first device, and the number of the second health value can be equal to the sum of the number of the substructures included in the second device and the number of the controlled objects controlled by the second device.
[0048] Then, for each first health value, determine whether the first health value is greater than or equal to the corresponding second health value. If all first health values are greater than or equal to the corresponding second health value, it means that the overall performance of the first device is better than the overall performance of the second device. At this time, the first device switches the hot standby state of the local device to the host state to ensure that the host in the dual-machine hot standby system is always the device with the best overall performance, improve the performance of the dual-machine hot standby system, and while improving the availability of some controlled objects, ensure that other available controlled objects are still available, so that the master-standby switching will not have an adverse effect on the dual-machine hot standby system, thereby realizing the overall control of all controlled objects by the dual-machine hot standby system.
[0049] Based on the above embodiments, in the dual-machine hot standby control method provided in the embodiments of the present invention, there is a target first health value among all the first health values corresponding to the first device, and the difference between the target first health value and the corresponding target second health value is greater than a preset threshold.
[0050] Optionally, in an embodiment of the present invention, on the basis of obtaining multiple first health values corresponding to the first device and multiple second health values corresponding to the second device, in order to switch the hot standby state of the first device to the host state, it is also necessary that there is a target first health value among all the first health values corresponding to the first device, and the difference between the target first health value and the corresponding target second health value is greater than a preset threshold. The preset threshold can be set as needed, for example, it can be set to a relatively large value to ensure that the target first health value is significantly greater than the target second health value, so that the frequency of active-standby switching can be limited, and the problem of unstable performance of the dual-machine hot standby system caused by frequent active-standby switching can be prevented.
[0051] On the basis of the above embodiment, in the dual-machine hot standby control method provided in the embodiment of the present invention, a reverse switch is further connected between the first device and the second device;
[0052] The first device switches the hot standby state of the local device to the host state, and further includes:
[0053] Receiving an application request instruction for master-slave switching or a switch-off instruction corresponding to the switch-off switch;
[0054] Based on the reverse switch instruction or the application request instruction, the first device switches the hot standby state of the local device to the host state.
[0055] Optionally, in an embodiment of the present invention, a reverse switch may be connected between the first device and the second device, and the reverse switch may be used to implement forced master-slave switching. For example, if the hot standby state of the second device is the master state, the reverse switch points to the second device. If the reverse switch is manually forced to point to the first device at this time, a reverse switch instruction corresponding to the reverse switch is automatically generated when the reverse switch is manually forced to point to the first device. According to the reverse switch instruction, the first device switches the hot standby state of the device to the master state, thereby implementing forced master-slave switching.
[0056] If the first device receives an application request instruction for active / standby switching, the hot standby state of the device can be switched to the host state through the application request instruction, thereby implementing forced active / standby switching. The application request instruction for active / standby switching can be manually input to the first device or transmitted to the first device through a remote application program, which is not specifically limited in the embodiments of the present invention.
[0057] In an embodiment of the present invention, the first device switches the hot standby state of the local device to the host state by receiving an application request instruction for master-standby switching or receiving a reverse switch instruction corresponding to the reverse switch connected between the first device and the second device, thereby realizing personalized master-standby forced switching, and conveniently adding a master-standby switching function based on the reverse switch and a master-standby switching function based on the application request to the dual-machine hot standby system.
[0058] On the basis of the above embodiment, the dual-machine hot standby control method provided in the embodiment of the present invention, wherein the first device and the second device in the dual-machine hot standby system are determined, and then the method further includes:
[0059] If the first device switches the hot standby state of the local device from the host state to the offline state and the duration of the offline state is greater than or equal to the first preset duration, and the hot standby state of the second device is not the host state or the host ready state, then the hot standby state of the first device is switched to the host ready state.
[0060] Optionally, in an embodiment of the present invention, after the first device determines the first device and the second device in the dual-machine hot standby system, if the first device detects that the hot standby state of the local device is switched from the host state to the offline state, and the duration of the offline state is greater than or equal to the first preset duration, and the hot standby state of the second device is not the host state or the host ready state, the first device switches the hot standby state of the local device to the host ready state. The first preset duration can be set as needed, for example, to 1s, 2s, etc.
[0061] In the embodiment of the present invention, the host preparation state is configured for the first device to avoid conflicts caused by the first device in an offline state directly switching the hot standby state of the device to the host state.
[0062] On the basis of the above embodiment, in the dual-machine hot standby control method provided in the embodiment of the present invention, the first device switches the hot standby state of the local device to the host ready state, and then further includes:
[0063] If the hot standby state of the first device is a host ready state for a duration greater than or equal to a second preset duration, and the hot standby state of the second device is not a host ready state, the first device switches the hot standby state of the device to the host state.
[0064] Optionally, in an embodiment of the present invention, when the first device detects that the hot standby state of the local device is the host ready state and the duration of the host ready state is greater than or equal to the second preset duration, and the hot standby state of the second device is not the host ready state, the first device switches the hot standby state of the local device to the host state. The second preset duration can be set as needed, for example, to 1s, 2s, etc.
[0065] In an embodiment of the present invention, when the hot standby state of the first device is the host ready state, when the duration of the state is greater than or equal to the second preset duration, and the hot standby state of the second device is not the host ready state, the first device switches the hot standby state of the local device to the host state, and provides the conditions for switching from the host ready state to the host state, thereby avoiding conflicts caused by the first device in an offline state directly converting to the host state.
[0066] Based on the above embodiments, Figure 2 FIG. 1 is a schematic diagram of hot standby state switching of a first device provided in an embodiment of the present invention. Figure 2 As shown, the hot standby state of the first device includes downtime state, offline state, host state, standby state and host preparation state. When the first device is in the host state: when condition 1 is met, the first device switches the hot standby state of the local device to downtime state; when conditions 2 and 11 are met, the first device switches the hot standby state of the local device to offline state; when conditions 2, 3 and 11 are met, the first device switches the hot standby state of the local device to host preparation state. When the first device is in the host preparation state: when condition 1 is met, the first device switches the hot standby state of the local device to downtime state; when conditions 2, 6 and 7 are met, the first device switches the hot standby state of the local device to offline state; when condition 10 is met, the first device switches the hot standby state of the local device to the host state. When the first device is in the standby state: when conditions 4 and 5 are met, the first device switches the hot standby state of the local device to the host state; when conditions 2 and 9 are met, the first device switches the hot standby state of the local device to offline state; when condition 1 is met, the first device switches the hot standby state of the local device to downtime state. When the first device is in the offline state: when condition 8 is met, the first device switches the hot standby state of the local device to the standby state. Among them are:
[0067] Condition 1: The machine has a first-class fault;
[0068] Condition 2: The machine has a second type of failure;
[0069] Condition 3: The hot standby state of the local machine is offline, the hot standby state of the other machine is not the master state or the master ready state, and the duration of the offline state of the local machine reaches a first preset duration;
[0070] Condition 4: Active downgrade of the machine;
[0071] Condition 5: All communications between this machine and the other machine are interrupted;
[0072] Condition 6: The hot standby status of the machine is the master status;
[0073] Condition 7: The machine is required to switch to the host ready state;
[0074] Condition 8: The local machine is synchronized with the host successfully;
[0075] Condition 9: The local machine loses synchronization with the host machine due to inconsistent input and output;
[0076] Condition 10: The hot standby state of the local machine is the host ready state, the hot standby state of the other machine is not the host ready state, and the duration of the host ready state of the local machine reaches a second preset duration;
[0077] Condition 11: Active / standby switching is required after health value comparison.
[0078] like Figure 3 As shown, based on the above embodiments, a dual-machine hot standby control device is provided in an embodiment of the present invention, including: a determination module 31 and a switching module 32.
[0079] A determination module 31 is used to determine a hot standby state of a first device and a hot standby state of a second device in a dual-machine hot standby system, wherein the first device and the second device in the dual-machine hot standby system are communicatively connected via a plurality of communication channels;
[0080] The switching module 32 is used for switching the hot standby state of the first device to the host state if the hot standby state of the first device is the standby state, the hot standby state of the second device is the host state, and the first device detects that the communication connection on all communication channels between the first device and the second device is interrupted.
[0081] On the basis of the above-mentioned embodiment, in the dual-machine hot standby control device provided in the embodiment of the present invention, the switching module is used for:
[0082] Acquire a plurality of first health values corresponding to the first device and a plurality of second health values corresponding to the second device, wherein the first health values correspond to the second health values one by one;
[0083] For any first health value, if the first health value is greater than or equal to the corresponding second health value, the first device switches the hot standby state of the local device to the host state.
[0084] Based on the above embodiments, in a dual-machine hot standby control device provided in an embodiment of the present invention, there is a target first health value among all first health values corresponding to the first device, and the difference between the target first health value and the corresponding target second health value is greater than a preset threshold.
[0085] On the basis of the above embodiment, in the dual-machine hot standby control device provided in the embodiment of the present invention, a reverse switch is further connected between the first device and the second device;
[0086] The switching module is further used for:
[0087] Receiving an application request instruction for master-slave switching or a switch-off instruction corresponding to the switch-off switch;
[0088] Based on the reverse switch instruction or the application request instruction, the first device switches the hot standby state of the local device to the host state.
[0089] On the basis of the above embodiment, in the dual-machine hot standby control device provided in the embodiment of the present invention, the switching module is further used for:
[0090] If the first device switches the hot standby state of the local device from the host state to the offline state and the duration of the offline state is greater than or equal to the first preset duration, and the hot standby state of the second device is not the host state or the host ready state, then the first device switches the hot standby state of the local device to the host ready state.
[0091] On the basis of the above embodiment, in the dual-machine hot standby control device provided in the embodiment of the present invention, the switching module is further used for:
[0092] If the duration of the hot standby state of the first device being the host ready state is greater than or equal to a second preset duration, and the hot standby state of the second device is not the host ready state, the first device switches the hot standby state of the device to the host state.
[0093] Specifically, the dual-machine hot standby control device provided in the embodiment of the present invention can be configured in the first device. The function of each module in the dual-machine hot standby control device corresponds one-to-one to the operating process of each step in the above-mentioned method embodiment, and the effect achieved is also consistent. Please refer to the above-mentioned embodiment for details, and this will not be repeated in the embodiment of the present invention.
[0094] Based on the above embodiments, a dual-machine hot standby system is provided in an embodiment of the present invention, including: a first device and a second device, wherein the first device and the second device are connected via multiple communication channels; the first device and the second device are both configured with the dual-machine hot standby control device as described above to realize dual-machine hot standby control.
[0095] Figure 4 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 4 As shown, the electronic device may include: a processor 410, a communication interface 420, a memory 430 and a communication bus 440, wherein the processor 410, the communication interface 420 and the memory 430 communicate with each other through the communication bus 440. The processor 410 may call the logic instructions in the memory 430 to execute the dual-machine hot standby control method provided in the above-mentioned embodiments, the method comprising: determining the hot standby state of the first device and the hot standby state of the second device in the dual-machine hot standby system, the first device and the second device in the dual-machine hot standby system are connected in communication through multiple communication channels; if the hot standby state of the first device is the standby state, the hot standby state of the second device is the host state, and the first device detects that the communication connection on all communication channels between the first device and the second device is interrupted, then the first device switches the hot standby state of the local device to the host state.
[0096] In addition, the logic instructions in the above-mentioned memory 430 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0097] On the other hand, the present invention also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the dual-machine hot standby control method provided by the above-mentioned embodiments, the method including: determining the hot standby state of a first device and the hot standby state of a second device in the dual-machine hot standby system, and the first device and the second device in the dual-machine hot standby system are communicatively connected through multiple communication channels; if the hot standby state of the first device is a standby state, and the hot standby state of the second device is a host state, and the first device detects that the communication connection on all communication channels between the first device and the second device is interrupted, then the first device switches the hot standby state of the local device to the host state.
[0098] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the dual-machine hot standby control method provided in the above-mentioned embodiments, the method comprising: determining the hot standby state of a first device and the hot standby state of a second device in the dual-machine hot standby system, wherein the first device and the second device in the dual-machine hot standby system are communicatively connected through multiple communication channels; if the hot standby state of the first device is a standby state, and the hot standby state of the second device is a host state, and the first device detects that the communication connection on all communication channels between the first device and the second device is interrupted, then the first device switches the hot standby state of the local device to the host state.
[0099] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0100] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0101] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A dual-machine hot standby control method, characterized in that: include: Determining a hot standby state of a first device and a hot standby state of a second device in a dual-machine hot standby system, wherein the first device and the second device in the dual-machine hot standby system are communicatively connected via a plurality of communication channels; If the hot standby state of the first device is the standby state, and the hot standby state of the second device is the master state, and the first device detects that the communication connection on all communication channels between the first device and the second device is interrupted, the first device switches the hot standby state of the first device to the master state; The step of determining the first device and the second device in the dual-machine hot standby system further includes: If the first device switches the hot standby state of the local device from the host state to the offline state and the duration of the offline state is greater than or equal to the first preset duration, and the hot standby state of the second device is not the host state or the host ready state, the first device switches the hot standby state of the local device to the host ready state; The first device switches the hot standby state of the local device to the host ready state, and then further includes: If the duration of the hot standby state of the first device being the host ready state is greater than or equal to a second preset duration, and the hot standby state of the second device is not the host ready state, the first device switches the hot standby state of the device to the host state.
2. The dual-machine hot standby control method according to claim 1, characterized in that: The first device switches the hot standby state of the local device to the host state, including: Acquire a plurality of first health values corresponding to the first device and a plurality of second health values corresponding to the second device, wherein the first health values correspond to the second health values one by one; For any first health value, if the first health value is greater than or equal to the corresponding second health value, the first device switches the hot standby state of the local device to the host state.
3. The dual-machine hot standby control method according to claim 2, characterized in that: There is a target first health value among all the first health values corresponding to the first device, and a difference between the target first health value and the corresponding target second health value is greater than a preset threshold.
4. The dual-machine hot standby control method according to claim 1, characterized in that: A reverse switch is also connected between the first device and the second device; The first device switches the hot standby state of the local device to the host state, and further includes: Receiving an application request instruction for master-slave switching or a switch-off instruction corresponding to the switch-off switch; Based on the reverse switch instruction or the application request instruction, the first device switches the hot standby state of the local device to the host state.
5. A dual-machine hot standby control device, characterized in that: include: A determination module, used to determine a hot standby state of a first device and a hot standby state of a second device in a dual-machine hot standby system, wherein the first device and the second device in the dual-machine hot standby system are communicatively connected via a plurality of communication channels; a switching module, configured to switch the hot standby state of the first device to the host state if the hot standby state of the first device is the standby state and the hot standby state of the second device is the host state, and the first device detects that the communication connection on all communication channels between the first device and the second device is interrupted; The switching module is further used for: If the first device switches the hot standby state of the local device from the host state to the offline state and the duration of the offline state is greater than or equal to the first preset duration, and the hot standby state of the second device is not the host state or the host ready state, the first device switches the hot standby state of the local device to the host ready state; The switching module is further used for: If the duration of the hot standby state of the first device being the host ready state is greater than or equal to a second preset duration, and the hot standby state of the second device is not the host ready state, the first device switches the hot standby state of the device to the host state.
6. A dual-machine hot standby system, characterized in that: include: A first device and a second device, wherein the first device and the second device are connected via a plurality of communication channels; The first device and the second device are both configured with the dual-machine hot standby control device as described in claim 5.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of the dual-machine hot standby control method as described in any one of claims 1 to 4 are implemented.
8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the dual-machine hot standby control method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Main / standby control system and main / standby switching method of urban railway transit
CN105487413A
ATS system double-machine arbitration system and method based on third-party determination
CN106254097A
Master-slave switching method and device
CN106656617A
Duplicate hot standby method of embedded system
CN107634855A
Master-standby switching method in a dual-machine hot standby system
CN109117323A
