Method and system for inspecting service state and realizing self-starting
By configuring the detection module, self-start module and fault information retention module in the server, the automatic detection and self-start function is realized, and the problem of difficulty in detecting "fake death" state in the existing technology is solved, and the system stability and operation and maintenance efficiency are improved.
Patent Information
- Application Number
- CN202510201323.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-24
- Publication Date
- 2025-05-30
AI Technical Summary
The prior art is difficult to effectively detect whether the server is in a "fake death" state, resulting in misjudgment and service interruption, increasing the workload of operation and maintenance personnel.
By configuring the detection module, self-start module and fault information retention module, we realize regular operation of service detection scripts, detect port and interface status, automatically record fault information and trigger the self-start module to achieve automatic restart.
It improves the stability of system operation, reduces the workload of operation and maintenance personnel, ensures the accuracy of service status detection, and promptly notifies maintenance personnel to deal with faults.
Smart Images

Figure CN120066858A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of information systems, and more particularly to a method and system for inspecting service status and realizing self-starting. Background Art
[0002] With the rapid development of information technology, servers and devices have been widely used in various fields. However, these servers and devices may encounter various failures or anomalies during operation, resulting in service interruptions, which brings great pressure to operation and maintenance personnel to rely on manpower to start various programs and middleware. In order to ensure the continuity and stability of services, it is necessary to automatically detect whether the service is normal and automatically start when an anomaly occurs, so as to reduce the large workload of operation and maintenance personnel.
[0003] The service detection status generally uses the method of detecting ports to determine whether it is normal, but there is a probability that the service will be in a "false death" state where the port starts normally but the interface cannot be used. Therefore, relying solely on port detection will lead to misjudgment. Summary of the Invention
[0004] The technical task of the present invention is to address the above deficiencies and provide a method and system for inspecting service status and realizing self-starting, which can detect anomalies in a timely manner and automatically restart when the server crashes or the service has an anomaly, improving the stability of system operation.
[0005] The technical solution adopted by the present invention to solve its technical problems is as follows:
[0006] A method for inspecting service status and realizing self-starting, including a detection module, a self-starting module, and a fault information retention module; the implementation of this method includes the following steps:
[0007] 1) Configure the deployment content of each server, and configure the scripts of the detection module, the self-starting module, and the fault information retention module;
[0008] 2) Set the server scheduled task to regularly run the service detection script;
[0009] 3) The service detection script conducts port and interface inspections on the content running on the server;
[0010] 4) When an anomaly occurs, output the relevant fault information such as server logs, CPU usage, memory usage, disk usage, and service logs to a fault information file for preservation;
[0011] 5) After the relevant fault information is retained, trigger the service self-starting module, the service is automatically restarted and the restart result is notified to the maintenance personnel; if the restart is successful, the relevant maintenance personnel record the anomaly, and if the restart fails, personnel need to view and repair it and then perform a manual restart and record the anomaly.
[0012] Further, for the configuration detection module script, the auto-start module script, and the fault information retention module script,
[0013] Based on all the content in the online environment, write a set of detection scripts, auto-start scripts, and fault information export scripts for all deployment content;
[0014] For middleware, databases, etc., determine whether the service is normal by detecting the port; since the service may enter a "false dead" state during operation, for service applications such as Java and GO, determine whether the service is normal by detecting the port + heartbeat interface or by detecting the built-in detection interface of the service in advance, and judge whether the service is normal by judging the interface return.
[0015] Further, through the scheduled task function of the server, set to run the detection script regularly and record the detection results; the detection frequency is set according to the server running environment.
[0016] Further, for the detection frequency, it is preset to detect once every 5 minutes.
[0017] Further, the service detection script conducts port and detection interface inspections on the content running on the server,
[0018] Detect the status of services, middleware, and databases through the detection script. When situations such as the port not starting or the detection interface returning an exception occur, the exception detection module script determines a fault and automatically starts or restarts the relevant service.
[0019] Further, before restarting the service, to enable subsequent maintenance personnel to understand the fault situation, output the service log and environment information to the fault log, and perform packaging and compression backup processing;
[0020] The environment information includes CPU, memory, and disk usage.
[0021] Further, according to the preset start strategy of the auto-start module, automatically restart or start the service; if it starts normally, send information such as the name of the faulty application, time, and auto-start result to the maintenance personnel for abnormal situation recording; if the start fails, notify the maintenance personnel to check and repair, perform a manual restart to solve the problem, and record the abnormality;
[0022] The preset start strategy of the auto-start module presets the start order according to the dependency relationship between services.
[0023] The present invention also claims to protect a system for inspecting the service status and implementing auto-start, including a detection module, an auto-start module, and a fault information retention module;
[0024] The detection module is used to conduct inspections on ports and detection interfaces of the content running on the server;
[0025] The self - startup module is used to automatically restart or start the service according to the preset startup strategy;
[0026] The fault information retention module is used to output relevant fault information to a fault information file for preservation when an exception occurs;
[0027] This system realizes the inspection of the service status and self - startup through the above - mentioned method.
[0028] The present invention also claims to protect a device for inspecting the service status and realizing self - startup, including at least one memory and at least one processor;
[0029] The at least one memory is used to store machine - readable programs;
[0030] The at least one processor is used to call the machine - readable program to implement the above - mentioned method.
[0031] The present invention also claims to protect a computer - readable medium, on which computer instructions are stored, and when the computer instructions are executed by a processor, the processor realizes the above - mentioned method.
[0032] Compared with the prior art, the method and system for inspecting the service status and realizing self - startup of the present invention have the following beneficial effects:
[0033] The detection and self - startup method proposed by the present invention is automatically carried out through the preset detection module and self - startup module scripts, reducing the workload of operation and maintenance personnel.
[0034] The present invention detects the status of the service by means of ports + built - in detection interfaces of the service to ensure the accuracy of detection.
[0035] In addition to the detection and self - startup modules, the present invention also retains the fault information in a timely manner, and notifies relevant maintenance personnel to confirm the results after a fault occurs and the self - startup is completed, improving the stability of the system operation. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 It is a flowchart showing the method for inspecting the service status and realizing self - startup provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0037] The following further describes the present invention with reference to specific embodiments.
[0038] An embodiment of the present invention provides a method for inspecting the service status and realizing self - startup, including a detection module, a self - startup module, and a fault information retention module; the implementation of this method includes the following steps:
[0039] 1. Configure the deployment content of each server, and configure the detection module script, the self-start module script, and the fault information retention module script.
[0040] 2. Set the server's scheduled task to regularly run the service detection script.
[0041] 3. The service detection script patrols the ports and detection interfaces of the content running on the server.
[0042] 4. When an exception occurs, output the relevant fault information such as the server log, CPU usage, memory usage, disk usage, and service log to the fault information file for preservation.
[0043] 5. When the relevant fault information is retained, trigger the service self-start module. The service will be automatically restarted and the restart result will be notified to the maintenance personnel; if the restart is successful, the relevant maintenance personnel will record the exception. If the restart fails, the personnel need to view and repair it and then perform a manual restart and record the exception.
[0044] Combined with the attached Figure 1 As shown, the specific implementation of this method is as follows:
[0045] I. Configure the detection module script, the self-start module script, and the fault information retention module script.
[0046] According to all the content of the online environment, write a set of detection scripts, self-start scripts, and fault information export scripts for all deployment content;
[0047] For middleware, databases, etc., judge whether the service is normal by detecting the port; since the service may be in a "false dead" state during operation, for service applications such as Java and GO, judge whether the service is normal by detecting the port + heartbeat interface or detecting the built-in detection interface of the service in advance, and determine whether the service is normal by judging the interface return.
[0048] II. Run the detection script regularly.
[0049] Through the scheduled task function of the server, set to regularly run the detection script and record the detection results; the detection frequency is set according to the server running environment, and it is generally preset to detect once every 5 minutes.
[0050] III. Judge and respond to the detection environment status.
[0051] Detect the status of the service, middleware, and database through the detection script. When situations such as the port not starting or the detection interface returning an exception occur, the exception detection module script determines the fault and automatically starts or restarts the relevant service module.
[0052] IV. Retain the fault information.
[0053] Before the service is restarted, in order for subsequent maintenance personnel to understand the fault situation, the service log and environment information (CPU, memory, disk usage) are output to the fault log and then packaged and compressed for backup.
[0054] V. Service restart and notification.
[0055] According to the preset startup strategy of the self-start module (since there are dependencies between services, the startup order needs to be preset), the service is automatically restarted or started; if the startup is normal, information such as the name of the faulty application, time, and self-start result is sent to the maintenance personnel via email for abnormal situation recording; if the startup fails, the maintenance personnel need to be notified in the form of an email to check and repair, and a manual restart is performed to solve the problem, and an abnormal record is made.
[0056] An embodiment of the present invention further provides a system for inspecting the service status and implementing self-start, including a detection module, a self-start module, and a fault information retention module;
[0057] The detection module is used to inspect the ports and detection interfaces of the content running on the server;
[0058] The self-start module is used to implement automatically restarting or starting the service according to the preset startup strategy;
[0059] The fault information retention module is used to output relevant fault information to a fault information file for storage when an exception occurs;
[0060] This system realizes inspecting the service status and implementing self-start through the method of inspecting the service status and implementing self-start described in the above embodiment. The implementation process is as follows:
[0061] I. Configure the scripts of the detection module, the self-start module, and the fault information retention module.
[0062] According to all the content in the online environment, write a set of detection scripts, self-start scripts, and fault information export scripts for all deployed content;
[0063] For middleware, databases, etc., determine whether the service is normal by detecting the ports; since the service may be in a "frozen" state during operation, for service applications such as Java and GO, determine whether the service is normal by detecting the ports + heartbeat interfaces or detecting the built-in detection interfaces of the service in advance, and judge whether the service is normal by judging the interface return value.
[0064] II. Run the detection script regularly.
[0065] Through the scheduled task function of the server, set to run the detection script regularly and record the detection results; the detection frequency is set according to the server running environment, and it is generally preset to detect once every 5 minutes.
[0066] III. Detect the environmental status for judgment and response.
[0067] Detect the status of services, middleware, and databases through the detection script. When situations such as ports not starting or abnormal returns from detection interfaces occur, the abnormal detection module script determines the fault and automatically starts or restarts the relevant service modules.
[0068] IV. Retain fault information.
[0069] Before the service is restarted, to enable subsequent maintenance personnel to understand the fault situation, output the service logs and environmental information (CPU, memory, disk usage) to the fault log and perform packaging and compression backup processing.
[0070] V. Service restart and notification.
[0071] Automatically restart or start the service according to the preset startup strategy of the self-start module (since there are dependencies between services, the startup order needs to be preset); if the startup is normal, send information such as the name of the faulty application, time, and self-start result to the maintenance personnel via email for abnormal situation recording; if the startup fails, notify the maintenance personnel in the form of an email to check and repair, perform a manual restart to solve the problem, and record the abnormality.
[0072] An embodiment of the present invention also provides a device for inspecting the service status and implementing self-start, including at least one memory and at least one processor;
[0073] The at least one memory is used to store machine-readable programs;
[0074] The at least one processor is used to call the machine-readable program to implement the method for inspecting the service status and implementing self-start described in the above embodiment.
[0075] An embodiment of the present invention also provides a computer-readable medium, on which computer instructions are stored. When the computer instructions are executed by a processor, the processor is caused to execute the method for inspecting the service status and implementing self-start described in the above embodiment. Specifically, a system or device equipped with a storage medium can be provided, on which software program code for implementing the functions of any one of the above embodiments is stored, and the computer (or CPU or MPU) of the system or device is caused to read and execute the program code stored in the storage medium.
[0076] In this case, the program code read from the storage medium itself can implement the functions of any one of the above embodiments. Therefore, the program code and the storage medium storing the program code constitute a part of the present invention.
[0077] Examples of storage media for providing program code include floppy disks, hard disks, magneto-optical disks, optical disks (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD+RW), magnetic tapes, non-volatile memory cards, and ROMs. Optionally, the program code can be downloaded from a server computer via a communication network.
[0078] In addition, it should be clear that not only can the actual operations be completed in part or in whole by executing the program code read by the computer, but also by the operating system or the like operating on the computer based on the instructions of the program code, thereby implementing the functions of any one of the above embodiments.
[0079] In addition, it can be understood that the program code read from the storage medium is written into the memory provided in the expansion board inserted into the computer or into the memory provided in the expansion unit connected to the computer, and then the CPU or the like installed on the expansion board or the expansion unit is instructed to execute part or all of the actual operations based on the program code, thereby implementing the functions of any one of the above embodiments.
[0080] The present invention has been shown and described in detail above with reference to the drawings and preferred embodiments. However, the present invention is not limited to these disclosed embodiments. Based on the above-mentioned multiple embodiments, those skilled in the art can know that the code review means in different embodiments can be combined to obtain more embodiments of the present invention, and these embodiments are also within the protection scope of the present invention.
Claims
1. A method for inspecting service status and realizing self-starting, characterized in that: It includes a detection module, a self-starting module, and a fault information retention module; the implementation of the method includes the following steps: 1) Configure the deployment content of each server, configure the detection module script, the self-starting module script, and the fault information retention module script; 2) Set up server scheduled tasks and run service detection scripts regularly; 3) The service detection script inspects the ports and detection interfaces of the content running on the server; 4) When an exception occurs, the server log, CPU usage, memory usage, disk usage, and service log related fault information are output to the fault information file for storage; 5) When the relevant fault information is retained, the service self-start module is triggered, the service is automatically restarted and the restart result is notified to the maintenance personnel; if the restart is successful, the relevant maintenance personnel will record the exception; if the restart fails, the personnel will need to check and repair it, then restart manually and record the exception.
2. A method for inspecting service status and realizing self-starting according to claim 1, characterized in that: The configuration detection module script, the self-starting module script, and the fault information retention module script, According to all the contents of the online environment, write a set of detection scripts, self-starting scripts, and fault information export scripts for all deployed contents; The middleware and database determine whether the service is normal by detecting the port; Java and GO service applications determine whether the service is normal by checking the port + heartbeat interface or the built-in detection interface of the detection service in advance and judging the interface return.
3. A method for inspecting service status and realizing self-starting according to claim 1, characterized in that: Through the server's scheduled task function, set up regular detection scripts and record the detection results; the detection frequency is set according to the server's operating environment.
4. A method for inspecting service status and realizing self-starting according to claim 3, characterized in that: The detection frequency is preset to be once every 5 minutes.
5. A method for inspecting service status and realizing self-starting according to claim 1, characterized in that: The service detection script inspects the ports and detection interfaces of the content running on the server. The service, middleware and database status are detected through the detection script. When the port is not started or the detection interface returns an abnormal situation, the abnormal detection module script determines the fault and automatically starts the relevant service or restarts the module.
6. A method for inspecting service status and realizing self-starting according to claim 1 or 5, characterized in that: Before the service is restarted, the service log and environment information are output to the fault log and packaged, compressed and backed up; The environment information includes CPU, memory, and disk usage.
7. A method for inspecting service status and realizing self-starting according to claim 1, characterized in that: Automatically restart or start the service according to the preset startup strategy of the self-start module; if it starts normally, send the application name, time, and self-start result information of the fault to the maintenance personnel to record the abnormal situation; If the startup fails, notify the maintenance personnel to check and repair, and manually restart to solve the problem, and record the exception; The preset startup strategy of the self-starting module presets the startup sequence according to the dependencies between services.
8. A system for inspecting service status and realizing self-starting, characterized in that: Including detection module, self-starting module and fault information retention module; The detection module is used to inspect the ports and detection interfaces of the content running on the server; The automatic startup module is used to automatically restart or start the service according to the preset startup strategy; The fault information retention module is used to output the relevant fault information to the fault information file for storage when an abnormality occurs; The system implements the patrol service status and self-starting through any method described in claims 1 to 7.
9. A device for inspecting service status and realizing self-starting, characterized in that: comprising at least one memory and at least one processor; The at least one memory is used to store a machine-readable program; The at least one processor is used to call the machine-readable program to implement the method described in any one of claims 1 to 7.
10. A computer-readable medium, characterized in that The computer readable medium stores computer instructions, which, when executed by a processor, enable the processor to implement the method according to any one of claims 1 to 7.