Method and system for realizing micro-service one-key restart

The one-click restart of microservices is achieved through Nacos configuration monitoring and unified interface, which solves the problems of cumbersome and inefficient restart of traditional microservices, and improves operation and maintenance efficiency and accuracy.

CN120492049APending Publication Date: 2025-08-15INSPUR TIANYUAN COMM INFORMATION SYST CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510534922.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-27
Publication Date
2025-08-15

AI Technical Summary

Technical Problem

In the microservice architecture, traditional microservice restart operations are cumbersome, inefficient, error-prone, and rely on the server environment. The lack of a centralized management platform has led to increased operation and maintenance difficulties.

Method used

Based on Nacos configuration monitoring, create a special configuration file microservice_restart.properties, and monitor configuration changes through Nacos client to develop a unified operation and maintenance management interface to realize one-click restart of microservices.

Benefits of technology

Simplify operation and maintenance processes, shorten restart time, reduce error rate, improve operation and maintenance accuracy, and support unified management of multiple deployment environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120492049A_ABST
    Figure CN120492049A_ABST
Patent Text Reader

Abstract

The invention relates to the field of operation and maintenance management, and particularly provides a method and a system for realizing one-key restart of micro-services, which are based on Nacos configuration monitoring and are characterized in that firstly, a configuration file microservicestart.Properts specially used for restarting the micro-services is created in a Nacos configuration center, when each micro-service is started, registration is carried out in a Nacos registration center, and the change of the configuration file microservicestart.Properts is monitored through a Nacos client; and finally, a unified operation and maintenance management interface is developed, and the interface interacts with a Nacos configuration center. Compared with the prior art, the problems of low efficiency and poor reliability of traditional manual restart can be solved, and the automation level of micro-service operation and maintenance is remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of operation and maintenance management, and specifically provides a method and system for implementing one-click restart of microservices. Background Art

[0002] In a microservices architecture, there are numerous microservices deployed in clusters, with each service having multiple running instances. Currently, when restarting one or more microservices is necessary, the traditional approach is to log in to the server corresponding to each microservice and manually execute the restart command. For example, in a system that includes multiple microservices such as installation services, complaint services, and pay-per-use services, to restart the installation service, operations and maintenance personnel need to locate the multiple servers where the installation services are deployed, log in via SSH, and then execute a command such as sh startInstall.sh to restart the service. This approach has many disadvantages:

[0003] Complicated operations: There are many microservices and most of them are deployed in clusters. It is necessary to locate servers one by one and execute commands, which consumes a lot of time and effort.

[0004] Inefficiency: Multiple instances cannot be restarted in batches. Restarting each instance one by one results in a long overall restart time, affecting normal business operations.

[0005] Error-prone: Manual operations can easily miss certain microservices or execute incorrect commands due to negligence.

[0006] Dependence on the server environment: Different server environments may lead to inconsistent restart commands, increasing the difficulty of operation and maintenance.

[0007] Traditional configuration centers (such as Spring Cloud Config) only support configuration management and cannot directly trigger service restarts. Existing solutions require scripting or additional tools, increasing system complexity.

[0008] The main reasons for these problems are:

[0009] The diverse number of microservices and deployment environments increases O&M challenges. Network limitations and security controls prevent the use of automated O&M tools like Ansible and Puppet. Traditional approaches lack a centralized platform for managing microservice restarts, leading to decentralized operations. Summary of the Invention

[0010] The present invention aims to address the deficiencies of the above-mentioned prior art and provides a highly practical method for realizing one-click restart of microservices.

[0011] A further technical task of the present invention is to provide a system that is rationally designed, safe and applicable for implementing a one-click restart of microservices.

[0012] The technical solution adopted by the present invention to solve its technical problem is:

[0013] A method for implementing one-click restart of microservices based on Nacos configuration monitoring. First, a configuration file microservice_restart.properties specifically for microservice restart is created in the Nacos configuration center. When each microservice starts, it registers with the Nacos registration center and monitors changes in the configuration file microservice_restart.properties through the Nacos client.

[0014] Finally, a unified operation and maintenance management interface is developed, which interacts with the Nacos configuration center.

[0015] Furthermore, the restart flag of each microservice is defined in the microservice_restart.properties file, and the Nacos client is configured to be integrated with the microservice application, and the automatic refresh monitoring of the configuration file is enabled to ensure that the microservice can obtain the configuration information of the Nacos configuration center in real time.

[0016] Furthermore, when the restart flag of a microservice in the configuration file changes from false to true, the microservice receives a change notification.

[0017] Furthermore, the operation and maintenance personnel select the microservice that needs to be restarted on the interface and click the one-click restart button. At this time, the management interface changes the restart flag of the selected microservice in the microservice-restart.properties configuration file to true by calling the Nacos API;

[0018] After the microservice monitors the configuration changes, it executes its own restart logic. After the restart is complete, the microservice resets its restart flag in the Nacos configuration center to false through the Nacos API, indicating that the restart is complete.

[0019] A one-click restart system for microservices is implemented based on Nacos configuration monitoring. First, a configuration file microservice_restart.properties is created in the Nacos configuration center specifically for microservice restarts. When each microservice starts, it registers with the Nacos registration center and monitors changes in the configuration file microservice_restart.properties through the Nacos client.

[0020] Finally, a unified operation and maintenance management interface is developed, which interacts with the Nacos configuration center.

[0021] Furthermore, the restart flag of each microservice is defined in the microservice_restart.properties file, and the Nacos client is configured to be integrated with the microservice application, and the automatic refresh monitoring of the configuration file is enabled to ensure that the microservice can obtain the configuration information of the Nacos configuration center in real time.

[0022] Furthermore, when the restart flag of a microservice in the configuration file changes from false to true, the microservice receives a change notification.

[0023] Furthermore, the operation and maintenance personnel select the microservice that needs to be restarted on the interface and click the one-click restart button. At this time, the management interface changes the restart flag of the selected microservice in the microservice-restart.properties configuration file to true by calling the Nacos API;

[0024] After the microservice monitors the configuration changes, it executes its own restart logic. After the restart is complete, the microservice resets its restart flag in the Nacos configuration center to false through the Nacos API, indicating that the restart is complete.

[0025] Compared with the prior art, the method and system for implementing one-key restart of microservices of the present invention have the following outstanding beneficial effects:

[0026] This invention significantly simplifies the operation and maintenance process through a unified interface with one-click operation, eliminating the need to log in to each server individually. It can simultaneously trigger the restart of multiple microservices, significantly reducing the overall restart time, and the restart time for a single microservice instance is reduced from an average of 5 minutes to 15 seconds. This reduces the error rate, and centralized management reduces manual errors and improves operation and maintenance accuracy. Regardless of the server environment in which the microservice is deployed, as long as the Nacos client is integrated, a unified restart operation can be achieved.

[0027] It reduces manual operations by more than 80% and can also be expanded to support two modes: scheduled restart and emergency restart. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0029] Attachment Figure 1 This is a flowchart for implementing a one-click restart method for microservices. DETAILED DESCRIPTION

[0030] In order to enable those skilled in the art to better understand the solutions of the present invention, the present invention will be further described in detail below in conjunction with specific embodiments. Obviously, the embodiments described are only some embodiments of the present invention, rather than all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0031] A best embodiment is given below:

[0032] like Figure 1 As shown in the figure, a method for implementing a one-click restart of microservices in this embodiment is based on Nacos configuration monitoring. First, a configuration file microservice_restart.properties specifically for microservice restart is created in the Nacos configuration center. The restart flag of each microservice is defined in this file, such as installation service: ser-wfm-install.restart=false, complaint service: ser-wfm-obstacle.restart=false, pay-per-service: ser-wfm-pay.restart=false, etc.

[0033] At the same time, configure the Nacos client to integrate with the microservice application and enable automatic refresh monitoring of the configuration file to ensure that the microservice can obtain the configuration information of the Nacos configuration center in real time.

[0034] When each microservice starts, it registers with the Nacos registry and monitors changes in the configuration file microservice_restart.properties through the Nacos client. When the restart flag of a microservice in the configuration file changes from false to true, the microservice receives a notification of the change.

[0035] Finally, a unified operations management interface was developed that interacts with the Nacos configuration center. On this interface, operations personnel select the microservice to be restarted and click the "One-click Restart" button. The management interface then calls the Nacos API to set the restart flag in the microservice-restart.properties configuration file of the selected microservice to true.

[0036] After the relevant microservices monitor the configuration changes, they execute their own restart logic, such as by calling the restart method provided by their own framework or calling scripts to restart.

[0037] After the restart is complete, the microservice resets its restart flag in the Nacos configuration center to false through the Nacos API, indicating that the restart is complete.

[0038] Based on the above method, a microservice one-click restart system is implemented in this embodiment. It is based on Nacos configuration monitoring. First, a configuration file microservice_restart.properties specifically for microservice restart is created in the Nacos configuration center. When each microservice starts, it registers with the Nacos registration center and monitors changes in the configuration file microservice_restart.properties through the Nacos client.

[0039] Finally, a unified operation and maintenance management interface is developed, which interacts with the Nacos configuration center.

[0040] The microservice_restart.properties file defines the restart flag of each microservice, configures the Nacos client to integrate with the microservice application, and enables automatic refresh monitoring of the configuration file to ensure that the microservice can obtain the configuration information of the Nacos configuration center in real time.

[0041] When the restart flag of a microservice in the configuration file changes from false to true, the microservice receives a change notification.

[0042] The operation and maintenance personnel select the microservice that needs to be restarted on the interface and click the one-click restart button. At this time, the management interface changes the restart flag of the selected microservice in the microservice-restart.properties configuration file to true by calling the Nacos API;

[0043] After the microservice monitors the configuration changes, it executes its own restart logic. After the restart is complete, the microservice resets its restart flag in the Nacos configuration center to false through the Nacos API, indicating that the restart is complete.

[0044] The above-mentioned specific implementation methods are only specific cases of the present invention. The patent protection scope of the present invention includes but is not limited to the above-mentioned specific implementation methods. Any technical solutions that conform to the above-mentioned specific implementation methods of the present invention and any appropriate changes or substitutions made thereto by ordinary technicians in the relevant technical field shall fall within the patent protection scope of the present invention.

[0045] While embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions, and variations may be made to these embodiments without departing from the principles and spirit of the invention, and that the scope of the invention is defined by the appended claims and their equivalents.

Claims

1. A method for implementing a one-click restart of a microservice, characterized in that: Based on Nacos configuration monitoring, first, create a configuration file microservice_restart.properties in the Nacos configuration center specifically for microservice restart. When each microservice starts, it registers with the Nacos registration center and monitors changes in the configuration file microservice_restart.properties through the Nacos client. Finally, a unified operation and maintenance management interface is developed, which interacts with the Nacos configuration center.

2. A method for implementing a one-key restart of a microservice according to claim 1, characterized in that: The microservice_restart.properties file defines the restart flag of each microservice, configures the Nacos client to integrate with the microservice application, and enables automatic refresh monitoring of the configuration file to ensure that the microservice can obtain the configuration information of the Nacos configuration center in real time.

3. A method for implementing a one-key restart of a microservice according to claim 2, characterized in that: When the restart flag of a microservice in the configuration file changes from false to true, the microservice receives a change notification.

4. A method for implementing a one-key restart of a microservice according to claim 3, characterized in that: The operation and maintenance personnel select the microservice that needs to be restarted on the interface and click the one-click restart button. At this time, the management interface changes the restart flag of the selected microservice in the microservice-restart.properties configuration file to true by calling the Nacos API; After the microservice monitors the configuration changes, it executes its own restart logic. After the restart is complete, the microservice resets its restart flag in the Nacos configuration center to false through the NacosAPI, indicating that the restart is complete.

5. A system for implementing a one-click restart of microservices, characterized in that: Based on Nacos configuration monitoring, first, create a configuration file microservice_restart.properties in the Nacos configuration center specifically for microservice restart. When each microservice starts, it registers with the Nacos registration center and monitors changes in the configuration file microservice_restart.properties through the Nacos client. Finally, a unified operation and maintenance management interface is developed, which interacts with the Nacos configuration center.

6. A system for implementing a one-key restart of microservices according to claim 5, characterized in that: The microservice_restart.properties file defines the restart flag of each microservice, configures the Nacos client to integrate with the microservice application, and enables automatic refresh monitoring of the configuration file to ensure that the microservice can obtain the configuration information of the Nacos configuration center in real time.

7. A system for implementing a one-key restart of microservices according to claim 6, characterized in that: When the restart flag of a microservice in the configuration file changes from false to true, the microservice receives a change notification.

8. A system for implementing a one-key restart of microservices according to claim 7, characterized in that: The operation and maintenance personnel select the microservice that needs to be restarted on the interface and click the one-click restart button. At this time, the management interface changes the restart flag of the selected microservice in the microservice-restart.properties configuration file to true by calling the Nacos API; After the microservice monitors the configuration changes, it executes its own restart logic. After the restart is complete, the microservice resets its restart flag in the Nacos configuration center to false through the NacosAPI, indicating that the restart is complete.