Automatic switching method for abnormal application service state

By performing data synchronization and status monitoring between the host machine and the standby machine, and detecting and switching to the standby machine to provide services, the problem of service interruption caused by application failures in the existing technology is solved, and service continuity and high reliability in the event of application failures are achieved. sex.

CN118802484APending Publication Date: 2024-10-18WUHAN MARINE MACHINERY PLANT
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410689381.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-30
Publication Date
2024-10-18

AI Technical Summary

Technical Problem

The existing technology cannot monitor the service status of the master node in time when an application fails, resulting in service interruption. It cannot replace the abnormal master node in time, resulting in service interruption.

Method used

Design an automatic switching method when the application service status is abnormal. Through data synchronization and status monitoring between the host and the backup machine, the running status and network connectivity of the main application and the main database are detected. If abnormal, restart or switch to the backup machine. Provide services on-line to ensure service continuity.

Benefits of technology

It achieves non-interruption of services when application fails, improves fault response speed, has certain fault self-healing functions, avoids data conflicts between applications and databases, improves data accuracy and reliability, and reduces host load. A crash situation is avoided.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118802484A_ABST
    Figure CN118802484A_ABST
Patent Text Reader

Abstract

The invention discloses an automatic switching method for an abnormal application service state, which comprises the following steps of: 1, monitoring a main application service state, and entering a second step if the main application service state is abnormal; 2, detecting the running state of the main application, entering the third step if the main application is normal, restarting and detecting the running state if the main application is abnormal, and running the standby machine and terminating if the main application is abnormal; 3, detecting the running state of the main database, entering the step 4 if the main database is normal, restarting and detecting the running state if the main database is abnormal, and running the standby machine and terminating if the main database is abnormal; 4, detecting whether the host network is connected or not, if the network is not connected and the network cable is not connected, operating the standby machine, and terminating; if the network cable is connected, restarting the main network card and detecting the network, and if the network is not connected, operating the standby machine and terminating; the host monitors at any time, so that the abnormal service state can be found in time, the standby machine is repaired or operated after detection, the service cannot be interrupted, and the fault response speed is high. Therefore, the service is not interrupted when the design application has a fault, and the fault response speed is relatively high.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a switching method, belongs to the field of high availability of information systems, and in particular to an automatic switching method when an application service state is abnormal. Background Art

[0002] Applications are the core components of modern information systems, and are responsible for processing various business logics. However, during runtime, applications and related software may fail, which may cause the applications to stop running. When applications stop running, they cannot provide services to users, so applications need to be replaced or repaired in a timely manner to continue to provide services to users.

[0003] A Chinese patent application with application number 202311416035.9 and application date October 27, 2023 discloses a cluster optimization processing method based on a high-availability link and related equipment. The method builds a business system on a preset cluster framework, identifies the core processing flow in the business system, and uses the system components corresponding to the core processing flow as the main node of the business system. A standby node is deployed for the main node, wherein the standby node is deployed in the business system based on a high-availability link, synchronizes data between the main node and the standby node, and tests the business system that has completed data synchronization to obtain a new business cluster system. Although the design enables the standby node to replace the abnormal main node to continue providing services, it still has the following defects: This design cannot monitor the service status of the master node, and cannot promptly replace the abnormal master node with the backup node, which will cause service interruption.

[0004] The information disclosed in this background technology section is only intended to increase the understanding of the overall background of the application, and should not be regarded as acknowledging or suggesting in any form that the information constitutes the prior art already known to ordinary technicians in this field. Summary of the invention

[0005] The purpose of the present invention is to overcome the defects and problems existing in the prior art that application failure will cause service interruption, and to provide an automatic switching method when the application service state is abnormal, which will not interrupt the service when the application fails.

[0006] To achieve the above objectives, the technical solution of the present invention is: A method for automatic switching when an application service state is abnormal, the application includes a main application and a backup application, the main application is located on a host, and the backup application is located on a backup machine, the method includes the following steps: Step 1: First synchronize the data of the host to the standby machine, and then run the main application and the main database on the host; then let the host continuously monitor whether the service status of the main application is normal. If the service status of the main application is abnormal, proceed to step 2; Step 2: First detect the running status of the main application. The test result of the main application is that the running status is abnormal or normal. If the running status of the main application is normal, proceed to step 3. If the running status of the main application is abnormal, restart the main application first, and then detect the running status of the main application. If the running status of the main application is abnormal at this time, suspend the running of the main application and the main database, and then run the standby application and the standby database on the standby machine, and this step is terminated. If the running status of the main application is normal at this time, the main application has been repaired, and return to step 1: enable the host to continuously monitor whether the service status of the main application is normal. Step 3: First detect the running status of the main database. The test result of the main database is that the running status is abnormal or normal. If the running status of the main database is normal, proceed to step 4. If the running status of the main database is abnormal, restart the main database first, and then detect the running status of the main database. If the running status of the main database is abnormal at this time, suspend the running of the main application and the main database, and then run the standby application and the standby database on the standby machine, and this step is terminated. If the running status of the main database is normal at this time, the main database has been repaired, and return to step 1: enable the host to continuously monitor whether the service status of the main application is normal. Step 4: First check whether the network from the host to the device on the same network segment of the business network and the network from the host to the standby machine are connected. If the network is not connected, first connect the host and the standby machine through a network cable. If the network cable between the host and the standby machine is not connected, the host is faulty, and then suspend the operation of the main application and the main database, and then run the standby application and the standby database on the standby machine, and this step is terminated; if the network cable network between the host and the standby machine is connected, first restart the main network card of the host, and then check whether the network from the host to the device on the same network segment of the business network and the network from the host to the standby machine are connected. If the network is connected at this time, the main network card has been repaired, and the main application and the main database continue to run, and this step is terminated; if the network is not connected at this time, suspend the operation of the main application and the main database, and then run the standby application and the standby database on the standby machine, and this step is terminated.

[0007] In the first step, the host continuously monitoring whether the service status of the main application is normal means that: the host continuously monitors whether the service status of the main application is normal, and the standby machine continuously monitors whether the service status of the standby application is normal.

[0008] In the first step, the standby machine continuously monitors whether the service status of the standby application is normal. If the service status of the standby application is abnormal, the running status of the standby application is first detected. If the running status of the standby application is abnormal, the standby application is first restarted, and then the running status of the standby application is detected. If the running status of the standby application is abnormal, the standby machine is restarted, and then the log and alarm information are updated, and this step terminates.

[0009] In the first step, when detecting the running status of the standby application, if the running status of the standby application is normal, then detecting the running status of the standby database, if the running status of the standby database is abnormal, first restarting the standby database, then detecting the running status of the standby database, if the running status of the standby database is abnormal, restarting the standby machine, then updating the log and alarm information, and terminating this step; In the first step, when detecting the running status of the standby database, if the running status of the standby database is normal, then detect whether the network between the standby machine and the equipment in the same network segment of the business network and between the standby machine and the host is connected. If the network is not connected, restart the standby network card, update the log and alarm information, and this step terminates.

[0010] In the fourth step, detecting whether the network from the host to the device on the same network segment of the business network and the network from the host to the backup machine are connected means: detecting whether the network from the host to the device on the same network segment of the business network and the network from the host to the backup machine are connected, and the backup machine detecting whether the network from the host to the device on the same network segment of the business network and the network from the host to the backup machine are connected.

[0011] In the fourth step, when the network from the host to the device on the same network segment of the business network and the network from the host to the backup machine are unreachable, if the network from the backup machine to the device on the same network segment of the business network is connected, and the backup application service status is normal, but the network from the backup machine to the host is unreachable and the network cable network from the backup machine to the host is unreachable, then the host has a fault.

[0012] In the second step, after the standby application and the standby database on the standby machine are run, the standby machine is marked as the master machine, and at the same time, the original master machine is marked as the standby machine, and then the standby machine is restarted, the log is updated, and then the alarm information is updated, and this step is terminated; In the third step, after the standby application and the standby database on the standby machine are run, the standby machine is marked as the master machine, and at the same time, the original master machine is marked as the standby machine, and then the standby machine is restarted, the log is updated, and then the alarm information is updated, and this step is terminated; In the fourth step, after running the standby application and the standby database on the standby machine, the standby machine is marked as the master machine. At the same time, the original master machine is marked as the standby machine. The standby machine is then restarted, the log is updated, and the alarm information is updated. This step terminates.

[0013] In the second step, after the alarm information is updated, the standby machine is repaired, and then the main machine or the standby machine is selected to provide service, and this step is terminated; In the third step, after the alarm information is updated, the standby machine is repaired, and then the main machine or the standby machine is selected to provide service, and this step is terminated; In the fourth step, after the alarm information is updated, the standby machine is repaired, and then the host machine or the standby machine is selected to provide service, and this step terminates.

[0014] In the first step, synchronizing the data of the host machine to the backup machine means: first setting the host machine's business network IP, client access business IP, network cable IP, host name, main application service name, and main database service name in sequence; then setting the backup machine's business network IP, client access business IP, network cable IP, backup machine name, backup application service name, and backup database service name, then specifying the host machine and backup machine, and then synchronizing the host machine's data to the backup machine.

[0015] In the first step, when the main application and the main database on the host are running, the data of the main database is synchronized to the standby database regularly or periodically; In the first step, when the main application and the main database on the host are running, a switching operation is performed regularly or periodically, and the switching operation is: first stop the main application and the main database from serving, then enable the standby application and the standby database to serve, then stop the standby application and the standby database from serving, and then enable the main application and the main database to serve.

[0016] Compared with the prior art, the present invention has the following beneficial effects: 1. In an automatic switching method when an application service state is abnormal, the present invention includes a main machine and a standby machine, and the method includes the following steps: the first step: monitoring the service state of the main application, if the service state is abnormal, then entering the second step; the second step: first detecting the running state of the main application, if normal, then entering the third step, if abnormal, then restarting the main application, then detecting the running state of the main application, if abnormal, then the standby machine performs the service, and this step terminates; the third step: detecting the running state of the main database, if normal, then entering the fourth step, if abnormal, then restarting the main database, then detecting the running state of the main database, if abnormal, then the standby machine performs the service, and this step terminates; the fourth step: detecting the network connectivity of the host, if the network of the host is not connected, and the network cable network with the standby machine is also not connected, then the standby machine serves, and this step terminates; if the network cable network of the host and the standby machine is connected, then first restarting the main network card of the host, then detecting the network connectivity of the host, if not connected, then the standby machine serves, and this step terminates. The advantages of the present invention also include: First point: when the main application is in normal running state, the main database is in normal running state and the main application network is connected, the main application service state is normal, that is, the main application can provide services to users; when the main application is in abnormal running state, the main database is in abnormal running state or the main application network is disconnected, the main application service state is abnormal, that is, the main application cannot provide services; the host monitors the main application service state, and judges the running state and network connectivity of the main application and the main database in turn when abnormal, and restarts and repairs first when the running state is abnormal and the network is disconnected, and the standby machine replaces the host to provide services if it cannot be repaired, so the service of the present invention will not be interrupted; Second point: the service status of the main application is monitored, so the abnormal service status can be discovered in time, that is, the main application has a fault, and then the cause of the fault is determined in turn, and then repaired according to the cause, or the backup machine replaces the main machine to provide services, so the fault response speed of the present invention is relatively fast; Third point: after the host determines the cause of the fault, it will restart to repair it, so the present invention has a certain fault self-healing function; if the above-mentioned repair is unsuccessful, the backup machine will quickly replace the host to provide services, avoiding the application from stopping and data loss, improving the reliability and security of the application, and also avoiding data conflicts or inconsistencies between applications and databases, improving data quality and accuracy; Fourth point: the prior art deploys backup nodes for all main nodes, and makes the backup nodes continue to serve after the main node fails. When the total number of nodes is large, the host load will be large; in the present invention, after the main application service status is abnormal, the backup machine is used to replace the main machine to continue the service, so the host load is small and will not cause a crash; Therefore, when the present invention is applied to a fault, the service will not be interrupted, and the fault response speed is relatively fast.

[0017] 2. In the automatic switching method when the application service status is abnormal in the present invention, in the first step, the standby machine continuously monitors the service status of the standby application; when the standby service status is abnormal, the standby machine determines the cause of the abnormality in turn, then repairs it, and then updates the log and alarm information. When the host is providing services, the standby machine monitors the standby application to avoid the situation where the standby application cannot provide services in time after replacing the main application, thereby causing service interruption. Therefore, the continuous application effect of the present invention is better.

[0018] 3. In the automatic switching method when the application service status is abnormal in the present invention, in the fourth step, the standby machine also continuously monitors whether the network from the host to the same network segment equipment of the business network and the network from the host to the standby machine is connected. In the fourth step, if the host network is not connected, but the standby network is connected, and the network from the standby machine to the host is not connected, then the host fails and the standby machine performs the service; not only the host monitors its network connectivity, but the standby machine also monitors the network connectivity of the host, so double monitoring of network connectivity is formed to avoid disconnection in the present invention. Therefore, the probability of disconnection in the present invention is low.

[0019] 4. In the automatic switching method when the application service status is abnormal in the present invention, in the second step, the third step and the fourth step, after the standby machine is run, the host is marked as the standby machine, the original host is marked as the standby machine, the standby machine is restarted, and then the log and alarm information are updated; the standby machine is repaired, and then the host or the standby machine is selected for service. When applied, after marking the host as the standby machine, the standby machine is restarted to repair the fault, and then the log and alarm information are updated to record the occurrence of the fault, the switching process between the host and the standby machine, and the results and effects of the switching, for the purpose of analysis and improvement of the present invention, so as to improve the fault prevention ability and optimization ability of the present invention. Therefore, the optimization ability of the present invention is better.

[0020] 5. In the automatic switching method when the application service status is abnormal in the present invention, in the first step, specifying the host and the backup machine means first setting the relevant IP information of the host and the backup machine, then specifying the host and the backup machine, and then synchronizing the data between the host and the backup machine; in the first step, data synchronization is performed between the host and the backup machine regularly or periodically; switching operations are performed between the host and the backup machine regularly or periodically, and when applied, the relevant IP information of the host and the backup machine is set so that the host and the backup machine can communicate in the business network; when the host is providing services, the backup machine is regularly used to replace the host to provide services to verify the availability of the backup machine and prevent the consequences of data loss due to failure of the backup machine; the data on the host is regularly synchronized to the backup machine, and the data of the host is also backed up. Therefore, the probability of data loss in the present invention is low. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1 It is a structural schematic diagram of the present invention.

[0022] Figure 2 It is a flow chart of the second step in Example 1.

[0023] Figure 3 It is a flow chart of the third step in Example 1.

[0024] Figure 4 It is a flow chart of the fourth step in Example 1.

[0025] Figure 5 yes Figure 1 Schematic diagram of the host structure.

[0026] Figure 6 yes Figure 1 Schematic diagram of the structure of the middle standby machine.

[0027] Figure 7 This is a flowchart of the abnormal status of the standby application service in Example 2.

[0028] Figure 8 This is a flowchart of an abnormal operation status of the standby database in Example 2.

[0029] Fig. 9 This is a flowchart of updating the log in Example 5.

[0030] Fig.10 This is a flow chart of the switching operation in Example 5.

[0031] Fig.11 It is a structural schematic diagram of Example 6.

[0032] In the figure: host 1, main application 11, main database 12, main network card 13, standby machine 2, standby application 21, standby database 22, standby network card 23, system 3, fault detection module 31, switching control module 32, application switching module 33, database switching module 34, data synchronization module 35, switching recovery module 36, logging module 37, fault self-healing module 38, standby machine switching verification module 39. DETAILED DESCRIPTION

[0033] The present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0034] See also Figure 1 — Fig.11 , an automatic switching method when an application service state is abnormal, the application includes a main application 11 and a standby application 21, the main application 11 is located on a host 1, and the standby application 21 is located on a standby machine 2, the method includes the following steps: Step 1: First synchronize the data of host 1 to standby host 2, and then run the main application 11 and main database 12 on host 1; then make host 1 continuously monitor whether the service status of main application 11 is normal. If the service status of main application 11 is abnormal, proceed to step 2; Step 2: First detect the running status of the main application 11. The test result of the main application 11 is that the running status is abnormal or the running status is normal; if the running status of the main application 11 is normal, proceed to step 3; if the running status of the main application 11 is abnormal, first restart the main application 11, and then detect the running status of the main application 11. If the running status of the main application 11 is abnormal at this time, suspend the running of the main application 11 and the main database 12, and then run the standby application 21 and the standby database 22 on the standby machine 2, and this step is terminated; if the running status of the main application 11 is normal at this time, the main application 11 has been repaired, and return to step 1: enable the host 1 to continuously monitor whether the service status of the main application 11 is normal; Step 3: First detect the running status of the main database 12. The test result of the main database 12 is that the running status is abnormal or the running status is normal. If the running status of the main database 12 is normal, proceed to step 4. If the running status of the main database 12 is abnormal, restart the main database 12 first, and then detect the running status of the main database 12. If the running status of the main database 12 is abnormal at this time, suspend the running of the main application 11 and the main database 12, and then run the standby application 21 and the standby database 22 on the standby machine 2, and this step is terminated. If the running status of the main database 12 is normal at this time, the main database 12 has been repaired, and return to step 1: enable the host 1 to continuously monitor whether the service status of the main application 11 is normal. Step 4: First check whether the network from host 1 to the same network segment device of the business network and the network from host 1 to standby machine 2 are connected. If the network is not connected, first connect host 1 and standby machine 2 through a network cable. If the network cable network between host 1 and standby machine 2 is not connected, host 1 has a fault, and then suspend the operation of the main application 11 and the main database 12, and then run the standby application 21 and the standby database 22 on standby machine 2, and this step is terminated; if the network cable network between host 1 and standby machine 2 is connected, first restart the main network card 13 of host 1, and then check whether the network from host 1 to the same network segment device of the business network and the network from host 1 to standby machine 2 are connected. If the network is connected at this time, the main network card 13 has been repaired, and the main application 11 and the main database 12 continue to run, and this step is terminated; if the network is not connected at this time, suspend the operation of the main application 11 and the main database 12, and then run the standby application 21 and the standby database 22 on standby machine 2, and this step is terminated.

[0035] In the first step, the host 1 continuously monitors whether the service status of the main application 11 is normal, which means that the host 1 continuously monitors whether the service status of the main application 11 is normal, and the backup machine 2 continuously monitors whether the service status of the backup application 21 is normal.

[0036] In the first step, the standby machine 2 continuously monitors whether the service status of the standby application 21 is normal. If the service status of the standby application 21 is abnormal, the running status of the standby application 21 is first detected. If the running status of the standby application 21 is abnormal, the standby application 21 is first restarted, and then the running status of the standby application 21 is detected. If the running status of the standby application 21 is abnormal, the standby machine 2 is restarted, and then the log and alarm information are updated, and this step is terminated.

[0037] In the first step, when the running state of the standby application 21 is detected, if the running state of the standby application 21 is normal, the running state of the standby database 22 is detected. If the running state of the standby database 22 is abnormal, the standby database 22 is restarted first, and then the running state of the standby database 22 is detected. If the running state of the standby database 22 is abnormal, the standby machine 2 is restarted, and then the log and alarm information are updated, and this step is terminated; In the first step, when detecting the operating status of the standby database 22, if the operating status of the standby database 22 is normal, then detect whether the network between the standby machine 2 and the equipment in the same network segment of the business network and between the standby machine 2 and the host 1 is connected. If the network is not connected, restart the standby network card 23, and then update the log and alarm information, and this step terminates.

[0038] In the fourth step, the detection of whether the network from host 1 to the same network segment device of the business network and the network from host 1 to backup machine 2 are connected means: detecting whether the network from host 1 to the same network segment device of the business network and the network from host 1 to backup machine 2 are connected, and the backup machine 2 detects whether the network from host 1 to the same network segment device of the business network and the network from host 1 to backup machine 2 are connected.

[0039] In the fourth step, when the network from host 1 to the same network segment device of the business network and the network from host 1 to backup machine 2 are unreachable, if the network from backup machine 2 to the same network segment device of the business network is connected, and the service status of backup application 21 is normal, but the network from backup machine 2 to host 1 is unreachable and the network cable network from backup machine 2 to host 1 is unreachable, then host 1 has a fault.

[0040] In the second step, after running the standby application 21 and the standby database 22 on the standby machine 2, the standby machine 2 is marked as the host 1, and at the same time, the original host 1 is marked as the standby machine 2, and then the standby machine 2 is restarted, the log is updated, and then the alarm information is updated, and this step is terminated; In the third step, after running the standby application 21 and the standby database 22 on the standby machine 2, the standby machine 2 is marked as the host 1, and at the same time, the original host 1 is marked as the standby machine 2, and then the standby machine 2 is restarted, the log is updated, and then the alarm information is updated, and this step is terminated; In the fourth step, after running the standby application 21 and the standby database 22 on the standby machine 2, the standby machine 2 is marked as the host 1. At the same time, the original host 1 is marked as the standby machine 2, and then the standby machine 2 is restarted, the log is updated, and then the alarm information is updated, and this step terminates.

[0041] In the second step, after the alarm information is updated, the standby machine 2 is repaired, and then the host machine 1 or the standby machine 2 is selected to provide service, and this step is terminated; In the third step, after the alarm information is updated, the standby machine 2 is repaired, and then the host machine 1 or the standby machine 2 is selected to provide service, and this step is terminated; In the fourth step, after the alarm information is updated, the standby machine 2 is repaired, and then the host machine 1 or the standby machine 2 is selected to provide the service, and this step is terminated.

[0042] In the first step, synchronizing the data of host 1 to backup machine 2 means: first set the business network IP, client access business IP, network cable IP, host name, main application 11 service name, and main database 12 service name of host 1 in sequence; then set the business network IP, client access business IP, network cable IP, backup machine name, backup application 21 service name, and backup database 22 service name of backup machine 2, then specify host 1 and backup machine 2, and then synchronize the data of host 1 to backup machine 2.

[0043] In the first step, the operation of the main application 11 and the main database 12 on the host 1 refers to: synchronizing the data of the main database 12 to the standby database 22 regularly or periodically; In the first step, when the main application 11 and the main database 12 on the host 1 are running, a switching operation is performed periodically or regularly. The switching operation is: first stop the main application 11 and the main database 12, then make the standby application 21 and the standby database 22 provide services, then stop the standby application 21 and the standby database 22, and then make the main application 11 and the main database 12 provide services.

[0044] The supplementary description of the present invention is as follows: The scope of application of the present invention is: various information systems that need to ensure service continuity, such as e-commerce systems, collaborative office systems, ERP, MES systems, etc.; taking the e-commerce system as an example, the main application 11 and the main database 12 are located on the host 1, and the backup application 21 and the backup database 22 are located on the backup machine 2; in normal operation, the main application 11 is used to run the application program, and the main database 12 is used to run the database program, and the two cooperate to process the user's shopping, payment, logistics and other business logic and data storage; the backup application 21 and the backup database 22 serve as redundant backups, and run the same application program and database program respectively, so that when the service status of the main application 11 is abnormal, they can quickly replace the main application 11 to provide services.

[0045] The high availability of the information system described in the present invention refers to: improving the availability of the system by reducing the time during which the system cannot provide services by design; its main purpose is to ensure business continuity and ensure that services can be provided to the outside world for a long time.

[0046] Embodiment 1: See also Figure 1 — Fig.10 , an automatic switching method when an application service state is abnormal, the application includes a main application 11 and a standby application 21, the main application 11 is located on a host 1, and the standby application 21 is located on a standby machine 2, the method includes the following steps: Step 1: First synchronize the data of host 1 to standby host 2, and then run the main application 11 and main database 12 on host 1; then make host 1 continuously monitor whether the service status of main application 11 is normal. If the service status of main application 11 is abnormal, proceed to step 2; Step 2: First detect the running status of the main application 11. The test result of the main application 11 is that the running status is abnormal or the running status is normal; if the running status of the main application 11 is normal, proceed to step 3; if the running status of the main application 11 is abnormal, first restart the main application 11, and then detect the running status of the main application 11. If the running status of the main application 11 is abnormal at this time, suspend the running of the main application 11 and the main database 12, and then run the standby application 21 and the standby database 22 on the standby machine 2, and this step is terminated; if the running status of the main application 11 is normal at this time, the main application 11 has been repaired, and return to step 1: enable the host 1 to continuously monitor whether the service status of the main application 11 is normal; Step 3: First detect the running status of the main database 12. The test result of the main database 12 is that the running status is abnormal or the running status is normal. If the running status of the main database 12 is normal, proceed to step 4. If the running status of the main database 12 is abnormal, restart the main database 12 first, and then detect the running status of the main database 12. If the running status of the main database 12 is abnormal at this time, suspend the running of the main application 11 and the main database 12, and then run the standby application 21 and the standby database 22 on the standby machine 2, and this step is terminated. If the running status of the main database 12 is normal at this time, the main database 12 has been repaired, and return to step 1: enable the host 1 to continuously monitor whether the service status of the main application 11 is normal. Step 4: First check whether the network from host 1 to the same network segment device of the business network and the network from host 1 to standby machine 2 are connected. If the network is not connected, first connect host 1 and standby machine 2 through a network cable. If the network cable network between host 1 and standby machine 2 is not connected, host 1 has a fault, and then suspend the operation of the main application 11 and the main database 12, and then run the standby application 21 and the standby database 22 on standby machine 2, and this step is terminated; if the network cable network between host 1 and standby machine 2 is connected, first restart the main network card 13 of host 1, and then check whether the network from host 1 to the same network segment device of the business network and the network from host 1 to standby machine 2 are connected. If the network is connected at this time, the main network card 13 has been repaired, and the main application 11 and the main database 12 continue to run, and this step is terminated; if the network is not connected at this time, suspend the operation of the main application 11 and the main database 12, and then run the standby application 21 and the standby database 22 on standby machine 2, and this step is terminated.

[0047] Embodiment 2: The basic content is the same as that of Example 1, except that: See also Figure 1 — Figure 8In the first step, the host 1 continuously monitors whether the service status of the main application 11 is normal, which means that: the host 1 continuously monitors whether the service status of the main application 11 is normal, and the standby machine 2 continuously monitors whether the service status of the standby application 21 is normal. In the first step, when the standby machine 2 continuously monitors whether the service status of the standby application 21 is normal, if the service status of the standby application 21 is abnormal, the running status of the standby application 21 is first detected. If the running status of the standby application 21 is abnormal, the standby application 21 is first restarted, and then the running status of the standby application 21 is detected. If the running status of the standby application 21 is abnormal, the standby machine 2 is restarted, and then the log and alarm information are updated, and this step is terminated. In the first step, when the running status of the standby application 21 is detected, if the running status of the standby application 21 is normal, the running status of the standby database 22 is detected. If the running status of the standby database 22 is abnormal, the standby database 22 is restarted first, and then the running status of the standby database 22 is detected. If the running status of the standby database 22 is abnormal, the standby machine 2 is restarted, and then the log and alarm information are updated, and this step is terminated; in the first step, when the running status of the standby database 22 is detected, if the running status of the standby database 22 is normal, then check whether the network between the standby machine 2 and the equipment in the same network segment of the business network and between the standby machine 2 and the host 1 is connected. If the network is not connected, restart the standby network card 23, and then update the log and alarm information, and this step is terminated.

[0048] When the main application 11 is used, when the host 1 monitors whether the service status of the main application 11 is normal, the standby machine 2 is also monitoring the service status of the standby application 21 at the same time. When the service status of the standby application 21 is abnormal, the running status of the standby application 21 is first detected. If the running status of the standby application 21 is normal, the running status of the standby database is detected; if the running status of the standby application 21 is abnormal, the standby application 21 is restarted, and the running status of the standby application 21 is detected again. If the running status of the standby application 21 is abnormal, the standby machine 2 is restarted, and the log and alarm information are updated, and this step is terminated; when the running status of the standby database 22 is detected, if the service status of the standby database 22 is normal, the standby machine 2 is connected to the main application 11. Check whether the network between the service network and the network segment equipment, and the network between the standby machine 2 and the host 1 is connected; if the service status of the standby database 22 is abnormal, restart the standby database 22 first, and then check the operating status of the standby database 22. If the operating status of the standby database 22 is abnormal, restart the standby machine 2, and then update the log and alarm information, and this step terminates; check whether the network between the standby machine 2 and the service network and the network segment equipment, and between the standby machine 2 and the host 1 is connected. If the network is not connected, restart the standby network card 23, and then update the log and alarm information; regularly check the service status of the standby application 21 to avoid failures of the standby application 21, and ensure that the standby application 21 can promptly replace the main application 11 with abnormal service status.

[0049] Embodiment 3: The basic content is the same as that of Example 1, except that: See also Figure 1 — Figure 8 , in the fourth step, the detection of whether the network from host 1 to the device on the same network segment of the business network and the network from host 1 to standby machine 2 are connected means: detecting whether the network from host 1 to the device on the same network segment of the business network and the network from host 1 to standby machine 2 are connected, and the standby machine 2 detects whether the network from host 1 to the device on the same network segment of the business network and the network from host 1 to standby machine 2 are connected. In the fourth step, when the network from host 1 to the device on the same network segment of the business network and the network from host 1 to standby machine 2 are not connected, if the network from standby machine 2 to the device on the same network segment of the business network is connected, and the service status of standby application 21 is normal, but the network from standby machine 2 to host 1 is not connected and the network cable network from standby machine 2 to host 1 is not connected, then host 1 is faulty.

[0050] During application, when host 1 monitors whether the network to the equipment on the same network segment of the business network is connected and whether the network to standby machine 2 is connected, standby machine 2 is also monitoring whether the network to the equipment on the same network segment of the business network is connected and whether the network to standby machine 2 is connected, so as to form a double monitoring of the network of host 1; if the network to the equipment on the same network segment of the business network from standby machine 2 is connected, and the service status of standby application 21 and standby database 22 is normal, it means that the network of standby machine 2 is normal. If the network to the equipment on the same network segment of the business network from host 1 is not connected and the network to standby machine 2 is not connected, it means that there is a fault in host 1.

[0051] Embodiment 4: The basic content is the same as that of Example 1, except that: See also Figure 1 — Fig. 9 In the second step, after running the standby application 21 and the standby database 22 on the standby machine 2, the standby machine 2 is marked as the host 1, and at the same time, the original host 1 is marked as the standby machine 2, and then the standby machine 2 is restarted, and then the log is updated, and then the alarm information is updated, and this step is terminated; in the third step, after running the standby application 21 and the standby database 22 on the standby machine 2, the standby machine 2 is marked as the host 1, and at the same time, the original host 1 is marked as the standby machine 2, and then the standby machine 2 is restarted, and then the log is updated, and then the alarm information is updated, and this step is terminated; in the fourth step, after running the standby application 21 and the standby database 22 on the standby machine 2, the standby machine 2 is marked as the host 1, and at the same time, the original host 1 is marked as the standby machine 2, and then the standby machine 2 is restarted, and then the log is updated, and then the alarm information is updated, and this step is terminated. In the second step, after the alarm information is updated, the standby machine 2 is repaired again, and then the host 1 or standby machine 2 is selected to provide the service, and this step is terminated; in the third step, after the alarm information is updated, the standby machine 2 is repaired again, and then the host 1 or standby machine 2 is selected to provide the service, and this step is terminated; in the fourth step, after the alarm information is updated, the standby machine 2 is repaired again, and then the host 1 or standby machine 2 is selected to provide the service, and this step is terminated.

[0052] When applied, after marking the original host 1 as standby 2, the exchange of the original host 1 and the original standby 2 is completed, that is, the original host 1 becomes standby 2, and the original standby 2 becomes the host 1. At this time, the original standby 2 replaces the original host 1 for service, and standby 2 (the original host 1) fails. The fault situation of standby 2 is updated to the log, and then an alarm message is issued. The maintenance personnel then repairs standby 2 based on the alarm message and log. After standby 2 is repaired, host 1 or standby 2 is selected to provide service.

[0053] Embodiment 5: The basic content is the same as that of Example 1, except that: See also Figure 1 — Fig.10 , in the first step, synchronizing the data of the host 1 to the standby 2 means: first setting the service network IP, client access service IP, network cable IP, host name, service name of the main application 11, and service name of the main database 12 of the host 1 in sequence; then setting the service network IP, client access service IP, network cable IP, standby name, service name of the standby application 21, and service name of the standby database 22 of the standby 2, then specifying the host 1 and the standby 2, and then synchronizing the data of the host 1 to the standby 2. In the first step, making the main application 11 and the main database 12 on the host 1 run means: synchronizing the data of the main database 12 to the standby database 22 regularly or periodically; in the first step, when making the main application 11 and the main database 12 on the host 1 run, switching operations are performed regularly or periodically, and the switching operations are: first stopping the service of the main application 11 and the main database 12, then making the standby application 21 and the standby database 22 provide services, then stopping the service of the standby application 21 and the standby database 22, and then making the main application 11 and the main database 12 provide services.

[0054] When applying, first set the service network IP, client access service IP, network cable IP, host name, main application 11 service name, and main database 12 service name of host 1 in sequence; then set the service network IP, client access service IP, network cable IP, standby machine name, standby application 21 service name, and standby database 22 service name of standby machine 2, so that host 1 and standby machine 2 can communicate in the service network, and then specify host 1 and standby machine 2, that is, specify host 1 for service and standby machine 2 as standby; when host 1 is providing service, it is necessary to regularly or periodically update the data of main database 12 The data is synchronized to the standby database 22 to ensure the data consistency between the main database 12 and the standby database 22 to prevent the main application 11 from running into errors; when the host 1 is providing services, it is also necessary to perform switching operations regularly or periodically to verify the availability of the standby machine 2 to prevent the standby machine 2 from being unavailable when the host 1 is unavailable. The switching operation is: first stop the main application 11 and the main database 12, then make the standby application 21 and the standby database 22 provide services for a period of time, then stop the standby application 21 and the standby database 22, and then make the main application 11 and the main database 12 continue to provide services.

[0055] Embodiment 6: The basic content is the same as that of Example 1, except that: See also Figure 1 — Fig.11 In the first step, the method includes a system 3, and the system 3 includes a fault detection module 31, a switching control module 32, an application switching module 33, a database switching module 34, a data synchronization module 35, a switching recovery module 36, a logging module 37, a fault self-healing module 38 and a standby machine switching verification module 39.

[0056] When the system 3 is applied to an e-commerce system, the fault detection module 31 is used to monitor the service status of the main application 11. When the fault detection module 31 detects that the service status of the main application 11 is abnormal, the fault detection module 31 first detects the running status of the main application 11. If the running status of the main application 11 is normal, the fault detection module 31 detects the running status of the main database 12; if the running status of the main application 11 is abnormal, the fault detection module 31 sends a command to the switching control module 32, and the switching control module 32 sends a command to notify the application switching module 33 according to the set switching strategy. The application switching module 33 sends a command to the fault self-healing module 38, and the fault self-healing module 38 restarts the main application 11. After the restart, If the running state of the main application 11 is abnormal, the application switching module 33 enables the backup machine 2 to provide services; if the running state of the main application 11 is normal after restart, the main application 11 has been repaired; when the fault detection module 31 detects the running state of the main database 12, if the running state of the main database 12 is normal, the fault detection module 31 detects whether the network from the host 1 to the equipment in the same network segment of the business network and the network from the host 1 to the backup machine 2 are connected; if the running state of the main database 12 is abnormal, the fault detection module 31 sends a command to the switching control module 32, and the switching control module 32 sends a command to notify the database switching module 34 according to the set switching strategy, and the database switching module 34 sends a command to the fault self-healing module 38, and the fault self-healing Module 38 restarts the main database 12. If the operating status of the main database 12 is abnormal after the restart, the application switching module 33 enables the backup machine 2 to provide services. If the operating status of the main database 12 is normal after the restart, the main database 12 has been repaired. The fault detection module 31 detects whether the network from the host 1 to the equipment in the same network segment of the business network and the network from the host 1 to the backup machine 2 are connected. If the network is not connected and the network cable from the host 1 to the backup machine 2 is not connected, the fault detection module 31 sends a command to the switching control module 32. The switching control module 32 then sends a command to notify the application switching module 33 and the database switching module 34 according to the set switching strategy. The application switching module 33 and the database switching module 34 enable the backup machine 2 to provide services. If If the network cable from the host 1 to the standby machine 2 is connected, the fault detection module 31 sends a command to the switching control module 32, and the switching control module 32 then notifies the fault self-healing module 38 according to the sent command, and the fault self-healing module 38 restarts the main network card 13, and then the fault detection module 31 detects whether the network from the host 1 to the network device in the same network segment of the business network and the network from the host 1 to the standby machine 2 are connected. If the network is connected, the main network card 13 has been repaired; if the network is not connected, the fault detection module 31 sends a command to the switching control module 32, and the switching control module 32 sends a command to notify the application switching module 33 and the database switching module 34 according to the set switching strategy, and the application switching module 33 and the database switching module 34 enable the standby machine 2 to provide services;When the system 3 is running, the data synchronization module 35 will regularly synchronize the data of the main database 12 to the standby database 22 to ensure data integrity; the log recording module 37 will record faults such as abnormal service status and the switching process, results and impact of the main machine 1 and the standby machine 2 for analysis and improvement by maintenance personnel; the fault self-healing module 38 can restart the main machine 1, the standby machine 2 or the program therein to complete certain fault repairs; after the fault is eliminated, the switching recovery module 36 can be used to set the main machine 1 or the standby machine 2 to provide services; the standby machine switching verification module 39 is used to switch between the main machine 1 and the standby machine 2 regularly or during the business off-peak period to verify the availability of the standby machine 2. ;

[0057] The above description is only a preferred embodiment of the present invention, and the protection scope of the present invention is not limited to the above embodiment. Any equivalent modifications or changes made by ordinary technicians in this field based on the contents disclosed by the present invention should be included in the protection scope recorded in the claims.

Claims

1. A method for automatic switching when an application service state is abnormal, the application comprising a main application (11) and a backup application (21), the main application (11) being located on a host machine (1), and the backup application (21) being located on a backup machine (2), characterized in that: The method comprises the following steps: Step 1: First, synchronize the data of the host (1) to the backup machine (2), and then run the main application (11) and the main database (12) on the host (1); then, make the host (1) continuously monitor whether the service status of the main application (11) is normal. If the service status of the main application (11) is abnormal, proceed to step 2; Step 2: first detect the running status of the main application (11), and the test result of the main application (11) is that the running status is abnormal or the running status is normal; if the running status of the main application (11) is normal, then proceed to step 3; if the running status of the main application (11) is abnormal, then restart the main application (11), and then detect the running status of the main application (11). If the running status of the main application (11) is abnormal at this time, then suspend the running of the main application (11) and the main database (12), and then run the standby application (21) and the standby database (22) on the standby machine (2), and this step is terminated; if the running status of the main application (11) is normal at this time, then the main application (11) has been repaired, and return to step 1: enable the host (1) to continuously monitor whether the service status of the main application (11) is normal; Step 3: first detect the running status of the main database (12), and the test result of the main database (12) is that the running status is abnormal or the running status is normal; if the running status of the main database (12) is normal, then enter the fourth step; if the running status of the main database (12) is abnormal, first restart the main database (12), and then detect the running status of the main database (12). If the running status of the main database (12) is abnormal at this time, then suspend the running of the main application (11) and the main database (12), and then run the standby application (21) and the standby database (22) on the standby machine (2), and this step is terminated; if the running status of the main database (12) is normal at this time, the main database (12) has been repaired, and return to the first step: enable the host (1) to continuously monitor whether the service status of the main application (11) is normal; Step 4: First check whether the network between the host (1) and the equipment in the same network segment of the business network and the network between the host (1) and the backup machine (2) are connected. If the network is not connected, first connect the host (1) and the backup machine (2) through a network cable. If the network cable between the host (1) and the backup machine (2) is not connected, the host (1) has a fault, and then suspend the operation of the main application (11) and the main database (12), and then run the backup application (21) and the backup database (22) on the backup machine (2), and this step ends; if the network cable between the host (1) and the backup machine (2) is not connected, If the network is connected, first restart the main network card (13) of the host (1), and then check whether the network from the host (1) to the equipment in the same network segment of the business network and the network from the host (1) to the backup machine (2) are connected. If the network is connected at this time, the main network card (13) has been repaired, and the main application (11) and the main database (12) continue to run, and this step is terminated; if the network is not connected at this time, the main application (11) and the main database (12) are suspended, and then the backup application (21) and the backup database (22) on the backup machine (2) are run, and this step is terminated.

2. According to claim 1, the automatic switching method when the application service status is abnormal is characterized in that: In the first step, the host (1) continuously monitors whether the service status of the main application (11) is normal, which means: the host (1) continuously monitors whether the service status of the main application (11) is normal, and the backup machine (2) continuously monitors whether the service status of the backup application (21) is normal.

3. The automatic switching method when the application service status is abnormal according to claim 2 is characterized in that: In the first step, the standby machine (2) continuously monitors whether the service status of the standby application (21) is normal. If the service status of the standby application (21) is abnormal, the operating status of the standby application (21) is first detected. If the operating status of the standby application (21) is abnormal, the standby application (21) is first restarted, and then the operating status of the standby application (21) is detected. If the operating status of the standby application (21) is abnormal, the standby machine (2) is restarted, and then the log and alarm information are updated, and this step is terminated.

4. The automatic switching method when the application service status is abnormal according to claim 3 is characterized in that: In the first step, when detecting the running state of the standby application (21), if the running state of the standby application (21) is normal, then detecting the running state of the standby database (22); if the running state of the standby database (22) is abnormal, first restarting the standby database (22), then detecting the running state of the standby database (22); if the running state of the standby database (22) is abnormal, restarting the standby machine (2), then updating the log and alarm information, and terminating this step; In the first step, when the operating status of the standby database (22) is detected, if the operating status of the standby database (22) is normal, then the network between the standby machine (2) and the equipment in the same network segment of the business network and between the standby machine (2) and the host (1) is detected to be connected. If the network is not connected, the standby network card (23) is restarted, and the log and alarm information are updated, and this step is terminated.

5. The automatic switching method when the application service status is abnormal according to claim 1 is characterized in that: In the fourth step, the detection of whether the network from the host (1) to the device on the same network segment of the service network and the network from the host (1) to the backup machine (2) are connected refers to: detecting whether the network from the host (1) to the device on the same network segment of the service network and the network from the host (1) to the backup machine (2) are connected, and the backup machine (2) detecting whether the network from the host (1) to the device on the same network segment of the service network and the network from the host (1) to the backup machine (2) are connected.

6. The automatic switching method when the application service status is abnormal according to claim 5, characterized in that: In the fourth step, when the network from the host (1) to the device in the same network segment of the service network and the network from the host (1) to the backup machine (2) are disconnected, if the network from the backup machine (2) to the device in the same network segment of the service network is connected, and the service status of the backup application (21) is normal, but the network from the backup machine (2) to the host (1) is disconnected and the network cable network from the backup machine (2) to the host (1) is disconnected, then the host (1) has a fault.

7. The automatic switching method when the application service status is abnormal according to claim 1 is characterized in that: In the second step, after the standby application (21) and the standby database (22) on the standby machine (2) are run, the standby machine (2) is marked as the master machine (1), and at the same time, the original master machine (1) is marked as the standby machine (2), and then the standby machine (2) is restarted, the log is updated, and then the alarm information is updated, and this step is terminated; In the third step, after the standby application (21) and the standby database (22) on the standby machine (2) are run, the standby machine (2) is marked as the master machine (1), and at the same time, the original master machine (1) is marked as the standby machine (2), and then the standby machine (2) is restarted, the log is updated, and then the alarm information is updated, and this step is terminated; In the fourth step, after running the standby application (21) and the standby database (22) on the standby machine (2), the standby machine (2) is marked as the host machine (1). At the same time, the original host machine (1) is marked as the standby machine (2). The standby machine (2) is then restarted, the log is updated, and the alarm information is updated. This step is terminated.

8. The automatic switching method when the application service status is abnormal according to claim 7, characterized in that: In the second step, after the alarm information is updated, the standby machine (2) is repaired, and then the main machine (1) or the standby machine (2) is selected to provide service, and this step is terminated; In the third step, after the alarm information is updated, the standby machine (2) is repaired, and then the host machine (1) or the standby machine (2) is selected to provide service, and this step is terminated; In the fourth step, after the alarm information is updated, the standby machine (2) is repaired, and then the main machine (1) or the standby machine (2) is selected to provide service, and this step is terminated.

9. The automatic switching method when the application service status is abnormal according to claim 1, characterized in that: In the first step, synchronizing the data of the host (1) to the backup machine (2) means: first setting the service network IP, client access service IP, network cable IP, host name, main application (11) service name, and main database (12) service name of the host (1) in sequence; then setting the service network IP, client access service IP, network cable IP, backup machine name, backup application (21) service name, and backup database (22) service name of the backup machine (2); then specifying the host (1) and the backup machine (2); and then synchronizing the data of the host (1) to the backup machine (2).

10. The automatic switching method when the application service status is abnormal according to claim 9, characterized in that: In the first step, the operation of the main application (11) and the main database (12) on the host (1) refers to: synchronizing the data of the main database (12) to the standby database (22) on a regular or periodic basis; In the first step, when the main application (11) and the main database (12) on the host (1) are running, a switching operation is performed regularly or periodically. The switching operation is: first, the main application (11) and the main database (12) are stopped from serving, and then the standby application (21) and the standby database (22) are started. Then, the standby application (21) and the standby database (22) are stopped from serving, and then the main application (11) and the main database (12) are started from serving.