Search

CN-115454762-B - System monitoring and upgrading method, electronic device and computer readable storage medium

CN115454762BCN 115454762 BCN115454762 BCN 115454762BCN-115454762-B

Abstract

The application discloses a system monitoring and upgrading method, electronic equipment and a computer readable storage medium, wherein the method comprises the steps of obtaining a starting instruction, executing a monitoring process of the starting instruction starting system, starting each sub-service in the system by utilizing the monitoring process, and carrying out health monitoring on each sub-service to obtain at least one round of health monitoring result; the method comprises the steps of starting a system in response to the condition that a health monitoring result of a first preset round is abnormal, starting the system in response to the condition that an upper application of the system calls an application program interface, obtaining an upgrade package of the system by using the application program interface, backing up a current installation package of the system to obtain a backup version, loading the upgrade package by using a timing task of the system to upgrade the system, restarting the system after the upgrade is completed, returning to obtain a starting instruction, and rolling back the system to the backup version in response to the condition that the health monitoring result of a second preset round is abnormal, wherein the second preset round is after the system is upgraded. By means of the scheme, the convenience and stability of system use can be improved.

Inventors

  • ZHENG YICHUN
  • CHEN FEIYANG
  • JIANG DAXIU
  • LIU XINGWANG

Assignees

  • 浙江大华技术股份有限公司

Dates

Publication Date
20260512
Application Date
20220809

Claims (9)

  1. 1. A system monitoring and upgrading method, the method comprising: Acquiring a starting instruction, executing the starting instruction to start a monitoring process of a system, starting each sub-service in the system by using the monitoring process, and performing health monitoring on each sub-service to acquire at least one round of health monitoring results; restarting the system in response to the health monitoring result of the first preset round being abnormal; Responding to an upper layer application of the system to call an application program interface, obtaining an upgrade package of the system by using the application program interface, backing up a current installation package of the system to obtain a backup version, loading the upgrade package by using a timing task of the system to upgrade the system, restarting the system after the upgrade is completed, and returning to the step of obtaining a starting instruction; Rolling back the system to the backup version in response to the abnormal health monitoring result of a second preset round, wherein the second preset round is after the system is upgraded; The system is constructed based on a container and a container management tool, the system runs on the container, the monitoring process is bound with the container of the system, the monitoring process is used as an inlet script of the container of the system and is bound with the container of the system, the upgrade package and the installation package are generated based on mirror images of the container, the upgrade package and the installation package correspond to mirror image names matched with the mirror images, and the container management tool is used for executing the starting instruction, so that the container corresponding to the system and the monitoring process bound by the container are started, and the monitoring process is used for acquiring communication requests of the sub-service to perform health monitoring on the sub-service.
  2. 2. The system monitoring and upgrading method according to claim 1, wherein the obtaining a start instruction, executing the start instruction to start a monitoring process of a system, starting each sub-service in the system by using the monitoring process, and performing health monitoring on each sub-service to obtain at least one round of health monitoring results, includes: Acquiring a starting instruction, executing the starting instruction by using the container management tool, and starting a container corresponding to the system and a bound monitoring process thereof; invoking a start command of each sub-service by using the monitoring process, and starting each sub-service in the system; Receiving communication requests of all sub-services, and determining health monitoring results of the current round based on the communication requests of the current round to obtain at least one round of health monitoring results; And responding to the health monitoring result of the current round as normal, entering the health monitoring of the next round, returning to receiving the communication request of each sub-service, and determining the health monitoring result of the current round based on the communication request of the current round.
  3. 3. The system monitoring and upgrading method according to claim 2, wherein when any sub-service fails to be started by the monitoring process, the health monitoring result of the first round after the system is started is abnormal; The step of receiving the communication request of each sub-service, and determining the health monitoring result of the current round based on the communication request of the current round, and after obtaining at least one round of health monitoring result, further comprises: Responding to the current round as the first preset round and the health monitoring result as abnormal, exiting the monitoring process to enable the container bound by the monitoring process to exit, and returning a first error code, wherein the first preset round is other rounds different from the first round, the first error code is related to the communication request of the first preset round with abnormal, or And responding to the current round as the second preset round and the health monitoring result as the abnormality, exiting the monitoring process to enable the container bound by the monitoring process to exit, and returning a second error code, wherein the second preset round is the first round and after the system is upgraded, the second error code is related to the abnormality of the communication request of the second preset round.
  4. 4. The system monitoring and upgrading method according to claim 3, wherein restarting the system in response to the health monitoring result of the first preset round being abnormal comprises: responsive to obtaining the first error code, restarting a container corresponding to the system and a bound monitoring process thereof by using the container management tool; And in response to the health monitoring result of the second preset round being abnormal, rolling back the system to the backup version, including: And in response to obtaining the second error code, loading an installation package of the backup version by using a timing task of the system, and rolling back the system to the backup version.
  5. 5. The system monitoring and upgrade method according to claim 1, wherein the upgrade package corresponds to a link address available for download on a storage platform of the system.
  6. 6. The system monitoring and upgrading method according to claim 5, wherein the mirror name corresponding to the current installation package of the system is a first name, the responding to the upper layer application call application program interface of the system, obtaining the upgrade package of the system by using the application program interface, backing up the current installation package of the system, obtaining a backup version, loading the upgrade package by using the timing task of the system, and upgrading the system, including: Responding to an upper layer application of the system to call an application program interface, and downloading the upgrade package from the link address by utilizing the application program interface; modifying a first name corresponding to a current installation package of the system into a second name, and backing up the second name corresponding to the current installation package to obtain a backup version corresponding to the current installation package of the system; modifying the mirror name corresponding to the upgrade package into the first name, wherein the first name is the same as the mirror name corresponding to the initial installation package of the system; invoking the container management tool after a preset time interval by utilizing a timing task of the system, and designating a configuration file by utilizing the container management tool, wherein the configuration file is defined with a rule for acquiring images based on the first name; and loading the mirror image corresponding to the upgrade package according to the first name based on the rule defined by the configuration file, and upgrading the system.
  7. 7. The system monitoring and upgrade method of claim 6, wherein the rolling back the system to the backup version comprises: Determining a backup version corresponding to the installation package based on the second name corresponding to the installation package; removing an upgrade record corresponding to the upgrade package, and modifying a second name of the installation package into the first name, wherein the upgrade record comprises a mirror name of the upgrade package; Invoking the container management tool after a preset time interval by utilizing a timing task of the system, and designating the configuration file by utilizing the container management tool; and loading the mirror image corresponding to the installation package according to the first name based on the rule defined by the configuration file, and rolling back the system.
  8. 8. An electronic device comprising a memory and a processor coupled to each other, wherein the memory stores program data and the processor invokes the program data to perform the method of any of claims 1-7.
  9. 9. A computer readable storage medium having stored thereon program data, which when executed by a processor implements the method of any of claims 1-7.

Description

System monitoring and upgrading method, electronic device and computer readable storage medium Technical Field The present application relates to the field of system management technologies, and in particular, to a system monitoring and upgrading method, an electronic device, and a computer readable storage medium. Background With the increasing intensity of functions supported by various systems, how to perform health monitoring on the system and how to upgrade the system after the function is updated are becoming important, in the prior art, a system developer is usually required to monitor the system regularly to acquire monitoring data to determine the health condition of the system, and when the system needs to be upgraded, the system developer is required to access a server side of the system to provide service support, and an upgrade package is specified to upgrade the system, so that the health monitoring and the upgrade of the system are inconvenient, and meanwhile, a necessary detection means is not required for whether the upgrade package is matched with the system, so that the upgraded system may not be used, and the stability of the system is affected. In view of this, how to improve the convenience and stability of the system is a urgent problem to be solved. Disclosure of Invention The application mainly solves the technical problem of providing a system monitoring and upgrading method, electronic equipment and a computer readable storage medium, which can improve the convenience and stability of system use. In order to solve the technical problems, the first aspect of the application provides a system monitoring and upgrading method, which comprises the steps of obtaining a starting instruction, executing a monitoring process of the starting instruction to start a system, starting each sub-service in the system by utilizing the monitoring process, carrying out health monitoring on each sub-service to obtain at least one round of health monitoring results, restarting the system in response to the fact that the health monitoring result of a first preset round is abnormal, calling an application program interface by utilizing an upper application of the system, obtaining an upgrading package of the system by utilizing the application program interface, backing up the current installation package of the system to obtain a backup version, loading the upgrading package by utilizing a timing task of the system to upgrade the system, restarting the system after upgrading is completed and returning the starting instruction, and rolling the system back to the backup version in response to the fact that the health monitoring result of a second preset round is abnormal, wherein the second preset round is after the system is upgraded. To solve the technical problem, a second aspect of the present application provides an electronic device, which includes a memory and a processor coupled to each other, wherein the memory stores program data, and the processor invokes the program data to execute the method described in the first aspect. To solve the above technical problem, a third aspect of the present application provides a computer storage medium having stored thereon program data which when executed by a processor implements the method described in the first aspect. According to the scheme, after the starting instruction is obtained, the starting instruction is executed to start the monitoring process of the system, each sub-service of the system is started by the monitoring process, and health monitoring is carried out on each sub-service by the monitoring process, so that the system is immediately subjected to health monitoring after the system is started, at least one round of health monitoring results can be obtained by the monitoring process, the convenience of health monitoring of the system is improved, when the health monitoring results of a first preset round are abnormal, the system is restarted so as to be capable of attempting to recover the functions of the system, the stability of the system is improved, when an upper layer application calls an application program interface, the upgrade package of the system is obtained by using the application program interface, so that a user side can independently obtain the upgrade package, the convenience of obtaining the upgrade package is improved, meanwhile, the current installation package of the system is backed up, the backup version of the installation package is obtained, the upgrade package is loaded by using the timing task of the system, the system is updated, the system is conveniently obtained by the timing task of the system, the upgrade package of the system is updated, the system is continuously monitored by the system after the upgrade, the system is finished, the health monitoring of the system is restarted, the system is ensured to be capable of being used for recovering the health monitoring of the system when the second preset rou