CN116048609A - Configuration file updating method, device, computer equipment and storage medium - Google Patents

Configuration file updating method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN116048609A
CN116048609A CN202211694696.3A CN202211694696A CN116048609A CN 116048609 A CN116048609 A CN 116048609A CN 202211694696 A CN202211694696 A CN 202211694696A CN 116048609 A CN116048609 A CN 116048609A
Authority
CN
China
Prior art keywords
updated
micro
service
configuration file
update
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211694696.3A
Other languages
Chinese (zh)
Inventor
李洋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan United Imaging Healthcare Co Ltd
Original Assignee
Wuhan United Imaging Healthcare Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuhan United Imaging Healthcare Co Ltd filed Critical Wuhan United Imaging Healthcare Co Ltd
Priority to CN202211694696.3A priority Critical patent/CN116048609A/en
Publication of CN116048609A publication Critical patent/CN116048609A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/73Program documentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Library & Information Science (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application relates to a method, a device, a computer device and a storage medium for updating a configuration file, wherein the method comprises the following steps: when an update instruction of an application program is detected, determining a micro service to be updated in the micro services forming the application program, and acquiring an update configuration file of the micro service to be updated and a first version identifier of the update configuration file; inquiring an update record table of the micro service to be updated, and determining the previous update result of the micro service to be updated; the updated record table is stored in a local database of the application program; if the updating result is that the updating is successful, acquiring a second version identifier of the previous configuration file of the micro-service to be updated; if the first version identifier is not matched with the second version identifier, pushing an update configuration file to a configuration center; and the configuration center is used for updating the configuration file of the micro service to be updated according to the updated configuration file. By adopting the method, the waste of human resources can be reduced, and the updating efficiency and the success probability of updating results in the updating of the micro service can be improved.

Description

Configuration file updating method, device, computer equipment and storage medium
Technical Field
The present application relates to the field of micro-services, and in particular, to a method, an apparatus, a computer device, a storage medium, and a computer program product for updating a configuration file.
Background
Micro-services are a variant of the software development technology, service Oriented Architecture (SOA) architecture style, which is used to divide a single application into a small set of services, which are coordinated and interoperated with each other. In the development process of a software system, a software system is generally composed of a plurality of micro services, and in order to better perform configuration management on the micro services, parameters, variables and the like required to be changed in the micro services are usually given to a configuration center in an independent configuration file form for unified management.
In the traditional micro-service upgrading method, when a new version of micro-service is deployed, the configuration center needs to be manually moved to correspondingly modify the latest configuration of the micro-service to be upgraded, and the process is complicated and easy to make mistakes, so that the micro-service upgrading fails.
Disclosure of Invention
Based on this, it is necessary to provide a configuration file updating method, device, computer equipment, computer readable storage medium and computer program product for the technical problems that the updating process of the micro service updating method is complicated and is easy to make mistakes, and the micro service updating fails.
In a first aspect, the present application provides a method for updating a configuration file. The method comprises the following steps:
when an update instruction of an application program is detected, determining a micro service to be updated in micro services forming the application program, and acquiring an update configuration file of the micro service to be updated and a first version identification of the update configuration file;
inquiring an update record table of the micro-service to be updated, and determining the last update result of the micro-service to be updated; the update record table is stored in a local database of the application program;
if the updating result is that the updating is successful, acquiring a second version identifier of the previous configuration file of the micro-service to be updated;
if the first version identifier is not matched with the second version identifier, pushing the updated configuration file to a configuration center; and the configuration center is used for updating the configuration file of the micro service to be updated according to the update configuration file.
In one embodiment, the querying the update record table of the micro service to be updated, before determining the last update result of the micro service to be updated, further includes:
acquiring a service identifier of the micro service to be updated;
And inquiring a local database of the application program based on the service identification, and determining an update record table of the micro-service to be updated from the local database.
In one embodiment, after querying the local database of the application program based on the service identifier, the method further includes:
creating an update record table of the micro-service to be updated under the condition that the local database does not exist the update record table of the micro-service to be updated;
and storing the created updated record table into the local database.
In one embodiment, before pushing the update configuration file to a configuration center, the method further includes:
analyzing the updated configuration file to obtain an analyzed configuration file;
the pushing the updated configuration file to a configuration center includes:
pushing the parsed configuration file to the configuration center.
In one embodiment, after pushing the parsed configuration file to a configuration center, the method further includes:
acquiring a configuration updating result of the configuration center on the micro service to be updated;
and storing the updating result, the updated configuration file, the file information of the updated configuration file and the updating moment into an updating record table of the micro service to be updated.
In one embodiment, the method further comprises:
if the updating result is that the updating fails or the second version identifier of the previous updating configuration file is matched with the first version identifier, the updating operation of the micro service to be updated is terminated, and corresponding prompt information is generated; the prompt information comprises an update termination reason of the micro service to be updated;
and displaying the prompt information.
In a second aspect, the present application further provides a configuration file updating apparatus. The device comprises:
the first acquisition module is used for determining a micro-service to be updated in the micro-services forming the application program when an update instruction of the application program is detected, and acquiring an update configuration file of the micro-service to be updated and a first version identifier of the update configuration file;
the inquiry module is used for inquiring the update record table of the micro-service to be updated and determining the previous update result of the micro-service to be updated; the update record table is stored in a local database of the application program;
the second obtaining module is used for obtaining a second version identifier of the previous configuration file of the micro-service to be updated if the updating result is that the updating is successful;
The pushing module is used for pushing the updated configuration file to a configuration center under the condition that the first version identifier is not matched with the second version identifier; and the configuration center is used for updating the configuration file of the micro service to be updated according to the update configuration file.
In a third aspect, the present application also provides a computer device. The computer device comprises a memory storing a computer program and a processor which when executing the computer program performs the steps of:
when an update instruction of an application program is detected, determining a micro service to be updated in micro services forming the application program, and acquiring an update configuration file of the micro service to be updated and a first version identification of the update configuration file;
inquiring an update record table of the micro-service to be updated, and determining the last update result of the micro-service to be updated; the update record table is stored in a local database of the application program;
if the updating result is that the updating is successful, acquiring a second version identifier of the previous configuration file of the micro-service to be updated;
if the first version identifier is not matched with the second version identifier, pushing the updated configuration file to a configuration center; and the configuration center is used for updating the configuration file of the micro service to be updated according to the update configuration file.
In a fourth aspect, the present application also provides a computer-readable storage medium. The computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
when an update instruction of an application program is detected, determining a micro service to be updated in micro services forming the application program, and acquiring an update configuration file of the micro service to be updated and a first version identification of the update configuration file;
inquiring an update record table of the micro-service to be updated, and determining the last update result of the micro-service to be updated; the update record table is stored in a local database of the application program;
if the updating result is that the updating is successful, acquiring a second version identifier of the previous configuration file of the micro-service to be updated;
if the first version identifier is not matched with the second version identifier, pushing the updated configuration file to a configuration center; and the configuration center is used for updating the configuration file of the micro service to be updated according to the update configuration file.
In a fifth aspect, the present application also provides a computer program product. The computer program product comprises a computer program which, when executed by a processor, implements the steps of:
When an update instruction of an application program is detected, determining a micro service to be updated in micro services forming the application program, and acquiring an update configuration file of the micro service to be updated and a first version identification of the update configuration file;
inquiring an update record table of the micro-service to be updated, and determining the last update result of the micro-service to be updated; the update record table is stored in a local database of the application program;
if the updating result is that the updating is successful, acquiring a second version identifier of the previous configuration file of the micro-service to be updated;
if the first version identifier is not matched with the second version identifier, pushing the updated configuration file to a configuration center; and the configuration center is used for updating the configuration file of the micro service to be updated according to the update configuration file.
The configuration file updating method, the device, the computer equipment, the storage medium and the computer program product, when an updating instruction of an application program is detected, determining the to-be-updated micro-service in the micro-service forming the application program, acquiring an updating configuration file of the to-be-updated micro-service and a first version identifier of the updating configuration file, further inquiring an updating record table of the to-be-updated micro-service, determining a previous updating result of the to-be-updated micro-service, and if the updating result is successful, acquiring a second version identifier of the previous configuration file of the to-be-updated micro-service; if the first version identifier is not matched with the second version identifier, pushing the update configuration file to the configuration center, and enabling the configuration center to update the configuration file of the micro service to be updated according to the update configuration file. According to the method, the configuration file is versioned in the development stage of the application program, so that when the micro-service is updated, the configuration file can be automatically updated according to the comparison result of the second version identification of the configuration file and the first version identification of the updated configuration file, which are needed to be updated, so that the waste of human resources can be reduced, and the updating efficiency and the success probability of the updating result in the micro-service updating process can be improved.
Drawings
FIG. 1 is an application environment diagram of a profile update method in one embodiment;
FIG. 2 is a flow chart of a method for updating a configuration file according to one embodiment;
FIG. 3 is a hierarchical relationship diagram of a profile management module in one embodiment;
FIG. 4 is a flowchart of a method for updating a configuration file according to another embodiment;
FIG. 5 is a block diagram of a configuration file updating apparatus in one embodiment;
fig. 6 is an internal structural diagram of a computer device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
It should be noted that the terms "first," "second," and the like in the description and claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that embodiments of the present application described herein may be implemented in sequences other than those illustrated or otherwise described herein.
The configuration file updating method provided by the embodiment of the application can be applied to an application environment shown in fig. 1. Wherein the terminal 102 communicates with the database 104 via a network. The terminal 102 also communicates with a configuration center 106 via a network, in which applications are installed in the terminal 102, and the database 104 is a local database of the terminal 102. In the application scenario of the present application, when the terminal 102 detects an update instruction of an application program, determining a micro service to be updated that forms the application program, and acquiring an update configuration file of the micro service to be updated and a first version identifier of the update configuration file; inquiring an update record table of the micro service to be updated from the database 104, and determining the last update result of the micro service to be updated; if the updating result is that the updating is successful, acquiring a second version identifier of the previous configuration file of the micro-service to be updated; if the first version identifier is not matched with the second version identifier, pushing the update configuration file to the configuration center 106, so that the configuration center 106 updates the configuration file of the micro service to be updated according to the update configuration file.
The terminal 102 may be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, internet of things devices, and portable wearable devices, where the internet of things devices may be smart speakers, smart televisions, smart air conditioners, smart vehicle devices, and the like. The portable wearable device may be a smart watch, smart bracelet, headset, or the like.
In one embodiment, as shown in fig. 2, a method for updating a configuration file is provided, and the method is applied to the terminal 102 in fig. 1 for illustration, and includes the following steps:
step S210, when the update instruction of the application program is detected, determining the micro-service to be updated in the micro-services forming the application program, and acquiring the update configuration file of the micro-service to be updated and the first version identification of the update configuration file.
The method for dividing the application program into a plurality of micro services can be divided according to the functions and requirements of actual services, for example, when developing, some functions are independent, and the functions can be extracted into an independent micro service so as to be convenient to manage.
The first version identifier is an identifier for representing the uniqueness of the update configuration file, and the first version identifier may be a version number or a timestamp corresponding to the update configuration file.
Wherein the update profile represents the profile required for the micro-service to be updated for this update.
It can be understood that, before each update and upgrade of a micro service is performed, all configuration files required by the update of the micro service are modified in the configuration center, and then the micro service can be deployed according to the configuration files required by the update.
The method and the device for implementing the micro-service version processing of the files in the development process of each micro-service are capable of conducting version processing on the files in the development process of each micro-service, namely, each development time, the developed configuration information is stored as a version configuration file, a version identifier is given to the configuration file, the version identifier can be development time, version number and the like, and the naming mode of the configuration file can be as follows: letters (e.g., H) +timestamp+underline+configuration update description+file suffix, wherein the timestamp can be used as a version identification. Thus, a versioned configuration file for each microservice development stage can be obtained.
Further, since each micro-service is not necessarily updated, only a few micro-services may be updated, when an update instruction for a reference program is detected, a micro-service to be updated may be determined from a plurality of micro-services that constitute the application program, and an update configuration file required for the micro-service to be updated and a first version identifier of the update configuration file are obtained according to a configuration file stored in a development stage. The micro service to be updated may include one micro service or a plurality of micro services, and if the micro service includes a plurality of micro services, the step S210 is repeatedly executed for each micro service, and the step of obtaining the update configuration file of the micro service to be updated and the first version identifier of the update configuration file is performed to step S240.
Step S220, inquiring an update record table of the micro-service to be updated, and determining the previous update result of the micro-service to be updated; the update record table is stored in a local database of the application.
The update record table describes the update results of each update of the micro service, the configuration file used for the update, the file information of the configuration file used for the update, the update time and other update conditions.
In a specific implementation, each micro-service can create an update record table when it is updated for the first time, and the update record table is stored in a local database of the micro-service, so as to record each update condition of the micro-service. When the micro-service needs to be updated, a record table to be updated of the micro-service to be updated is obtained from the database, the record table to be updated is queried, and the last updated result of the micro-service to be updated, namely the last updated result, is determined, so that different processing measures can be conveniently adopted according to the last updated result.
Step S230, if the updating result is that the updating is successful, the second version identification of the previous configuration file of the micro-service to be updated is obtained.
The second version identifier is an identifier for characterizing uniqueness of the previous configuration file, and the second version identifier may be a version number or a timestamp corresponding to the previous configuration file.
In the specific implementation, if the previous updating result of the micro-service to be updated is that the updating is successful, file information of the previous configuration file of the micro-service to be updated is obtained from an updating record table, and a second version identifier of the previous configuration file is determined based on the file information; otherwise, if the previous updating result of the micro-service to be updated is that the updating fails, the updating operation of the micro-service to be updated is terminated, prompt information is output, and related personnel are instructed to process through the prompt information.
Step S240, if the first version identification is not matched with the second version identification, pushing the updated configuration file to the configuration center; and the configuration center is used for updating the configuration file of the micro service to be updated according to the updated configuration file.
In a specific implementation, if the version identifier is represented by a timestamp, the first version identifier of the update configuration file required by the micro-service to be updated is not matched with the second version identifier of the configuration file used by the previous update, and the timestamp corresponding to the second version identifier may be later than the timestamp corresponding to the first version identifier; if the version identification is characterized by the version number, the version number is updated from small to large, and the first version identification of the update configuration file required by the update of the micro service to be updated is not matched with the second version identification of the configuration file used by the previous update, the version number corresponding to the second version identification can be smaller than the version number corresponding to the first version identification. When the first version identifier is not matched with the second version identifier, the latest configuration file is required to be updated, and the updated configuration file corresponding to the first version identifier can be pushed to the configuration center, so that the configuration center updates the configuration file of the micro service to be updated according to the updated configuration file, and the latest configuration can be read from the configuration center to start the micro service when the micro service to be updated is deployed. More specifically, the configuration center may add the updated configuration file as a new version of the configuration file to the configuration directory of the micro-service to be updated. Otherwise, if the first version identifier is matched with the second version identifier, which means that the micro-service to be updated does not have the configuration which needs to be updated, the updating operation of the micro-service to be updated is terminated, and corresponding prompt information is output.
In the above configuration file updating method, when an updating instruction of an application program is detected, determining a to-be-updated micro service in the micro services forming the application program, acquiring an updating configuration file of the to-be-updated micro service and a first version identifier of the updating configuration file, further querying an updating record table of the to-be-updated micro service, determining a previous updating result of the to-be-updated micro service, and if the updating result is successful, acquiring a second version identifier of the previous configuration file of the to-be-updated micro service; if the first version identifier is not matched with the second version identifier, pushing the update configuration file to the configuration center, and enabling the configuration center to update the configuration file of the micro service to be updated according to the update configuration file. According to the method, the configuration file in the development stage of the application program is versioned, so that when the micro service is updated, the configuration file can be automatically updated according to the comparison result of the second version identification of the configuration file and the first version identification of the updated configuration file before the micro service is to be updated, the waste of human resources is reduced, the updating efficiency and the success probability of the updating result in the micro service updating process are improved, and the defects that the conventional micro service upgrading method cannot determine which period of configuration version is used in the current configuration, the latest configuration of the micro service needs to be manually updated, the process is complicated, errors are easy to occur, and the micro service updating failure is caused are overcome.
In an exemplary embodiment, the step S220 refers to an update record table of the micro service to be updated, and before determining the previous update result of the micro service to be updated, the method further includes:
step S211, obtaining a service identifier of a micro service to be updated;
step S212, based on the service identification, inquiring a local database of the application program, and determining an update record table of the micro-service to be updated from the local database.
The service identifier is an identifier for representing the uniqueness of the micro-service to be updated, and the service identifier can be represented by the name or the number of the micro-service.
In a specific implementation, each micro service has a corresponding update record table, so before the update record table of the micro service to be updated is queried, a service identifier of the micro service to be updated needs to be acquired, a local database of an application program is queried based on the service identifier, and the update record table matched with the service identifier of the service to be updated is determined from the local database and used as the update record table of the micro service to be updated.
In this embodiment, the service identifier of the micro service to be updated determines the update record table of the micro service to be updated from the local database of the application program, so as to accurately determine the update record table of the micro service to be updated, so as to determine whether to update the configuration file of the micro service to be updated according to the update record table.
In an exemplary embodiment, after the step of querying the local database of the application program based on the service identifier in step S212, the method further includes:
step S213, when the local database does not have the update record table of the micro service to be updated, creating the update record table of the micro service to be updated;
step S214, the created update record table is saved in a local database.
In a specific implementation, when a local database of an application program is queried based on a service identifier of a micro service to be updated, there may be a case that an update record table of the micro service to be updated cannot be queried in the local database, that is, the local database does not have the update record table of the micro service to be updated, which indicates that the micro service to be updated is updated for the first time, so that an update record table of the micro service to be updated may be created at this time, and the created update record table is saved in the local database of the application program.
In this embodiment, when the local database does not have an update record table of the micro service to be updated, the update record table of the micro service to be updated is created and stored in the local database, so that the update condition after the micro service to be updated can be recorded in the update record table later, and the update record table becomes a basis for determining whether the micro service to be updated is updated later.
In an exemplary embodiment, before the step of pushing the update configuration file to the configuration center in step S240, the method further includes: analyzing the updated configuration file to obtain an analyzed configuration file;
in step S240, pushing the update configuration file to the configuration center further includes: pushing the analyzed configuration file to a configuration center.
In a specific implementation, when it is determined that the first version identifier of the configuration file required for updating the micro service to be updated is not matched with the second version identifier of the configuration file used for updating the micro service to be updated last time, after the configuration file of the micro service to be updated is required to be updated, the content in the update configuration file can be read, and because some configurations in the configuration file possibly have different values in different scenes, the configuration values often need to be replaced by placeholders, after the content of the update configuration file is read, the placeholder configuration of the corresponding service needs to be read, and then the value represented by the placeholder configuration is replaced to the corresponding position; after the update configuration file is read, the file name of the update configuration file named according to the specified rule needs to be analyzed, and the description, version and other information of the update configuration file are obtained from the file name. After the analysis of the configuration file is completed, the configuration center is connected, a related API interface (Application Programming Interface) of the configuration center is called, and the analyzed configuration file is pushed to the configuration center.
Further, in an exemplary embodiment, after the step of pushing the parsed configuration file to the configuration center in step S240, the method further includes:
step S241, obtaining a configuration updating result of the configuration center to update the micro service;
step S242, storing the updated result, the updated configuration file, the file information of the updated configuration file and the update time into the update record table of the micro service to be updated.
In a specific implementation, the parsed configuration file is pushed to the configuration center, the configuration updating result of the time can be obtained, and the updating result, the updated configuration file, the file information of the updated configuration file and the updating moment are stored in an updating record table of the micro service to be updated, so that the record of the updating condition of the time is realized.
In the above embodiment, the configuration file is parsed, the parsed configuration file is pushed to the configuration center, so that the configuration center can automatically update the configuration file of the micro service to be updated, and after the parsed configuration file is pushed to the configuration center, the update result, the updated configuration file, the file information of the updated configuration file and the update time are stored in the update record table of the micro service to be updated, thereby providing a basis for determining whether the micro service to be updated next time is updated or not.
In an exemplary embodiment, the above configuration file updating method further includes: if the updating result is that the updating fails or the second version identifier of the previous updating configuration file is matched with the first version identifier, the updating operation of the micro service to be updated is terminated, and corresponding prompt information is generated; the prompt information comprises an update termination reason of the micro service to be updated; and displaying the prompt information.
In this embodiment, if the previous update result of the micro service to be updated is that the update fails, the update operation of the micro service to be updated may be terminated, and a prompt message may be output, and related personnel may be instructed to perform processing through the prompt message. If the first version identifier of the configuration file required by the update of the micro service to be updated is matched with the second version identifier of the configuration file used by the previous update, which means that the micro service to be updated does not have the configuration required to be updated, the update operation of the micro service to be updated is terminated, corresponding prompt information is output, and the prompt information is displayed through a display interface of the terminal, so that related personnel can process the prompt information in time.
In one embodiment, to facilitate understanding of embodiments of the present application by those skilled in the art, the following description will be made with reference to specific examples of the drawings.
The micro service update system of the present application may be divided into a profile management module and a profile update execution module, wherein,
the configuration file management module is configured to create a file named by the micro service name under a specified resource path when a micro service needs to be managed, updated and configured, where the file folder can store configuration files corresponding to the micro service, and each configuration file is named according to a unified rule, for example: letters (e.g., H) +timestamp+underline+configuration update description+file suffix. When the configuration of the micro service needs to be updated, a configuration file is created under the directory of the micro service, the update configuration file which is currently needed for updating is stored, referring to fig. 3, a hierarchical relationship diagram of a configuration file management module is shown, the configuration directory of each micro service can be created under the root directory of the configuration file module, and the configuration file of each micro service can be stored under the configuration directory of each micro service. The profile management module also includes another resource folder in which there is a data script for creating an update record table for storing the configuration update results.
The configuration update execution module, configured to execute logic for updating a configuration file, referring to fig. 4, is a schematic flow chart of the configuration update execution module for updating the configuration file, which is shown in an embodiment, and includes the following steps:
(1) When the micro-service to be updated is determined, and the micro-service to be updated starts to be updated, inquiring whether an update record table of the micro-service to be updated exists in a database of the application program, and if the update record table does not exist, reading a database script under a designated folder of a configuration file management module, and creating the update record table of the micro-service to be updated.
(2) If the update record table exists, the update record data of the micro service to be updated in the update record table is read, the update result of the latest update (namely the previous update) is judged, if the update result is the update failure, the update operation of the micro service to be updated is directly terminated, corresponding prompt information is output, and related personnel are prompted to process.
(3) If the latest updating result is successful updating, the second version identification of the latest updated configuration file in the history record is obtained, and then the updating configuration file and the first version identification of the updating configuration file required by the latest updating of the micro-service to be updated in the configuration file management module are read. Comparing the first version identifier with the second version identifier, if the first version identifier is larger than the second version identifier of the configuration file updated last time, the configuration updating operation needs to be executed on the micro-service to be updated, otherwise, the identifier has no configuration to be updated, the updating service is terminated, and corresponding prompt information is output.
(4) When the configuration updating operation needs to be executed on the micro-service to be updated, the content in the updating configuration file is read. Some configurations in the configuration file may have different values in different scenarios, and often, the configuration values need to be replaced by placeholders, so after the update of the configuration file content is read, the placeholder configurations of the corresponding services need to be read, and then the values represented by the placeholder configurations are replaced to the corresponding positions.
(5) After the update configuration file is read, the file name of the update configuration file named according to the specified rule needs to be analyzed, and information such as description and version of the update configuration file is obtained from the file name.
(6) After the analysis of the update configuration file is completed, connecting the configuration center, calling a related API interface of the configuration center, pushing the analyzed update configuration file to the configuration center, and obtaining a configuration update result of the configuration center to the micro-service to be updated;
(7) Storing the update configuration result, the version identification, the description information, the update time, the configuration content and the like of the update configuration file into an update record table of the micro service to be updated, and outputting an execution result so as to be convenient for relevant personnel to confirm whether the operation is successful or not;
(8) And (4) repeating the steps (2) - (7) when a plurality of micro services need to be subjected to configuration updating.
The method and the device for updating the micro-service files in the micro-service development process carry out versioning processing on files and store the files as configuration files with different versions, so that when the micro-service is subjected to version updating, the version identification (namely, the second version identification) of the configuration file updated at the previous time can be compared with the version identification (namely, the first version identification) of the configuration file developed at the latest time, whether the micro-service needs to be subjected to configuration file updating or not is determined according to a comparison result, when the configuration file needs to be subjected to configuration file updating, the configuration file developed at the latest is pushed to a configuration center, the configuration center carries out configuration updating on the micro-service to be updated based on the configuration file developed at the latest, and when the micro-service to be updated is deployed, the configuration file developed at the latest can be read from the configuration center, and service is started. The method can realize configuration file version management, automatically update configuration files, perform automatic operation and maintenance, and enable the micro-service configuration center to take account of automatic update of configuration files of micro-services under the off-line condition.
It should be understood that, although the steps in the flowcharts related to the embodiments described above are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiment of the application also provides a configuration file updating device for realizing the configuration file updating method. The implementation of the solution provided by the device is similar to the implementation described in the above method, so the specific limitation in the embodiments of one or more profile updating devices provided below may be referred to the limitation of the profile updating method hereinabove, and will not be repeated here.
In one embodiment, as shown in fig. 5, there is provided a profile updating apparatus, including: a first acquisition module 510, a query module 520, a second acquisition module 530, and a push module 540, wherein:
the first obtaining module 510 is configured to determine a micro service to be updated in the micro services that constitute the application program when an update instruction of the application program is detected, and obtain an update configuration file of the micro service to be updated and a first version identifier of the update configuration file;
the query module 520 is configured to query an update record table of the micro service to be updated, and determine a previous update result of the micro service to be updated; the updated record table is stored in a local database of the application program;
a second obtaining module 530, configured to obtain a second version identifier of a previous configuration file of the micro service to be updated if the update result is that the update is successful;
A pushing module 540, configured to push the update configuration file to the configuration center if the first version identifier is not matched with the second version identifier; and the configuration center is used for updating the configuration file of the micro service to be updated according to the updated configuration file.
In one embodiment, the query module 520 is further configured to obtain a service identifier of the micro service to be updated; based on the service identification, a local database of the application program is queried, and an update record table of the micro service to be updated is determined from the local database.
In one embodiment, the apparatus further includes a record table management module, configured to create an update record table of the micro service to be updated if the local database does not have the update record table of the micro service to be updated; and saving the created updated record table to a local database.
In one embodiment, the device further includes an analysis module, configured to analyze the updated configuration file to obtain an analyzed configuration file;
the pushing module 540 is further configured to push the parsed configuration file to the configuration center.
In one embodiment, the device further comprises a storage module, configured to obtain a configuration update result of the micro service to be updated by the configuration center; and storing the updating result, the updated configuration file, the file information of the updated configuration file and the updating moment into an updating record table of the micro service to be updated.
In one embodiment, the device further includes a prompt module, configured to terminate the update operation of the micro service to be updated and generate corresponding prompt information if the update result is that the update fails or the second version identifier of the previous update configuration file is matched with the first version identifier; the prompt information comprises an update termination reason of the micro service to be updated; and displaying the prompt information.
The respective modules in the above-described profile updating apparatus may be implemented in whole or in part by software, hardware, and a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a terminal, and the internal structure of which may be as shown in fig. 6. The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless mode can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement a profile updating method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, can also be keys, a track ball or a touch pad arranged on the shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by those skilled in the art that the structure shown in fig. 6 is merely a block diagram of some of the structures associated with the present application and is not limiting of the computer device to which the present application may be applied, and that a particular computer device may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
In an embodiment, there is also provided a computer device comprising a memory and a processor, the memory having stored therein a computer program, the processor implementing the steps of the method embodiments described above when the computer program is executed.
In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored which, when executed by a processor, carries out the steps of the method embodiments described above.
In an embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the steps of the method embodiments described above.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in the various embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magnetic random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (Phase Change Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like. The databases referred to in the various embodiments provided herein may include at least one of relational databases and non-relational databases. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processors referred to in the embodiments provided herein may be general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic units, quantum computing-based data processing logic units, etc., without being limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples only represent a few embodiments of the present application, which are described in more detail and are not to be construed as limiting the scope of the present application. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application shall be subject to the appended claims.

Claims (10)

1. A method for updating a configuration file, the method comprising:
when an update instruction of an application program is detected, determining a micro service to be updated in micro services forming the application program, and acquiring an update configuration file of the micro service to be updated and a first version identification of the update configuration file;
inquiring an update record table of the micro-service to be updated, and determining the last update result of the micro-service to be updated; the update record table is stored in a local database of the application program;
If the updating result is that the updating is successful, acquiring a second version identifier of the previous configuration file of the micro-service to be updated;
if the first version identifier is not matched with the second version identifier, pushing the updated configuration file to a configuration center; and the configuration center is used for updating the configuration file of the micro service to be updated according to the update configuration file.
2. The method of claim 1, wherein the querying the update record table of the micro-service to be updated, before determining the last update result of the micro-service to be updated, further comprises:
acquiring a service identifier of the micro service to be updated;
and inquiring a local database of the application program based on the service identification, and determining an update record table of the micro-service to be updated from the local database.
3. The method of claim 2, wherein after querying the local database of the application based on the service identification, further comprising:
creating an update record table of the micro-service to be updated under the condition that the local database does not exist the update record table of the micro-service to be updated;
And storing the created updated record table into the local database.
4. The method of claim 1, wherein prior to pushing the updated configuration file to a configuration center, further comprising:
analyzing the updated configuration file to obtain an analyzed configuration file;
the pushing the updated configuration file to a configuration center includes:
pushing the parsed configuration file to the configuration center.
5. The method of claim 4, wherein after pushing the parsed configuration file to a configuration center, further comprising:
acquiring a configuration updating result of the configuration center on the micro service to be updated;
and storing the updating result, the updated configuration file, the file information of the updated configuration file and the updating moment into an updating record table of the micro service to be updated.
6. The method according to any one of claims 1 to 5, further comprising:
if the updating result is that the updating fails or the second version identifier of the previous updating configuration file is matched with the first version identifier, the updating operation of the micro service to be updated is terminated, and corresponding prompt information is generated; the prompt information comprises an update termination reason of the micro service to be updated;
And displaying the prompt information.
7. A profile updating apparatus, the apparatus comprising:
the first acquisition module is used for determining a micro-service to be updated in the micro-services forming the application program when an update instruction of the application program is detected, and acquiring an update configuration file of the micro-service to be updated and a first version identifier of the update configuration file;
the inquiry module is used for inquiring the update record table of the micro-service to be updated and determining the previous update result of the micro-service to be updated; the update record table is stored in a local database of the application program;
the second obtaining module is used for obtaining a second version identifier of the previous configuration file of the micro-service to be updated if the updating result is that the updating is successful;
the pushing module is used for pushing the updated configuration file to a configuration center under the condition that the first version identifier is not matched with the second version identifier; and the configuration center is used for updating the configuration file of the micro service to be updated according to the update configuration file.
8. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the profile updating method of any one of claims 1 to 6 when the computer program is executed.
9. A computer readable storage medium having stored thereon a computer program, characterized in that the computer program when executed by a processor implements the steps of the profile updating method of any one of claims 1 to 6.
10. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the steps of the profile updating method of any one of claims 1 to 6.
CN202211694696.3A 2022-12-28 2022-12-28 Configuration file updating method, device, computer equipment and storage medium Pending CN116048609A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211694696.3A CN116048609A (en) 2022-12-28 2022-12-28 Configuration file updating method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211694696.3A CN116048609A (en) 2022-12-28 2022-12-28 Configuration file updating method, device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116048609A true CN116048609A (en) 2023-05-02

Family

ID=86117454

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211694696.3A Pending CN116048609A (en) 2022-12-28 2022-12-28 Configuration file updating method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116048609A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117251173A (en) * 2023-11-15 2023-12-19 深圳万物安全科技有限公司 Method for configuring micro-service items, device and medium for configuring micro-service items

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117251173A (en) * 2023-11-15 2023-12-19 深圳万物安全科技有限公司 Method for configuring micro-service items, device and medium for configuring micro-service items
CN117251173B (en) * 2023-11-15 2024-03-08 深圳万物安全科技有限公司 Micro-service item configuration method, micro-service item configuration device and medium

Similar Documents

Publication Publication Date Title
CN109634598B (en) Page display method, device, equipment and storage medium
US20220179642A1 (en) Software code change method and apparatus
CN106874281B (en) Method and device for realizing database read-write separation
CN113138781B (en) CSV configuration updating method and storage medium
CN111068328A (en) Game advertisement configuration table generation method, terminal device and medium
CN116048609A (en) Configuration file updating method, device, computer equipment and storage medium
CN113656005A (en) Application component library construction method, application component configuration method and related device
CN110908644A (en) Configuration method and device of state node, computer equipment and storage medium
CN114816470A (en) Metadata database management method and device, electronic equipment and medium
CN113377368A (en) Project development method, device, server and storage medium
CN114721681A (en) Configuration file updating method, device, equipment and storage medium
CN113821249A (en) Project development configuration method and device, electronic equipment and readable storage medium
CN108614838B (en) User group index processing method, device and system
CN111459583A (en) Menu creating method and device
US11593325B2 (en) Systems and methods of data migration in multi-layer model-driven applications
CN114528045B (en) Plug-in operation method, device, computer equipment and storage medium
CN115687375A (en) Database updating method and device, computer equipment and storage medium
CN117032779A (en) Application version switching method, device, computer equipment and storage medium
US20220383215A1 (en) Management device, management method, and management program
CN116775955A (en) Data tag solidifying method, device, computer equipment and storage medium
CN115934098A (en) Object model configuration method and device and computer readable storage medium
CN118035359A (en) Data configuration synchronization method, device, equipment and storage medium
CN117453277A (en) Method, device, equipment and medium for constructing code scanning and header file query library
CN117667648A (en) Method, device, computer equipment and storage medium for detecting code branch line
CN116051056A (en) Front-end project management method, front-end project management device, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination