Micro-service configuration management method, device, equipment, medium and program product
By introducing a variety of modules into the service control layer of the microservice architecture, the cache, security management, authorization control and version management of microservice configuration information is solved, and the efficiency and security of configuration management are improved.
Patent Information
- Application Number
- CN202411910590.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-23
- Publication Date
- 2025-04-18
AI Technical Summary
In the microservice architecture, as the number of microservices increases, configuration management becomes complex. How to effectively track, manage and synchronize configuration information, ensure that each microservice instance obtains the correct configuration, perform configuration version control and emergency rollback, and implement security management of configuration items has become a key issue.
By introducing configuration loading module, security authentication module, configuration query module, configuration management module, authorization management module and data cache module in the service control layer, the cache, security management, authorization control and version management of microservice configuration information is realized.
It realizes centralized management of microservice configuration items, supports emergency processing, configuration update, permission management and version control, and improves the efficiency and security of configuration management.
Smart Images

Figure CN119847584A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information technology, and in particular to a microservice configuration management method, device, equipment, medium and program product. Background Art
[0002] With the help of new-generation technologies such as cloud computing, big data and mobile Internet, the new-generation civil aviation information system has transformed from a single application to a microservice architecture. The system has evolved from the original single application to a smaller and more flexible microservice.
[0003] The rapid growth in the number of microservices has brought about the complexity of configuration management. How to effectively track, manage, and synchronize these configurations to ensure that each microservice instance can obtain the correct configuration; how to version control configuration changes and quickly roll back to the previous configuration version when problems arise; and how to support the security management of configuration items to prevent content leakage or malicious exploitation have all become issues that must be considered in configuration management.
[0004] Therefore, there is an urgent need for a microservice configuration management method that can centrally manage all configuration items to achieve functions such as emergency handling, configuration updates, permission management, and version control of configuration items. Summary of the invention
[0005] The purpose of the present invention is to provide a microservice configuration management method, device, equipment, medium and program product, which realizes functions such as emergency handling, configuration update, permission management, and version control of configuration items.
[0006] To achieve the above object, the present invention provides the following technical solutions:
[0007] In a first aspect, an embodiment of the present invention provides a microservice configuration management method, the method comprising:
[0008] The service control layer uses the configuration loading module to load the configuration information required by the microservice instance stored in the data persistence layer into the data cache module for caching;
[0009] The service control layer manages Token information through a security authentication module and verifies user identity to prevent unauthorized access;
[0010] The service control layer provides users with the authorization management function of configuration information through the authorization management module, and supports the operation and maintenance platform to update the content of the authorized configuration items in the configuration information;
[0011] The service control layer provides a configuration item subscription interface to the outside through the configuration query module, and provides the user with a configuration information query function;
[0012] The service control layer provides a configuration item management interface to the outside through the configuration management module to enable users to manage configuration information;
[0013] Wherein, the service control layer includes a security authentication module, a configuration loading module, a configuration query module, a configuration management module, an authorization management module and a data cache module; and the configuration information includes various configuration items.
[0014] In a second aspect, an embodiment of the present invention provides a microservice configuration management device, the device comprising a data persistence layer and a service control layer,
[0015] The service control layer includes a security authentication module, a configuration loading module, a configuration query module, a configuration management module, an authorization management module and a data cache module;
[0016] The data persistence layer is used to store the configuration information required by the microservice instance; wherein the configuration information includes various configuration items;
[0017] The configuration loading module is used to load the configuration information in the data persistence layer into the data cache module;
[0018] The data cache module is used to cache configuration information data that is frequently accessed;
[0019] The security authentication module is used to manage Token information and verify user identity to prevent unauthorized access;
[0020] The authorization management module is used to provide users with the authorization management function of configuration information and support the operation and maintenance platform to update the content of the authorized configuration items in the configuration information;
[0021] The configuration query module is used to provide a configuration item subscription interface to the outside and provide a configuration information query function to the user;
[0022] The configuration management module is used to provide a configuration item management interface to the outside to enable users to manage configuration information.
[0023] In a third aspect, an embodiment of the present invention further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program or instructions to implement the aforementioned microservice configuration management method.
[0024] In a fourth aspect, an embodiment of the present invention further provides a computer storage medium, wherein a computer program or instruction is stored in the computer storage medium, and when the computer program or instruction is executed by a processor, the aforementioned microservice configuration management method is implemented.
[0025] In a fifth aspect, an embodiment of the present invention further provides a computer program product, including a computer program or instructions, which, when executed by a processor, implements the aforementioned microservice configuration management method.
[0026] Technical effects and advantages of the present invention: The device provided by the present invention covers the functions of the traditional configuration center in configuration management, configuration acquisition and authority control in terms of functional implementation; at the same time, for the emergency handling scenarios of microservice configuration items, an authorization management module is added to the service control layer to support the emergency operation of the operation and maintenance service on the authorized configuration items.
[0027] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0029] Figure 1 This is a schematic diagram of the structure of a microservice configuration management device according to an embodiment of the present invention;
[0030] Figure 2 A schematic diagram of configuring a content table structure in an embodiment of the present invention;
[0031] Figure 3 A schematic diagram of configuring the authorization token table structure in an embodiment of the present invention;
[0032] Figure 4 is a flowchart of emergency authorization processing of configuration items in an embodiment of the present invention;
[0033] Figure 5 It is a flowchart of emergency handling of configuration items in an embodiment of the present invention;
[0034] Figure 6 The figure is a schematic diagram of the structure of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0035] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0036] To address the deficiencies of the prior art, an embodiment of the present invention discloses a microservice configuration management method based on a microservice configuration management device, including:
[0037] The microservice configuration management device (i.e., the configuration center, the basic service component that uniformly manages various configuration information) is divided into a data persistence layer and a service control layer in terms of logical structure;
[0038] The data persistence layer can be used to store the configuration information (i.e., configuration content entity) required by the microservice instance to ensure data security;
[0039] like Figure 1 As shown, the service control layer includes a security authentication module, a configuration loading module, a configuration query module, a configuration management module, an authorization management module and a data cache module; the configuration information includes various configuration items.
[0040] The configuration loading module is used to load the configuration information required by the microservice instance stored in the data persistence layer into the data cache module;
[0041] The data cache module is used to cache configuration information data that is frequently accessed to improve the performance of the microservice configuration management device;
[0042] The security authentication module is used to manage Token information and verify user identity to prevent unauthorized access;
[0043] The authorization management module is used to provide users with authorization management functions for configuration information (i.e. authorization or deauthorization of configuration items), and to support the operation and maintenance platform to update the content of authorized configuration items in the configuration information;
[0044] The configuration query module is used to provide a configuration item subscription interface to the outside and provide a configuration information query function to the user so that the microservice instance deployed in the application container can obtain the configuration information;
[0045] The configuration management module is used to provide a configuration item management interface to the outside, so that users can manage configuration information (i.e., add, delete, modify and publish configuration items) through the delivery platform or the configuration center web.
[0046] In some specific embodiments, the data persistence layer stores the configuration information based on a MySQL database, and the MySQL database adopts a one-master and two-backup deployment mode to ensure data security;
[0047] The main MySQL database is responsible for processing write operations, and the backup MySQL database synchronizes data in the main MySQL database to ensure data backup and disaster recovery. In addition, the integrity and availability of backup data are ensured by formulating database incremental and full backup strategies.
[0048] The Mysql database in the present invention can ensure data security by restoring backup data when data loss or damage occurs.
[0049] In some specific embodiments, a configuration authorization token table is constructed in the Mysql database, and the data persistence layer stores the authorization processing Token information of each configuration item by using the configuration authorization token table;
[0050] Therefore, the data tables in the Mysql database include: configuration authorization token table, configuration attribute table, configuration content table, configuration release management table, configuration information backup table, operation log table and user token table, etc. These data tables provide the data basis for the configuration center's configuration management, content update, version control and permission management functions.
[0051] Among them, the structure of the configuration content table is as follows Figure 2 As shown in the figure, the configuration content table contains the information content of a configuration item; id is the globally unique identifier of the configuration item in the database; ref_key is the MD5 value of the configuration item name and the core attribute combination string. The configuration content table and the configuration release management table can be associated through ref_key to realize the release and version rollback of the configuration item; version indicates the version of the configuration item. When the content of the configuration item changes, a new version is added. It and ref_key form the unique key of the configuration content table and support the storage of multiple versions of a configuration item in the configuration content table; content is used to store the content of the configuration item; is_beta is used to indicate whether the release version of the configuration item is a grayscale release.
[0052] Configure the authorization token table structure as follows Figure 3 As shown in the figure, the configuration authorization token table contains the authorization processing Token information of a certain configuration item; among them, ref_key is consistent with the ref_key of a certain authorized configuration item in the configuration content table. When an emergency configuration change occurs, the configuration content table is associated to implement the content update of the configuration item; token is the token code authorized to a third-party application, which is used to authenticate the emergency change interface operation of the configuration item; creator represents the authorizer, usually the owner of the configuration item.
[0053] In some specific embodiments, the security authentication module is used to manage user tokens and verify user identities to prevent unauthorized access, including:
[0054] The security authentication module sets three different user roles corresponding to three different permission ranges according to the configuration requirements scenario.
[0055] Among them, user roles include configuration item owners, configuration item consumers, and configuration item emergency changers;
[0056] The scope of authority includes configuration item management, configuration item acquisition and configuration item emergency changes;
[0057] The authority scope corresponding to the configuration item owner is configuration item management, the authority scope corresponding to the configuration item consumer is configuration item acquisition, and the authority scope corresponding to the configuration item emergency changer is configuration item emergency change.
[0058] In some specific embodiments, when cached configuration information data (eg, a configuration item) changes, the data cache module notifies the configuration query module to send the latest configuration information data to the configuration subscriber.
[0059] In some specific embodiments, the authorization management module is used to provide the user with the authorization management function of the configuration information, and to support the operation and maintenance platform to update the content of the authorization configuration items in the configuration information, including:
[0060] The authorization management module can provide external configuration item authorization interface, configuration item deauthorization interface, and configuration item emergency change interface;
[0061] (1) When a configuration item has a potential emergency change requirement, the authorization management module provides the configuration item authorization interface and the configuration item emergency change interface to the delivery platform and the operation and maintenance platform respectively, so as to support the configuration item owner to authorize the configuration item to the operation and maintenance platform (i.e., third-party application) through the delivery platform for emergency change processing.
[0062] (2) In the configuration item emergency authorization scenario, the authorization management module receives the emergency authorization request initiated by the configuration item owner through the delivery platform calling the configuration item authorization interface, and implements the emergency authorization of the configuration item; Figure 4 As shown, the specific operations include the following:
[0063] Step a: The requester initiates a service call request A of the configuration item authorization interface to the authorization management module through the delivery platform, and the authorization management module receives and parses the service call request A.
[0064] Step b: The authorization management module determines the type of service call request A.
[0065] Step c: When the type of service call request A is determined to be a configuration item authorization interface call request, the security authentication module queries the user token table stored in the data persistence layer according to the information carried by the service call request A, and performs token verification to determine whether the requester is the configuration item owner:
[0066] If the requester is the configuration item owner, the authorization management module generates an emergency authorization token for the configuration item, and generates a configuration authorization token table data item in combination with the information carried in the service call request; the authorization management module calls the Mysql processing interface of the data persistence layer to insert the configuration authorization token table data item into the configuration authorization token table in the data persistence layer, and generates a response message based on the return result of the Mysql processing interface and returns it to the configuration item owner;
[0067] If the requester is not the configuration item owner, the authorization management module in the service control layer generates a response message indicating a permission error and returns it to the requester.
[0068] The information carried in the service call request A that initiates the configuration item authorization interface includes: Token information and configuration item information to be operated; the configuration item information to be operated in the service call request A includes the name of the configuration item to be operated.
[0069] When emergency processing is no longer needed, the authorization management module cancels the authorization of the authorized configuration items and deletes the configuration authorization token table data item corresponding to the Token information in the service call request A in the configuration authorization token table.
[0070] (3) In the configuration item emergency handling scenario, the authorization management module receives the emergency change request initiated by the configuration item emergency changer through the operation and maintenance platform calling the configuration item emergency change interface, and implements the emergency change of the configuration item (generally an emergency change); Figure 5 As shown, the specific operations include the following:
[0071] Step a: The requester initiates a service call request B of the configuration item emergency change interface to the authorization management module through the operation and maintenance platform, and the authorization management module receives and parses the service call request B.
[0072] Step b: The authorization management module determines the type of service call request B.
[0073] Step c: When the type of the service call request B is a configuration item emergency change interface call request, the security authentication module queries the configuration authorization token table stored in the data persistence layer according to the information carried by the service call request B, and determines whether the Token information in the service call request B implements Token verification in the configuration authorization token table, thereby determining whether the requester is authorized to execute the emergency change of the configuration item to be operated in the service call request B;
[0074] If not, the authorization management module generates a response message indicating an authority error and returns it to the requester.
[0075] If yes, the authorization management module determines whether the published version of the configuration item to be operated in the service call request B for emergency change is correct. If yes, the authorization management module updates the content of the configuration item to be operated in the service call request B; specifically, it includes:
[0076] The authorization management module queries the configuration release management table in the data persistence layer, obtains the current release version of the configuration item to be operated in the service call request B in the configuration release management table, and compares it with the latest release version of the configuration item to be operated in the service call request B for this emergency change;
[0077] If the two are consistent, it means that the configuration item to be operated in the service call request B is an emergency change based on the current release version; if the two are inconsistent, it means that the configuration item to be operated in the service call request B is an emergency change based on an expired release version;
[0078] When the configuration item to be operated in the service call request B is an emergency change based on the current release version, it means that the release version is correct, then the authorization management module calls the Mysql processing interface to complete the update of the configuration item to be operated in the service call request B in the configuration content table, and at the same time updates the release version information of the configuration item to be operated in the configuration release management table;
[0079] When the configuration item to be operated in the service call request B is an emergency change based on an expired release version, it means that the release version is incorrect, and the authorization management module generates a response message indicating the version error and returns it to the requester; at this time, the requester needs to re-acquire the current latest version of the configuration item to be operated, and then make emergency changes as needed.
[0080] The information carried by the service call request B for initiating the configuration item emergency change interface includes: Token information and configuration item information to be operated; the configuration item information to be operated in the service call request B includes the name, attributes and content of the configuration item to be operated.
[0081] In some specific embodiments, the configuration management module is used to provide a configuration item management interface to the outside to enable users to manage configuration information, including:
[0082] The configuration management module provides a configuration item management interface to the outside world, allowing users (mainly configuration item owners) to manage configuration information (i.e., add, delete, modify and publish configuration items) through the delivery platform or the configuration center web.
[0083] Taking the release function of a configuration item as an example, the following three scenarios are generally supported:
[0084] (1) Add new configuration items and publish them;
[0085] (2) Update a configuration item and then release it;
[0086] (3) When a configuration item has multiple versions, release one of them as the online version.
[0087] In some specific embodiments, the configuration management module is used to provide a configuration item management interface to the outside, so that the user can manage the configuration information through the delivery platform or the configuration center web, including:
[0088] The configuration item management interface includes the configuration add interface, configuration delete interface, configuration update interface, and version release interface.
[0089] Step a: The requester initiates a service call request C of the configuration item management interface to the configuration management module through the delivery platform, and the configuration management module receives and parses the service call request C.
[0090] Step b: The security authentication module queries the user token table stored in the data persistence layer according to the information carried by the service call request C, and implements Token verification to determine whether the requester is the owner of the configuration item.
[0091] Step c: If the requester is the configuration item owner, the configuration management module determines the interface type of the service call request C;
[0092] <1> When the interface type is to add a configuration interface, the configuration management module adds configuration items to be operated according to the information carried in the service call request, including:
[0093] The configuration management module generates the field information ref_key according to the configuration item information to be operated in the service call request C. The configuration management module calls the Mysql processing interface of the data persistence layer to insert the configuration item information to be operated in the service call request C into the configuration content table, and generates a response message based on the return result of the Mysql processing interface and returns it to the requester.
[0094] Among them, when the interface type of the service call request C is to add a configuration interface, the information carried by the service call request C includes: Token information and configuration item information to be operated, and the configuration item information to be operated in the service call request C includes: the name, attributes and content of the configuration item to be operated.
[0095] <2> When the interface type is a configuration deletion interface, the configuration management module deletes the configuration items to be operated according to the information carried in the service call request C, including:
[0096] The configuration management module generates field information ref_key according to the configuration item information to be operated in the service call request C. The configuration management module calls the Mysql processing interface of the data persistence layer to insert the configuration item information to be operated in the service call request C into the value configuration information backup table for backup, and deletes the configuration item from the configuration content table, and deletes the related data of the configuration item from the configuration release management table; the configuration management module generates a response message according to the return result of the Mysql processing interface and returns it to the requester.
[0097] Among them, when the interface type of the service call request C is the configuration deletion interface, the information carried by the service call request C includes: Token information and configuration item information to be operated, and the configuration item information to be operated in the service call request C includes: the name and attributes of the configuration item to be operated.
[0098] <3> When the interface type is a configuration update interface, the configuration management module in the service control layer updates the configuration items to be operated according to the information carried in the service call request C, including:
[0099] The configuration management module calls the Mysql processing interface of the data persistence layer, and searches the configuration release management table for the highest version of the configuration item to be operated according to the configuration item information to be operated in the service call request C; based on the highest version of the configuration item to be operated in the service call request C, the version number is increased by 1 to generate a new version number, and a new configuration item is generated in combination with the configuration item information to be operated in the service call request C and inserted into the configuration content table; the configuration management module generates a response message based on the return result of the Mysql processing interface and returns it to the requester.
[0100] Among them, when the interface type of the service call request C is a configuration update interface, the information carried by the service call request C includes: Token information and configuration item information to be operated, and the configuration item information to be operated in the service call request C includes: the name, attributes and content of the configuration item to be operated.
[0101] <4> When the interface type is a version release configuration interface, the configuration management module updates the release version of the configuration item to be operated according to the information carried in the service call request C, including:
[0102] The configuration management module generates the field information ref_key according to the configuration item information to be operated in the service call request C. The configuration management module calls the Mysql processing interface of the data persistence layer to query whether there is a version to be released in the configuration content table for the configuration item to be operated in the service call request C:
[0103] If it exists, the configuration management module calls the MySQL processing interface to update the version information of the configuration item to be operated in the configuration release management table to the release version of the configuration to be operated in the service call request C; the configuration management module generates a response message based on the return result of the MySQL processing interface and returns it to the requester;
[0104] If it does not exist, the configuration management module generates a response message indicating an authority error and returns it to the requester.
[0105] In some specific embodiments, the configuration query module is used to provide a configuration item subscription interface to the outside, including:
[0106] The configuration query module provides a configuration item subscription interface to the outside world based on long polling to meet the dynamic update scenario requirements of the client for the configuration items to be operated.
[0107] The configuration query module provides a configuration item subscription interface to the outside based on long polling to meet the dynamic update scenario requirements of the client for the operation configuration items, including:
[0108] Step a: Establish a client long polling connection table in the data persistence layer; wherein the key in the client long polling connection table is ref_key, the value is a list table structure, and the list table stores the connection information of each client subscribing to the configuration item corresponding to ref_key.
[0109] Step b: The requester initiates a service call request D of the configuration item subscription interface to the configuration query module through the delivery platform, and the configuration query module receives and parses the service call request D.
[0110] Step c: The security authentication module queries the user token table stored in the data persistence layer according to the information carried in the service call request D to implement token verification to determine whether the requester is a configuration item consumer;
[0111] If the requester is not a configuration item consumer, the configuration query module generates a response message indicating a permission error and returns it to the requester.
[0112] If the requester is a configuration item consumer, the configuration query module determines the interface type of the service call request D:
[0113] <1> When the interface type of the service call request D is a configuration subscription interface, the configuration query module generates a ref_key according to the configuration item information to be operated in the service call request D, and queries whether the client long polling connection table corresponding to the configuration item to be operated in the service call request D exists;
[0114] If it does not exist, a new list table structure is created with ref_key as the key item, and each client connection is inserted into the newly created list table.<ref_key,list> Insert into the client long polling connection table;
[0115] If it exists, the configuration query module sends the changed configuration item information (i.e. the configuration item information to be operated in the service call request D) to the client based on the client long polling connection table, specifically:
[0116] Append each client connection to the list table corresponding to ref_key; when the configuration management module triggers a configuration item change, the configuration query module generates a ref_key based on the changed configuration item information (i.e., the configuration item information to be operated in the service call request D), and queries whether the client long polling connection table corresponding to the changed configuration item (i.e., the configuration item information to be operated in the service call request D) exists; if so, the configuration query module sends the changed configuration item information (i.e., the configuration item information to be operated in the service call request D) to the client based on each client connection stored in the list table.
[0117] <2> When the interface type of the service call request D is a configuration item query interface, the configuration query module generates a ref_key according to the configuration item information to be operated in the service call request D;
[0118] The configuration item query module queries the release version and configuration content of the configuration item to be operated in the service call request D. Specifically, the configuration item query module calls the Mysql processing interface to query the configuration release management table to obtain the release version information of the configuration item to be operated in the service call request D, and then the configuration item query module queries the configuration content table according to the ref_key and the release version information of the configuration item to be operated;
[0119] The configuration item query module generates a response message based on the return result of the MySQL processing interface and returns it to the requester.
[0120] The information carried in the service call request D for initiating the configuration item subscription interface includes: Token information and configuration item information to be operated. The configuration item information to be operated in the service call request D includes: the name of the configuration item to be operated.
[0121] Based on the same inventive concept, an embodiment of the present invention discloses a microservice configuration management device, the device comprising a data persistence layer and a service control layer,
[0122] The service control layer includes a security authentication module, a configuration loading module, a configuration query module, a configuration management module, an authorization management module and a data cache module;
[0123] The data persistence layer is used to store the configuration information required by the microservice instance; wherein the configuration information includes various configuration items;
[0124] The configuration loading module is used to load the configuration information in the data persistence layer into the data cache module;
[0125] The data cache module is used to cache configuration information data that is frequently accessed;
[0126] The security authentication module is used to manage user tokens and verify user identities to prevent unauthorized access;
[0127] The authorization management module is used to provide users with the authorization management function of configuration information and support the operation and maintenance platform to update the content of the authorized configuration items in the configuration information;
[0128] The configuration query module is used to provide a configuration item subscription interface to the outside and provide a configuration information query function to the user;
[0129] The configuration management module is used to provide a configuration item management interface to the outside to enable users to manage configuration information.
[0130] In some specific embodiments, the data cache module is also used to notify the configuration query module in the service control layer to send the latest configuration information data to the configuration subscriber when the cached configuration information data changes.
[0131] Regarding the device in the above embodiment, the specific manner in which each unit module performs the operation has been described in detail in the embodiment of the method, and will not be elaborated here.
[0132] Based on the same inventive concept, an embodiment of the present invention further provides an electronic device, whose structure is as follows: Figure 6 As shown, it includes a memory, a processor and a computer program stored in the memory, and the processor executes the computer program or instructions to implement the aforementioned microservice configuration management method.
[0133] Based on the same inventive concept, an embodiment of the present invention further provides a computer storage medium, in which a computer program or instruction is stored. When the computer program or instruction is executed by a processor, the aforementioned microservice configuration management method is implemented.
[0134] Based on the same inventive concept, an embodiment of the present invention further provides a computer program product, including a computer program or instructions, which implement the aforementioned microservice configuration management method when executed by a processor.
[0135] Finally, it should be noted that the above is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, it is still possible for those skilled in the art to modify the technical solutions described in the aforementioned embodiments or to make equivalent substitutions for some of the technical features therein. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A microservice configuration management method, characterized in that: The method comprises: The service control layer uses the configuration loading module to load the configuration information required by the microservice instance stored in the data persistence layer into the data cache module for caching; The service control layer manages Token information through a security authentication module and verifies user identity to prevent unauthorized access; The service control layer provides users with the authorization management function of configuration information through the authorization management module, and supports the operation and maintenance platform to update the content of the authorized configuration items in the configuration information; The service control layer provides a configuration item subscription interface to the outside through the configuration query module, and provides the user with a configuration information query function; The service control layer provides a configuration item management interface to the outside through the configuration management module to enable users to manage configuration information; Wherein, the service control layer includes a security authentication module, a configuration loading module, a configuration query module, a configuration management module, an authorization management module and a data cache module; and the configuration information includes various configuration items.
2. A microservice configuration management method according to claim 1, characterized in that: The data persistence layer stores the configuration information based on a MySQL database, and the MySQL database adopts a one-master and two-backup deployment mode; Constructing a configuration authorization token table in the Mysql database, and the data persistence layer uses the configuration authorization token table to store authorization processing Token information of each configuration item; The main MySQL database is responsible for processing write operations, and the backup MySQL database synchronizes data in the main MySQL database; The Mysql database includes: configuration authorization token table, configuration attribute table, configuration content table, configuration release management table, configuration information backup table, operation log table and user token table.
3. A microservice configuration management method according to claim 1, characterized in that: The service control layer manages Token information through the security authentication module and verifies the user identity to prevent unauthorized access, including: The security authentication module in the service control layer sets different user roles to correspond to different authority ranges according to the configuration requirement scenarios; Among them, user roles include configuration item owners, configuration item consumers, and configuration item emergency changers; The scope of authority includes configuration item management, configuration item acquisition and configuration item emergency changes; The authority scope corresponding to the configuration item owner is configuration item management, the authority scope corresponding to the configuration item consumer is configuration item acquisition, and the authority scope corresponding to the configuration item emergency changer is configuration item emergency change.
4. A microservice configuration management method according to claim 1 or 2, characterized in that: When the cached configuration information data changes, the data cache module in the service control layer notifies the configuration query module to send the latest configuration information data to the configuration subscriber.
5. A microservice configuration management method according to claim 3, characterized in that: The service control layer provides users with the authorization management function of configuration information through the authorization management module, and supports the operation and maintenance platform to update the content of the authorized configuration items in the configuration information, including: The service control layer provides a configuration item authorization interface, a configuration item cancellation authorization interface, and a configuration item emergency change interface to the outside through the authorization management module; When a configuration item has a potential emergency change requirement, the authorization management module in the service control layer provides the configuration item authorization interface and the configuration item emergency change interface to the delivery platform and the operation and maintenance platform respectively, so as to support the configuration item owner to authorize the configuration item to the operation and maintenance platform for emergency change processing through the delivery platform; In the configuration item emergency authorization scenario, the authorization management module in the service control layer receives the emergency authorization request initiated by the configuration item owner through the delivery platform calling the configuration item authorization interface, and implements the emergency authorization of the configuration item; In the configuration item emergency processing scenario, the authorization management module in the service control layer receives the emergency change request initiated by the configuration item emergency changer through the operation and maintenance platform calling the configuration item emergency change interface, and implements the emergency change of the configuration item.
6. A microservice configuration management method according to claim 5, characterized in that: The authorization management module in the service control layer receives an emergency authorization request initiated by the configuration item owner through the delivery platform calling the configuration item authorization interface, and implements the emergency authorization of the configuration item, including: The authorization management module in the service control layer receives a service call request A initiated by the requester through the delivery platform for the configuration item authorization interface, and determines the type of the service call request A; When the type of service call request A is determined to be a configuration item authorization interface call request, the authorization management module in the service control layer performs a token verification on the service call request A through the security authentication module to determine whether the requester is the configuration item owner: If so, the configuration item owner calls the configuration item authorization interface through the delivery platform to perform emergency authorization on the configuration item to be operated in the service call request A; If not, the authorization management module in the service control layer generates a response message indicating an authority error and returns it to the requester; The authorization management module in the service control layer performs a token verification on the service call request A through the security authentication module to determine whether the requester is the owner of the configuration item, including: The authorization management module in the service control layer queries the user token table stored in the data persistence layer through the security authentication module according to the information carried by the service call request A, and determines whether the requester who initiates the service call request is the configuration item owner; The information carried in the service call request A for initiating the configuration item authorization interface includes: Token information and information about the configuration item to be operated; The configuration item information to be operated in the service call request A includes the name of the configuration item to be operated.
7. A microservice configuration management method according to claim 6, characterized in that: The configuration item owner calls the configuration item authorization interface through the delivery platform to perform emergency authorization on the configuration item to be operated in the service call request A, including: The authorization management module in the service control layer generates a configuration item emergency authorization Token, and generates a configuration authorization token table data item in combination with the information carried in the service call request A sent by the configuration item owner; The authorization management module in the service control layer calls the Mysql processing interface of the data persistence layer, inserts the configuration authorization token table data item into the configuration authorization token table in the data persistence layer, and generates a response message based on the return result of the Mysql processing interface and returns it to the configuration item owner; When emergency processing is no longer needed, the authorization management module in the service control layer cancels the authorization of the authorized configuration items and deletes the configuration authorization token table data item corresponding to the Token information in the service call request A in the configuration authorization token table.
8. A microservice configuration management method according to claim 5, characterized in that: The authorization management module in the service control layer receives an emergency change request initiated by the requester through the operation and maintenance platform calling the configuration item emergency change interface, and implements the emergency change of the configuration item, including: The authorization management module in the service control layer receives a service call request B initiated by the requester through the operation and maintenance platform for the configuration item emergency change interface, and determines the type of the service call request B; When the type of the service call request B is a configuration item emergency change interface call request, the authorization management module in the service control layer performs a token verification on the service call request B through the security authentication module to determine whether the requester is authorized to perform the emergency change of the configuration item to be operated in the service call request; If yes, the authorization management module in the service control layer determines whether the release version of the configuration item to be operated in the service call request B for emergency change is correct. If yes, the authorization management module in the service control layer updates the content of the configuration item to be operated in the service call request B; If not, the authorization management module in the service control layer generates a response message indicating an authority error and returns it to the requester; The authorization management module in the service control layer performs a token verification on the service call request through the security authentication module to determine whether the requester is authorized to execute the emergency change of the configuration item to be operated in the service call request B, including: The authorization management module in the service control layer queries the configuration authorization token table stored in the data persistence layer through the security authentication module according to the information carried by the service call request B, and determines whether the token information in the service call request B is in the configuration authorization token table, thereby determining whether the requester is authorized to execute the emergency change of the configuration item to be operated in the service call request B; The information carried in the service call request B for initiating the configuration item emergency change interface includes: Token information and configuration item information to be operated; The configuration item information to be operated in the service call request B includes the name, attribute and content of the configuration item to be operated.
9. A microservice configuration management method according to claim 8, characterized in that: The authorization management module in the service control layer determines whether the release version of the emergency change in the service call request B is correct. If it is correct, the authorization management module in the service control layer updates the content of the configuration item to be operated in the service call request B, including: The authorization management module in the service control layer queries the configuration release management table in the data persistence layer to determine the release version based on which the emergency change of the configuration item to be operated in the service call request B is based; If the configuration item to be operated in the service call request B is an emergency change based on the current release version, indicating that the release version is correct, then the authorization management module in the service control layer calls the Mysql processing interface to complete the update of the configuration content table of the configuration item to be operated in the data persistence layer, and at the same time updates the release version information of the configuration item to be operated in the service call request B in the configuration release management table; If the configuration item to be operated in the service call request B is an emergency change based on an expired release version, indicating that the release version is incorrect, the authorization management module in the service control layer generates a response message indicating a version error and returns it to the requester; The authorization management module in the service control layer queries the configuration release management table in the data persistence layer to determine the release version based on which the configuration item to be operated in the service call request B is to be changed in an emergency, including: The authorization management module in the service control layer queries the configuration release management table in the data persistence layer to obtain the current release version of the configuration item to be operated in the service call request B in the configuration release management table; The authorization management module in the service control layer compares the current release version of the configuration item to be operated in the service call request B in the configuration release management table with the latest release version of the configuration item to be operated in the service call request B for this emergency change; If the two are consistent, it means that the configuration item to be operated in service call request B is an emergency change based on the current release version; If the two are inconsistent, it means that the configuration item to be operated in service call request B is an emergency change based on an expired release version.
10. A microservice configuration management method according to claim 2, characterized in that: The service control layer provides a configuration item management interface to the outside through the configuration management module to enable users to manage configuration information, including: The configuration item management interface includes an add configuration interface, a delete configuration interface, a configuration update interface, and a version release interface; The configuration management module in the service control layer receives a service call request C of the configuration item management interface initiated by the requester through the delivery platform; The service control layer performs Token verification on the service call request C through the security authentication module to determine whether the requester is the configuration item owner; If the requester is the configuration item owner, the configuration management module in the service control layer determines the interface type of the service call request C; When the interface type is a configuration adding interface, a configuration deleting interface, a configuration updating interface, or a version publishing interface, the configuration management module in the service control layer adds, deletes, updates, or publishes the configuration items to be operated according to the information carried in the service call request C; Wherein, when adding, deleting, updating, or publishing a version update of a configuration item to be operated, the configuration management module in the service control layer generates an association field ref_key for associating multiple tables according to the configuration item information to be operated in the service call request C; When the interface type of the service call request C is to add a configuration interface, the information carried by the service call request C includes: Token information and configuration item information to be operated, and the configuration item information to be operated in the service call request C includes: the name, attributes and content of the configuration item to be operated; When the interface type of the service call request C is a configuration deletion interface, the information carried by the service call request C includes: Token information and configuration item information to be operated, and the configuration item information to be operated in the service call request C includes: the name and attributes of the configuration item to be operated; When the interface type of the service call request C is a configuration update interface, the information carried by the service call request C includes: Token information and configuration item information to be operated, and the configuration item information to be operated in the service call request C includes: the name, attributes and content of the configuration item to be operated; When the interface type of the service call request C is a version release interface, the information carried by the service call request C includes: Token information and configuration item information to be operated. The configuration item information to be operated in the service call request C includes: the name, attributes and version number of the configuration item to be operated.
11. A microservice configuration management method according to claim 10, characterized in that: When the interface type is an add configuration interface, the configuration management module in the service control layer adds configuration items to be operated according to the information carried by the service call request C, including: The configuration management module in the service control layer calls the Mysql processing interface of the data persistence layer, inserts the configuration item information to be operated in the service call request C into the configuration content table, and generates a response message based on the return result of the Mysql processing interface and returns it to the requester; When the interface type is a configuration deletion interface, the configuration management module in the service control layer deletes the configuration item to be operated according to the information carried by the service call request C, including: The configuration management module in the service control layer calls the Mysql processing interface of the data persistence layer. According to the configuration item information to be operated in the service call request C, the corresponding configuration item is queried from the configuration content table and inserted into the configuration information backup table for backup, and the configuration item is deleted from the configuration content table, and the data related to the configuration item is deleted from the configuration release management table; the configuration management module in the service control layer generates a response message based on the return result of the Mysql processing interface and returns it to the requester; When the interface type is a configuration update interface, the configuration management module in the service control layer updates the configuration items to be operated according to the information carried in the service call request C, including: The configuration management module in the service control layer calls the Mysql processing interface of the data persistence layer, and searches the configuration release management table for the highest version of the configuration item to be operated according to the configuration item information to be operated in the service call request C; the configuration management module in the service control layer generates a new version number by adding 1 to the highest version of the configuration item to be operated in the service call request C, and generates a new configuration item in combination with the configuration item information to be operated in the service call request C and inserts it into the configuration content table; the configuration management module in the service control layer generates a response message according to the return result of the Mysql processing interface and returns it to the requester; When the interface type is a version release interface, the configuration management module in the service control layer updates the release version of the configuration item to be operated according to the information carried by the service call request C, including: The configuration management module in the service control layer calls the Mysql processing interface of the data persistence layer to query whether the configuration item to be operated in the service call request C has a version to be released in the configuration content table: If it exists, the configuration management module in the service control layer calls the Mysql processing interface to update the version information of the configuration item to be operated in the configuration release management table to the release version of the configuration to be operated in the service call request C; the configuration management module in the service control layer generates a response message based on the return result of the Mysql processing interface and returns it to the requester; If it does not exist, the configuration management module in the service control layer generates a response message indicating a permission error and returns it to the requester.
12. A microservice configuration management method according to claim 10, characterized in that: The service control layer provides a configuration item subscription interface to the outside through the configuration query module, including: The configuration query module in the service control layer provides a configuration item subscription interface to the outside based on long polling to realize the dynamic update scenario requirements of the client for the configuration items to be operated.
13. A microservice configuration management method according to claim 12, characterized in that: The configuration query module in the service control layer provides a configuration item subscription interface to the outside based on long polling to realize the dynamic update scenario requirements of the client for the operation configuration items, including: The service control layer establishes a client long polling connection table in the data persistence layer; wherein the key in the client long polling connection table is ref_key, the value is a list table structure, and the list table stores the client connections that subscribe to the configuration item corresponding to ref_key; The configuration query module in the service control layer receives a service call request D initiated by the requester through the delivery platform for the configuration item subscription interface; The service control layer performs Token verification on the service call request D through the security authentication module to determine whether the requester is a configuration item consumer; If the requester is a configuration item consumer, the configuration query module in the service control layer determines the interface type of the service call request D; When the interface type of the service call request D is a configuration subscription interface, the configuration query module in the service control layer queries whether the client long polling connection table corresponding to the configuration item to be operated exists according to the configuration item information to be operated in the service call request D; if it exists, the configuration query module in the service control layer sends the changed configuration item information to the client based on the client long polling connection table; When the interface type of the service call request D is a configuration item query interface, the configuration item query module in the service control layer calls the Mysql processing interface to query the release version and configuration content of the configuration item to be operated in the service call request D; the configuration item query module in the service control layer generates a response message based on the return result of the Mysql processing interface and returns it to the requester; The information carried in the service call request D for initiating the configuration item subscription interface includes: Token information and configuration item information to be operated. The configuration item information to be operated in the service call request D includes: the name of the configuration item to be operated.
14. A microservice configuration management device, characterized in that: The device comprises a data persistence layer and a service control layer, The service control layer includes a security authentication module, a configuration loading module, a configuration query module, a configuration management module, an authorization management module and a data cache module; The data persistence layer is used to store the configuration information required by the microservice instance; wherein the configuration information includes various configuration items; The configuration loading module is used to load the configuration information in the data persistence layer into the data cache module; The data cache module is used to cache configuration information data that is frequently accessed; The security authentication module is used to manage Token information and verify user identity to prevent unauthorized access; The authorization management module is used to provide users with the authorization management function of configuration information and support the operation and maintenance platform to update the content of the authorized configuration items in the configuration information; The configuration query module is used to provide a configuration item subscription interface to the outside and provide a configuration information query function to the user; The configuration management module is used to provide a configuration item management interface to the outside to enable users to manage configuration information.
15. A microservice configuration management device according to claim 14, characterized in that: The data cache module is also used for notifying the configuration query module in the service control layer to send the latest configuration information data to the configuration subscriber when the cached configuration information data changes.
16. An electronic device, characterized in that: It includes a memory, a processor and a computer program stored in the memory, and the processor executes the computer program or instructions to implement a microservice configuration management method as described in any one of claims 1-13.
17. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program or instruction, and when the computer program or instruction is executed by the processor, a microservice configuration management method according to any one of claims 1 to 13 is implemented.
18. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed by a processor, a microservice configuration management method as described in any one of claims 1 to 13 is implemented.