Main-standby switching method and device for application layer equipment, equipment and storage medium

By performing status check and restart processing on the target key engine of the application layer device, and switching to stand-alone mode or standby mode in a timely manner, the problem of harsh active and standby switching conditions in the existing technology is solved, and business stability is guaranteed.

CN119356953APending Publication Date: 2025-01-24HANGZHOU DBAPPSECURITY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411489749.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-24
Publication Date
2025-01-24

AI Technical Summary

Technical Problem

In the prior art, when determining whether the application layer security device needs to switch between main and backup, the conditions are harsh and cannot effectively handle the situation where the host heartbeat packet can be sent normally but the host cannot provide service services normally, resulting in service failure.

Method used

Check the status of the local target key engine through the application layer device currently in host mode. If the status is abnormal, restart the target key engine and check again. If it still cannot work normally after restarting, switch to stand-alone mode and stop sending host heartbeat packets, allowing the standby machine to actively switch to host mode after it cannot receive host heartbeat packets.

Benefits of technology

The main switching of business services is achieved when the host cannot provide business services normally to ensure the stability of business and avoid business failures caused by harsh conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119356953A_ABST
    Figure CN119356953A_ABST
Patent Text Reader

Abstract

The invention discloses a main and standby switching method and device of application layer equipment, equipment and a storage medium, and relates to the technical field of computers, and the method comprises the following steps: performing state check on a local target key engine through first application layer equipment currently in a host mode to obtain a first key engine state check result; if the first key engine state check result meets the preset abnormal condition, restarting the target key engine, and performing state check on the target key engine again to obtain a second key engine state check result; if the second key engine state check result meets the preset abnormal condition, the first application layer device is controlled to be switched to the stand-alone mode and stop sending the host heartbeat packet, so that after the second application layer device cannot receive the host heartbeat packet, the working mode of the second application layer device is actively switched to the host mode to provide business service. According to the invention, when the host cannot normally provide business service, the host and the standby of the application layer equipment are switched.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method, device, equipment and storage medium for active / standby switching of application layer equipment. Background Art

[0002] At present, since many business services and transactions can be conducted through the Internet, most servers use high-availability solutions, clusters, active-standby modes, etc. to ensure stable business operations. Criminals use the Internet and vulnerabilities of companies or personal servers to carry out malicious attacks and obtain valid information for fraud and profiteering. Therefore, major network security and information security manufacturers have produced various protective security devices based on various attack methods, and use security devices to protect or reinforce the above application systems with large business volumes. In order to ensure that the security devices themselves can also achieve high availability, deployment methods such as clusters and active-standby have emerged.

[0003] However, currently, the active-standby switching of layer 3 to 4 security devices is mainly implemented based on keepalive (a mechanism that can detect dead connections in the transmission control protocol) and VRRP (Virtual Router Redundancy Protocol). The active-standby switching conditions are usually to monitor the other party's heartbeat packets and the connectivity of the upstream and downstream devices to determine whether to perform active-standby switching to ensure business. In other words, active-standby switching can only be performed when the host is restarted or the interface status is DOWN. However, for application layer security devices, they currently only monitor heartbeat packets. When other engines or processes on the host are stuck, the host heartbeat packets can still be sent in this case, and the active-standby switching conditions are not met, which can easily cause business failures and make it difficult to ensure business stability. Summary of the invention

[0004] In view of this, the purpose of the present invention is to provide a method, device, equipment and storage medium for active / standby switching of an application layer device, which can perform active / standby switching when the host cannot provide business services normally, thereby ensuring business stability. The specific scheme is as follows:

[0005] In a first aspect, the present application discloses a method for switching between active and standby modes of an application layer device, comprising:

[0006] Performing a status check on a local target key engine through a first application layer device currently in a host mode to obtain a corresponding first key engine status check result;

[0007] If the first key engine status check result meets the preset abnormal condition, the local target key engine is restarted through the first application layer device, and the status of the restarted target key engine is checked again to obtain the corresponding second key engine status check result;

[0008] If the second key engine status check result meets the preset abnormal condition, the first application layer device currently in the host mode is controlled to switch to the stand-alone mode and stop sending the host heartbeat packet to the second application layer device currently in the standby mode, so that the second application layer device can actively switch its own working mode to the host mode after failing to receive the host heartbeat packet, so as to use the second application layer device to provide business services.

[0009] Optionally, before performing a status check on the local target key engine by the first application layer device currently in the host mode to obtain a corresponding first key engine status check result, the method further includes:

[0010] All application layer devices are deployed in a high-availability master-slave mode to set the corresponding working mode of each application layer device so that each application layer device operates based on the corresponding working mode; the working mode includes a master mode and a standby mode.

[0011] Optionally, after failing to receive the host heartbeat packet, the second application layer device actively switches its own working mode to the host mode to provide business services using the second application layer device, including:

[0012] The second application layer device monitors the number of heartbeat cycles of the host heartbeat packet sent by the first application layer device and does not receive the heartbeat cycle number. If the heartbeat cycle number is greater than a preset cycle number, the second application layer device actively switches its own working mode to the host mode to use the second application layer device to provide business services.

[0013] Optionally, if the first key engine status check result meets a preset abnormal condition, the local target key engine is restarted through the first application layer device, and the status of the restarted target key engine is checked again to obtain a corresponding second key engine status check result, including:

[0014] If the first key engine status check result meets the preset abnormal condition, the local target key engine is restarted through the first application layer device, and the status of the restarted target key engine is checked again to obtain the corresponding current second key engine status check result;

[0015] If the current second key engine status check result meets the preset abnormal condition, then jump back to the step of restarting the local target key engine through the first application layer device until the number of restarts of the target key engine reaches a preset number threshold;

[0016] Correspondingly, if the second key engine status check result meets the preset abnormal condition, controlling the first application layer device currently in the host mode to switch to the stand-alone mode and stopping sending the host heartbeat packet to the second application layer device currently in the standby mode, including:

[0017] If the status check results of each of the second key engines meet the preset abnormal condition, the first application layer device currently in the host mode is controlled to switch to the stand-alone mode and stop sending the host heartbeat packet to the second application layer device currently in the standby mode.

[0018] Optionally, the method for switching between active and standby devices of the application layer device further includes:

[0019] If the first key engine status check result or the second key engine status check result does not meet the preset abnormal condition, jump to the step of performing a status check on the local target key engine through the first application layer device currently in the host mode.

[0020] Optionally, the preset abnormal condition is that the local target key engine is currently unable to provide business services normally.

[0021] Optionally, after controlling the first application layer device currently in the host mode to switch to the stand-alone mode and stopping sending the host heartbeat packet to the second application layer device currently in the standby mode, the method further includes:

[0022] Generate corresponding alarm information, and send the alarm information to a preset administrator terminal, so that the administrator can check the first application layer device based on the alarm information received by the preset administrator terminal.

[0023] In a second aspect, the present application discloses a master-slave switching device of an application layer device, comprising:

[0024] A first status check module, configured to perform a status check on a local target key engine through a first application layer device currently in a host mode, so as to obtain a corresponding first key engine status check result;

[0025] A second status check module, configured to restart the local target key engine through the first application layer device if the first key engine status check result meets a preset abnormal condition, and perform a status check on the restarted target key engine again to obtain a corresponding second key engine status check result;

[0026] The master-slave switching module is used to control the first application layer device currently in the host mode to switch to the stand-alone mode and stop sending the host heartbeat packet to the second application layer device currently in the standby mode if the second key engine status check result meets the preset abnormal condition, so that the second application layer device can actively switch its own working mode to the host mode after failing to receive the host heartbeat packet, so as to use the second application layer device to provide business services.

[0027] In a third aspect, the present application discloses an electronic device, comprising:

[0028] Memory, used to store computer programs;

[0029] The processor is used to execute the computer program to implement the active-standby switching method of the application layer device.

[0030] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the aforementioned active-standby switching method of an application layer device.

[0031] In the present application, a status check is performed on a local target key engine through a first application layer device that is currently in host mode to obtain a corresponding first key engine status check result; if the first key engine status check result meets a preset abnormal condition, the local target key engine is restarted through the first application layer device, and a status check is performed again on the restarted target key engine to obtain a corresponding second key engine status check result; if the second key engine status check result meets the preset abnormal condition, the first application layer device that is currently in host mode is controlled to switch to stand-alone mode and stop sending host heartbeat packets to the second application layer device that is currently in standby mode, so that the second application layer device actively switches its own working mode to host mode after failing to receive the host heartbeat packet, so as to use the second application layer device to provide business services. It can be seen that, in the present application, when the first application layer device is the host, the target key engine of the first application layer device is checked. If the process of the target key engine is abnormal and causes the first application layer device to be unable to provide business services normally, the target key engine of the first application layer device is first restarted to try to repair the problem. If the target key engine still cannot work normally after the restart, the operation mode of the first application layer device is switched to the stand-alone mode, so that the first application layer device will stop sending the host heartbeat packet to the second application layer device running in the standby mode. After failing to obtain the host heartbeat packet, the second application layer device can determine that the current host's operation mode is the stand-alone mode, and execute the master-slave switching instruction to convert its own working mode from the standby mode to the host mode, becoming the new host, and replacing the first application layer device to provide business services, so as to ensure business stability and avoid the failure that the host heartbeat packet can be sent normally but the host cannot provide business services normally. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in 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 only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0033] Figure 1 A flow chart of a method for switching between a primary and a secondary device of an application layer disclosed in the present application;

[0034] Figure 2 A schematic diagram of a specific active / standby switching method for an application layer device disclosed in the present application;

[0035] Figure 3 A schematic diagram of the structure of a master-slave switching device for an application layer device disclosed in the present application;

[0036] Figure 4 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION

[0037] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only 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.

[0038] At present, the master-slave switching of the third-layer or fourth-layer security equipment is mainly based on keepalive and VRRP. The switching conditions are to monitor the heartbeat packets of the other party and monitor the connectivity of the upper and lower connected devices to determine whether to perform the master-slave switching to ensure the normal operation of the business service. However, when judging whether the security equipment of the application layer needs to perform the master-slave switching, usually only whether the heartbeat packet can be monitored is used as the judgment condition. The master-slave switching can only be performed when the host is restarted or the interface is down. The conditions for the master-slave switching are harsh. If the business failure cannot be accessed due to the pseudo-death of some key engines in the application layer, but there is no condition to trigger the master-slave switching, it is easy to cause business failure. In order to solve the above technical problems, the present application discloses a master-slave switching method for application layer devices, which can perform master-slave switching when the host heartbeat packet can be sent normally but the host cannot provide business services normally.

[0039] See also Figure 1 As shown, an embodiment of the present invention discloses a method for switching between active and standby modes of an application layer device, including:

[0040] Step S11: Performing a status check on a local target key engine through the first application layer device currently in the host mode to obtain a corresponding first key engine status check result.

[0041] In this embodiment, before each application layer device is put into use, it is necessary to first perform high-availability master-slave deployment on all application layer devices to set the corresponding working mode of each application layer device, which includes a host mode and a standby mode, and each application layer device operates based on its working mode. When performing high-availability master-slave deployment, the working mode of the first application layer device is deployed as the host mode, which is responsible for providing business services and sending host heartbeat packets to the remaining application layer devices based on the heartbeat packet sending cycle. The application layer device whose working mode is the host mode is called the host, and the application layer device whose working mode is the standby mode is called the standby. In order to avoid the occurrence of brain split, only the working mode of the first application layer device is deployed as the host mode, and the working mode of the remaining application layer devices is deployed as the standby mode. At the same time, only one application layer device is the host, but multiple application layer devices can be standby, thereby improving the stability of the application layer devices and ensuring the stability of the business.

[0042] When the first application layer device is running in the host mode, it is necessary to perform a status check on the local target key engine based on a preset check period to obtain the corresponding first key engine status check result. If these target key engines have abnormal status, it may cause the host to be unable to provide business services normally. Therefore, by performing status checks on these target key engines based on a preset check period, such as checking the status of the target key engine every 3 seconds, to obtain the first engine status check result and determine whether the status of the target key engine is abnormal, it can avoid the failure to timely discover business service abnormalities due to failure to discover the abnormal status of the target key engine.

[0043] Step S12: If the first key engine status check result meets the preset abnormal condition, the local target key engine is restarted through the first application layer device, and the status of the restarted target key engine is checked again to obtain the corresponding second key engine status check result.

[0044] In this embodiment, the preset abnormal condition may be that the local target key engine is currently unable to provide business services normally. That is to say, when the local target key engine is abnormal and causes business service abnormality, the first application layer device checks the target key engine based on the preset inspection period to obtain the first key engine status check result to determine whether the target key engine can provide business services normally. If the target key engine cannot provide business services normally, that is, the first key engine status check result meets the preset abnormal condition, the local target key engine is restarted through the first application layer device, and the status of the restarted target key engine is checked again, so as to obtain the corresponding second key engine status check result.

[0045] In a specific implementation, if the first key engine status check result meets the preset abnormal condition, the local target key engine can be restarted through the first application layer device, and the status of the restarted target key engine can be checked again to obtain the corresponding current second key engine status check result. If the current second key engine status check result meets the preset abnormal condition, then jump to the step of restarting the local target key engine through the first application layer device again until the number of restarts of the target key engine reaches the preset number threshold, and the current second key engine status check result obtained last time is determined as the second key engine status check result. In addition, if the current second key engine status check result does not meet the preset abnormal condition, that is, the current second key engine status check result indicates that the target key engine can provide business services normally, then stop restarting and jump to the step of performing a status check on the local target key engine through the first application layer device currently in host mode.

[0046] Step S13: If the second key engine status check result meets the preset abnormal condition, the first application layer device currently in the host mode is controlled to switch to the stand-alone mode and stop sending the host heartbeat packet to the second application layer device currently in the standby mode, so that the second application layer device can actively switch its own working mode to the host mode after failing to receive the host heartbeat packet, so as to use the second application layer device to provide business services.

[0047] In this embodiment, if the status check result of the second key engine meets the preset abnormal condition, that is, the target key engine after restart still cannot provide business services normally, then the first application layer device currently in the host mode is controlled to switch to the stand-alone mode and stop sending the host heartbeat packet to the second application layer device currently in the standby mode. If the target key engine is restarted multiple times, and all the second key engine status check results obtained by performing a status check on the target key engine after each restart indicate that the target key engine cannot provide business services normally, that is, the status check results of each second key engine meet the preset abnormal condition, then the first application layer device currently in the host mode is controlled to switch to the stand-alone mode and stop sending the host heartbeat packet to the second application layer device currently in the standby mode.

[0048] After controlling the first application layer device currently in the host mode to switch to the stand-alone mode and stop sending the host heartbeat packet to the second application layer device currently in the standby mode, that is, after determining that the current host cannot provide business services normally, corresponding alarm information can also be generated and sent to the preset administrator terminal, so that the administrator can check the first application layer device based on the alarm information received by the preset administrator terminal. If the administrator checks and debugs the first application layer device and finds that the first application layer device can run in the host mode, the first application layer device can be deployed as a standby device through the security device.

[0049] In this embodiment, after failing to receive a host heartbeat packet, the second application layer device actively switches its own working mode to the host mode to utilize the second application layer device to provide business services, which may include: the second application layer device monitors the number of heartbeat cycles in which the host heartbeat packet sent by the first application layer device is not received. If the number of heartbeat cycles is greater than a preset number of cycles, for example, no host heartbeat packet sent by the first application layer device is received within three heartbeat packet sending cycles, the second application layer device can actively switch its own working mode to the host mode to utilize the second application layer device to provide business services.

[0050] In a specific implementation, there are many standby machines in the application layer device, such as standby machine No. 1, standby machine No. 2, and standby machine No. 3. The host can send the host heartbeat packet only to standby machine No. 1, but not to other standby machines. If the working mode of the first application layer device is switched to the standby mode, standby machine No. 1 can be switched between the master and the standby to provide business services, and the previous standby machine No. 2 becomes the new standby machine No. 1. Among them, the host is the first application layer device, and standby machine No. 1 is the second application layer device. In another specific implementation, the host can send the host heartbeat packet to all standby machines. If all standby machines cannot receive the host heartbeat packet, the target standby machine can be determined from all the standby machines as the second application layer device, so as to use the second application layer device to preempt the host to provide business services.

[0051] In addition, if the first key engine status check result or the second key engine status check result does not meet the preset abnormal condition, jump to the step of performing a status check on the local target key engine through the first application layer device currently in the host mode.

[0052] It can be seen that, in the present application, when the first application layer device is the host, the target key engine of the first application layer device is checked. If the process of the target key engine is abnormal and causes the first application layer device to be unable to provide business services normally, the target key engine of the first application layer device is first restarted to try to repair the problem. If the target key engine still cannot work normally after the restart, the operation mode of the first application layer device is switched to the stand-alone mode, so that the first application layer device will stop sending the host heartbeat packet to the second application layer device running in the standby mode. After failing to obtain the host heartbeat packet, the second application layer device can determine that the operation mode of the current host is the stand-alone mode, and execute the master-standby switching instruction to convert its own working mode from the standby mode to the host mode, becoming the new host, and replacing the first application layer device to provide business services to ensure business stability.

[0053] Based on the above embodiment, the present application discloses a method for switching between active and standby devices of an application layer, which can perform active and standby switching when the host heartbeat packet can be sent normally but the host cannot provide business services normally. Next, the active and standby switching process of a specific application layer device will be described.

[0054] See also Figure 2 As shown, the host sends a host heartbeat packet to the standby machine based on the heartbeat packet sending cycle, and checks its own target key engine based on the preset inspection cycle to obtain the corresponding first key engine status inspection result to determine whether the target key engine status is normal and whether the host can provide business services normally. If the first key engine status inspection result indicates that the target key engine status is normal and the host can provide business services normally, then jump to the step of the host sending the host heartbeat packet to the standby machine based on the heartbeat packet sending cycle, and continue to provide business services; if the first key engine status inspection result indicates that the target key engine status is abnormal, or the host cannot provide business services normally, then the target key engine can be restarted, and it is checked whether the restarted target key engine status is normal and whether the host can provide business services normally, so as to obtain the corresponding second key engine status inspection result.

[0055] If the result of the second key engine status check indicates that the target key engine status is normal and the host can provide business services normally, then jump to the step of sending the host heartbeat packet to the standby machine based on the heartbeat packet sending cycle, and continue to provide business services; if the result of the second key engine status check indicates that the target key engine status is abnormal, or the host cannot provide business services normally, then jump to the step of restarting the target key engine, or switch the host's working mode to stand-alone mode, so that the standby machine can actively switch its own working mode to host mode after failing to receive the host heartbeat packet, so as to use it to provide business services. Specifically, if the host sends a host heartbeat packet every 3 seconds and checks its own target key engine every 3 seconds, then the standby machine does not receive the host heartbeat packet within three heartbeat packet sending cycles, that is, does not receive a host heartbeat packet within 9 seconds, then it can be determined that the current host can no longer provide business services normally, and switches its own working mode to host mode to provide business services to ensure the stability of business services.

[0056] It can be seen that the present application regularly checks the target key engine of the host. If the process of the target key engine is abnormal and the host cannot provide business services normally, the target key engine of the host is restarted to try to repair the problem. If the target key engine still cannot work normally after the restart, the operating mode of the host is switched to stand-alone mode. In this way, the current host will stop sending host heartbeat packets to the standby machine. After the standby machine cannot obtain the host heartbeat packet, it can determine that the current host's operating mode is stand-alone mode, and execute the master-standby switching instruction to convert its own working mode from standby mode to host mode, becoming a new host, replacing the previous host to provide business services to ensure business stability.

[0057] See also Figure 3 As shown, the present application discloses a master-slave switching device of an application layer device, comprising:

[0058] A first status check module 11 is used to perform a status check on a local target key engine through a first application layer device currently in a host mode to obtain a corresponding first key engine status check result;

[0059] A second status check module 12 is configured to restart the local target key engine through the first application layer device if the first key engine status check result meets a preset abnormal condition, and perform a status check on the restarted target key engine again to obtain a corresponding second key engine status check result;

[0060] The active-standby switching module 13 is used to control the first application layer device currently in the host mode to switch to the stand-alone mode and stop sending the host heartbeat packet to the second application layer device currently in the standby mode if the second key engine status check result meets the preset abnormal condition, so that the second application layer device can actively switch its own working mode to the host mode after failing to receive the host heartbeat packet, so as to use the second application layer device to provide business services.

[0061] It can be seen that, in the present application, when the first application layer device is the host, the target key engine of the first application layer device is checked. If the process of the target key engine is abnormal and causes the first application layer device to be unable to provide business services normally, the target key engine of the first application layer device is first restarted to try to repair the problem. If the target key engine still cannot work normally after the restart, the operation mode of the first application layer device is switched to the stand-alone mode, so that the first application layer device will stop sending the host heartbeat packet to the second application layer device running in the standby mode. After failing to obtain the host heartbeat packet, the second application layer device can determine that the operation mode of the current host is the stand-alone mode, and execute the master-standby switching instruction to convert its own working mode from the standby mode to the host mode, becoming the new host, and replacing the first application layer device to provide business services to ensure business stability.

[0062] In a specific implementation, the active / standby switching device of the application layer device may further include:

[0063] The active-standby deployment module is used to perform high-availability active-standby deployment on all application layer devices to set the corresponding working mode of each application layer device so that each application layer device operates based on the corresponding working mode; the working mode includes the master mode and the standby mode.

[0064] In a specific implementation, the active / standby switching module 13 may specifically include:

[0065] The master-slave switching unit is used for the second application layer device to monitor the number of heartbeat cycles of the host heartbeat packet sent by the first application layer device and not receive it. If the number of heartbeat cycles is greater than the preset number of cycles, the second application layer device will actively switch its own working mode to the host mode to use the second application layer device to provide business services.

[0066] In a specific implementation, the second status checking module 12 may specifically include:

[0067] a status checking unit, configured to restart the local target key engine through the first application layer device if the status checking result of the first key engine meets a preset abnormal condition, and perform a status check on the restarted target key engine again to obtain a corresponding current status checking result of the second key engine;

[0068] an engine restart unit, configured to, if the current second key engine status check result satisfies the preset abnormal condition, jump back to the step of restarting the local target key engine through the first application layer device until the number of restarts of the target key engine reaches a preset number threshold;

[0069] Accordingly, the active / standby switching module 13 may specifically include:

[0070] A mode switching unit is used to control the first application layer device currently in the host mode to switch to the stand-alone mode and stop sending the host heartbeat packet to the second application layer device currently in the standby mode if the status check results of each of the second key engines meet the preset abnormal conditions.

[0071] In a specific implementation, the active / standby switching device of the application layer device may further include:

[0072] The normal status operation module is used to jump to the step of performing a status check on the local target key engine through the first application layer device currently in the host mode if the first key engine status check result or the second key engine status check result does not meet the preset abnormal condition.

[0073] In a specific implementation, the active / standby switching device of the application layer device may further include:

[0074] The alarm information sending module is used to generate corresponding alarm information and send the alarm information to a preset administrator terminal, so that the administrator can check the first application layer device based on the alarm information received by the preset administrator terminal.

[0075] Furthermore, the present application also discloses an electronic device. Figure 4 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram cannot be regarded as any limitation on the scope of use of the present application.

[0076] Figure 4A schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the active / standby switching method of the application layer device disclosed in any of the aforementioned embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.

[0077] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.

[0078] In addition, the memory 22 as a carrier for resource storage may be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon may include an operating system 221, a computer program 222, etc., and the storage method may be temporary storage or permanent storage.

[0079] The operating system 221 is used to manage and control the hardware devices and computer program 222 on the electronic device 20, which can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete the active / standby switching method of the application layer device executed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks.

[0080] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the active / standby switching method of the application layer device disclosed above is implemented. For the specific steps of the method, reference may be made to the corresponding contents disclosed in the above embodiments, and no further description will be given here.

[0081] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0082] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0083] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0084] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0085] The technical solution provided by the present application is introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for general technicians in this field, according to the idea of ​​the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A method for switching between active and standby devices of an application layer, characterized in that: include: Performing a status check on a local target key engine through a first application layer device currently in a host mode to obtain a corresponding first key engine status check result; If the first key engine status check result meets the preset abnormal condition, the local target key engine is restarted through the first application layer device, and the status of the restarted target key engine is checked again to obtain the corresponding second key engine status check result; If the second key engine status check result meets the preset abnormal condition, the first application layer device currently in the host mode is controlled to switch to the stand-alone mode and stop sending the host heartbeat packet to the second application layer device currently in the standby mode, so that the second application layer device can actively switch its own working mode to the host mode after failing to receive the host heartbeat packet, so as to use the second application layer device to provide business services.

2. The method for switching between active and standby devices of an application layer device according to claim 1, characterized in that: Before the state check of the local target key engine is performed by the first application layer device currently in the host mode to obtain the corresponding first key engine state check result, the method further includes: All application layer devices are deployed in a high-availability master-slave mode to set the corresponding working mode of each application layer device so that each application layer device operates based on the corresponding working mode; the working mode includes a master mode and a standby mode.

3. The method for switching between active and standby devices of an application layer device according to claim 1, characterized in that: After failing to receive the host heartbeat packet, the second application layer device actively switches its own working mode to the host mode, so as to use the second application layer device to provide business services, including: The second application layer device monitors the number of heartbeat cycles of the host heartbeat packet sent by the first application layer device and does not receive the heartbeat cycle number. If the heartbeat cycle number is greater than a preset cycle number, the second application layer device actively switches its own working mode to the host mode to use the second application layer device to provide business services.

4. The method for switching between active and standby devices of an application layer device according to claim 1, characterized in that: If the first key engine status check result meets the preset abnormal condition, the local target key engine is restarted through the first application layer device, and the status of the restarted target key engine is checked again to obtain the corresponding second key engine status check result, including: If the first key engine status check result meets the preset abnormal condition, the local target key engine is restarted through the first application layer device, and the status of the restarted target key engine is checked again to obtain the corresponding current second key engine status check result; If the current second key engine status check result meets the preset abnormal condition, then jump back to the step of restarting the local target key engine through the first application layer device until the number of restarts of the target key engine reaches a preset number threshold; Correspondingly, if the second key engine status check result meets the preset abnormal condition, controlling the first application layer device currently in the host mode to switch to the stand-alone mode and stopping sending the host heartbeat packet to the second application layer device currently in the standby mode, including: If the status check results of each of the second key engines meet the preset abnormal condition, the first application layer device currently in the host mode is controlled to switch to the stand-alone mode and stop sending the host heartbeat packet to the second application layer device currently in the standby mode.

5. The method for switching between active and standby devices of an application layer device according to claim 1, characterized in that: Also includes: If the first key engine status check result or the second key engine status check result does not meet the preset abnormal condition, jump to the step of performing a status check on the local target key engine through the first application layer device currently in the host mode.

6. The method for switching between active and standby devices of an application layer device according to claim 1, characterized in that: The preset abnormal condition is that the local target key engine is currently unable to provide business services normally.

7. The method for switching between active and standby devices of an application layer device according to any one of claims 1 to 6, characterized in that: After controlling the first application layer device currently in the host mode to switch to the stand-alone mode and stopping sending the host heartbeat packet to the second application layer device currently in the standby mode, the method further includes: Generate corresponding alarm information, and send the alarm information to a preset administrator terminal, so that the administrator can check the first application layer device based on the alarm information received by the preset administrator terminal.

8. A master-slave switching device for an application layer device, characterized in that: include: A first status check module, configured to perform a status check on a local target key engine through a first application layer device currently in a host mode, so as to obtain a corresponding first key engine status check result; A second status check module, configured to restart the local target key engine through the first application layer device if the first key engine status check result meets a preset abnormal condition, and perform a status check on the restarted target key engine again to obtain a corresponding second key engine status check result; The master-slave switching module is used to control the first application layer device currently in the host mode to switch to the stand-alone mode and stop sending the host heartbeat packet to the second application layer device currently in the standby mode if the second key engine status check result meets the preset abnormal condition, so that the second application layer device can actively switch its own working mode to the host mode after failing to receive the host heartbeat packet, so as to use the second application layer device to provide business services.

9. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor is used to execute the computer program to implement the active-standby switching method of the application layer device according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: Used to store a computer program, wherein when the computer program is executed by a processor, the active-standby switching method of an application layer device according to any one of claims 1 to 7 is implemented.