Configuration management method and device, electronic equipment and storage medium
Through the cooperation of the relational database transaction mechanism and the distributed key-value storage component, timely updating and consistency management of configuration data are achieved, solving the problem of system response delay under dynamic expansion and high concurrent access, and improving service availability and operation and maintenance efficiency.
Patent Information
- Application Number
- CN202510924702.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-04
- Publication Date
- 2025-10-21
AI Technical Summary
Existing configuration management methods cause system response delays in dynamic expansion and high-concurrency access scenarios, affecting the overall service availability and operation and maintenance efficiency, and the configuration version inconsistency problem is serious.
The transaction mechanism of the relational database is used to update the structured configuration data, and the client process cache is updated in a timely manner through the configuration identification information. Combined with the metadata synchronization mechanism of the distributed key-value storage component, the consistency and efficient synchronization of the configuration data are ensured.
It improves the synchronization efficiency of configuration management, avoids update failures and configuration version inconsistencies caused by node failures, and improves the overall service availability and operation and maintenance efficiency.
Smart Images

Figure CN120821775A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to configuration management methods, devices, electronic devices, and storage media. Background Art
[0002] As the scale of distributed systems continues to expand, the consistency, high availability and synchronization efficiency of configuration data have become key challenges to ensure the stable operation of the business. In related technologies, early centralized management solutions were built by using tools such as SSH and Ansible to achieve node-by-node synchronization of configuration files. Specifically, the system covers the entire process from configuration storage and distribution to node updates, including key links such as version control of text configuration files, inter-node communication mechanisms, and configuration change log records. However, in existing configuration management methods, text files and single-point synchronization mechanisms are directly used, and the decoupled storage of metadata and structured data is not achieved. This may lead to problems such as low synchronization efficiency, update failures caused by node failures, inconsistent configuration versions, or system response delays in dynamic expansion and high-concurrency access scenarios, thereby affecting the availability and operation and maintenance efficiency of the overall service. Summary of the Invention
[0003] The present application provides a configuration management method, device, electronic device and storage medium to at least solve the problem of system response delay in dynamic expansion and high concurrent access scenarios in related technologies, thereby affecting the availability and operation and maintenance efficiency of the overall service.
[0004] This application provides a configuration management method, including:
[0005] In response to a configuration modification request, updating structured configuration data through a transaction mechanism of a relational database;
[0006] In response to a change in the structured configuration data, sending a change notification including configuration identification information of the structured configuration data to a client process that subscribes to the structured configuration data;
[0007] The client process queries the updated structured configuration data from the relational database according to the configuration identification information, and updates the configuration data cached by the client process.
[0008] Optionally, in response to the configuration modification request, updating the structured configuration data through a transaction mechanism of a relational database includes:
[0009] In the relational database, metadata key-value pairs corresponding to the structured configuration data in a distributed key-value storage component are synchronously updated; wherein the metadata key-value pairs include the configuration identification information and a change timestamp.
[0010] Optionally, in response to a change in the structured configuration data, sending a change notification including configuration identification information of the structured configuration data to a client process subscribing to the structured configuration data comprises:
[0011] Monitoring changes to the metadata key-value pairs via the distributed key-value storage component;
[0012] In response to a change in the metadata key-value pair, a change notification including the configuration identification information is sent to the client process that subscribes to the metadata key-value pair.
[0013] Optionally, after the client process queries the relational database for updated structured configuration data according to the configuration identification information and updates the configuration data cached by the client process, the method further includes:
[0014] When a master node of the relational database fails, a slave node with the latest data is selected as a new master node based on the replication log sequence number stored in the distributed key-value storage component;
[0015] After the new master node is determined, the master node identification information recorded in the distributed key-value storage component is updated.
[0016] Optionally, the sending a change notification including configuration identification information of the structured configuration data to a client process subscribing to the structured configuration data further includes:
[0017] When the client process fails to connect to the relational database, it connects to the updated master node in response to the update of the master node identification information stored in the distributed key-value storage component; wherein, when the client process regularly pulls configuration data, it carries the local configuration version number, and the relational database determines whether to return an unmodified response based on the version number.
[0018] Optionally, the value of the metadata key value is in a structured data format, including at least one of an operation type, a primary key ID, and a timestamp information; wherein the operation type includes an insert operation and an update operation.
[0019] Optionally, in response to the change of the metadata key-value pair, sending a change notification including the configuration identification information to the client process subscribed to the metadata key-value pair includes:
[0020] Based on the asynchronous notification mechanism, when the metadata key-value pair changes, a change notification containing the configuration identification information is sent to the client process that subscribes to the metadata key-value pair.
[0021] This application also provides a configuration management device, including:
[0022] An updating unit, configured to update the structured configuration data through a transaction mechanism of a relational database in response to a configuration modification request;
[0023] a sending unit configured to send, in response to a change in the structured configuration data, a change notification containing configuration identification information of the structured configuration data to a client process subscribing to the structured configuration data;
[0024] A query unit is used for the client process to query the updated structured configuration data from the relational database according to the configuration identification information, and to update the configuration data cached by the client process.
[0025] Optionally, the updating unit is further configured to:
[0026] In the relational database, metadata key-value pairs corresponding to the structured configuration data in a distributed key-value storage component are synchronously updated; wherein the metadata key-value pairs include the configuration identification information and a change timestamp.
[0027] Optionally, the sending unit is further configured to:
[0028] Monitoring changes to the metadata key-value pairs via the distributed key-value storage component;
[0029] In response to a change in the metadata key-value pair, a change notification including the configuration identification information is sent to the client process that subscribes to the metadata key-value pair.
[0030] Optionally, the device further comprises:
[0031] a determining unit configured to, after the client process in the query unit queries the relational database for updated structured configuration data according to the configuration identification information and updates the configuration data cached by the client process, select, when a master node of the relational database fails, a slave node with the latest data as a new master node based on a replication log sequence number stored in a distributed key-value storage component;
[0032] The updating unit is further used to update the master node identification information recorded in the distributed key-value storage component after determining the new master node.
[0033] Optionally, the sending unit is further configured to:
[0034] When the client process fails to connect to the relational database, it connects to the updated master node in response to the update of the master node identification information stored in the distributed key-value storage component; wherein, when the client process regularly pulls configuration data, it carries the local configuration version number, and the relational database determines whether to return an unmodified response based on the version number.
[0035] Optionally, the value of the metadata key value is in a structured data format, including at least one of an operation type, a primary key ID, and a timestamp information; wherein the operation type includes an insert operation and an update operation.
[0036] Optionally, the sending unit is further configured to:
[0037] Based on the asynchronous notification mechanism, when the metadata key-value pair changes, a change notification containing the configuration identification information is sent to the client process that subscribes to the metadata key-value pair.
[0038] The present application also provides an electronic device, comprising: a memory for storing a computer program; and a processor for implementing the steps of any one of the above-mentioned configuration management methods when executing the computer program.
[0039] The present application also provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned configuration management methods are implemented.
[0040] The present application also provides a computer program product, including a computer program, which implements the steps of any of the above-mentioned configuration management methods when executed by a processor.
[0041] Through this application, since the transaction mechanism of the relational database is used to update the structured configuration data, and the configuration data cached by the client process is updated in a timely manner through the configuration identification information, it is possible to solve the problems of low synchronization efficiency, update failure caused by node failure, inconsistent configuration versions, etc. caused by the use of text files and single-point synchronization mechanisms in the existing configuration management methods, thereby achieving the technical effect of improving the overall service availability and operation and maintenance efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0043] Figure 1 A flowchart of a text generation method provided in an embodiment of the present application;
[0044] Figure 2 A schematic diagram of configuration management provided in an embodiment of the present application;
[0045] Figure 3 A schematic diagram of a configuration management process provided in an embodiment of the present application;
[0046] Figure 4 A schematic diagram of the structure of a configuration management device provided in an embodiment of the present application;
[0047] Figure 5 A schematic diagram of the structure of another configuration management device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0048] The following will be combined with the accompanying drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0049] It should be noted that, in the description of this application, the terms "comprises," "includes," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. The terms "first," "second," etc., in this application are used to distinguish similar objects, and are not used to describe a particular order or sequence.
[0050] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.
[0051] In conjunction with the specific application environment architecture or specific hardware architecture on which the execution of the configuration management method depends, the specific application environment architecture or specific hardware architecture is described herein.
[0052] The embodiments of the present application provide a configuration management method, and the method is described in detail in conjunction with the execution process of the configuration management method. Figure 1 A flowchart of a configuration management method provided in an embodiment of the present application.
[0053] like Figure 1 As shown, the method comprises the following steps:
[0054] Step 101: In response to a configuration modification request, update structured configuration data through a transaction mechanism of a relational database;
[0055] Configuration modification requests typically originate from user-initiated adjustments to various configuration information within a distributed system through the management interface, such as modifying business parameters or updating node configuration rules. The relational database used in this solution is PostgreSQL, which is used to store detailed structured configuration data. This data includes the specific business configuration information required to support the normal operation of each system module. Pre-defined table structures establish relationships between data, facilitating efficient subsequent query operations.
[0056] Upon receiving a configuration modification request, the system initiates a PostgreSQL database transaction. This transaction mechanism ensures atomicity in updates to structured configuration data—that is, the entire update process is either fully executed and committed, successfully updating the structured configuration data to its latest state; or, if any exception occurs during execution, all executed operations are rolled back to their pre-update state, thus avoiding inconsistencies in structured configuration data caused by partial updates. This transaction-based update approach lays the foundation for subsequent synchronization of metadata modifications with distributed key-value storage components. It is a critical step in ensuring the overall consistency of configuration data and ensures the accuracy and integrity of structured configuration data during modifications.
[0057] Step 102: In response to a change in the structured configuration data, sending a change notification including configuration identification information of the structured configuration data to a client process that subscribes to the structured configuration data;
[0058] When the structured configuration data is updated through the relational database's transaction mechanism, the subsequent notification process is triggered. Subscription means that after the client process is started or running, it will pre-subscribe to the key value corresponding to the required structured configuration data through the Watch mechanism of distributed key-value storage components such as ETCD, thereby establishing an association with the structured configuration data so that it can receive timely notifications when the data changes.
[0059] When the structured configuration data changes, the corresponding metadata stored in the distributed key-value storage component will be updated synchronously. Due to the existence of the Watch mechanism, the distributed key-value storage component can monitor the changes in this metadata in real time and automatically identify all client processes that have subscribed to the structured configuration data.
[0060] The configuration identification information contained in the sent change notification is key information that can uniquely identify the changed structured configuration data. Depending on the actual application scenario, this identification information may include the table name storing the structured configuration data, the primary key ID of the corresponding record, etc. This information can help the client process accurately identify the specific structured configuration data that has changed.
[0061] By sending change notifications, subscribed client processes can be informed of changes in structured configuration data in a timely manner, providing accurate positioning basis for client processes to subsequently query and update the latest structured configuration data from the relational database, avoiding the resource consumption caused by traditional polling methods, improving the real-time and efficiency of configuration change notifications, and ensuring timely synchronization of configuration data of each client process in the distributed system.
[0062] Step 103: The client process queries the updated structured configuration data from the relational database according to the configuration identification information, and updates the configuration data cached by the client process.
[0063] When a client process receives a change notification containing configuration identification information, it parses the notification and extracts key identification information, including the table name storing the corresponding structured configuration data and the primary key ID within the table. Because relational databases store detailed structured configuration data and support relational queries through pre-defined table structures, the client process initiates targeted query requests to the relational database based on the parsed table name and primary key ID to obtain the latest updated structured configuration data.
[0064] After obtaining the latest structured configuration data, the client process replaces it with the old configuration data stored in the local cache, completing the local cache update. The local cache is set up by the client process to improve configuration access efficiency. By caching the latest structured configuration data, the number of frequent queries initiated by the client process to the relational database can be reduced, reducing the access pressure on the database. It also allows the client process to quickly obtain the required configuration during subsequent operations, ensuring the efficient operation of its own business. This process ensures that the client process can synchronize the latest structured configuration data in a timely manner, so that the configuration status of each client in the distributed system is consistent with the latest configuration in the system, avoiding business anomalies caused by configuration lags, and further improving the reliability and timeliness of distributed system configuration management.
[0065] In some embodiments, in response to the configuration modification request, updating the structured configuration data through a transaction mechanism of a relational database includes:
[0066] In the relational database, metadata key-value pairs corresponding to the structured configuration data in a distributed key-value storage component are synchronously updated; wherein the metadata key-value pairs include the configuration identification information and a change timestamp.
[0067] See also Figure 2 , Figure 2 A schematic diagram of a configuration management provided in an embodiment of the present application is shown as follows: Figure 2 As shown, in the process of updating structured configuration data through the transaction mechanism of a relational database in response to a configuration modification request, it also includes synchronously updating the metadata key-value pairs corresponding to the structured configuration data in a distributed key-value storage component (such as ETCD) within the transaction of the relational database.
[0068] The distributed key-value storage component is used to store configuration metadata and change notification information. The key of its metadata key-value pair is designed in a preset format, such as / database / table / {table_name}, where {table_name} is the name of the table storing the structured configuration data, so as to clarify the association between the metadata and the corresponding structured configuration data; and the value of the metadata key-value pair is presented in JSON format, including the configuration identification information and the change timestamp, where the configuration identification information may include the operation type (such as INSERT, UPDATE, etc.), the changed field, the primary key ID of the corresponding structured configuration data in the relational database, etc., which is used to accurately identify the change details of the structured configuration data. The change timestamp records the specific time when the configuration modification occurred, providing a basis for subsequent version tracing and change auditing.
[0069] Since the entire process is under the control of the relational database's transaction mechanism, the update of the structured configuration data in the relational database and the update of the metadata key-value pairs in the distributed key-value storage component form an atomic operation: if all operations within the transaction are executed successfully, the modifications of both will be committed at the same time to ensure the consistency of the structured configuration data and the corresponding metadata; if any operation encounters an exception, the transaction will trigger a rollback, so that both the structured configuration data and the metadata key-value pairs are restored to their pre-modification states, thereby avoiding the problem of mismatch between configuration data and metadata due to the success of some modifications, and laying a foundation for data consistency for subsequent configuration change notifications and accurate responses of client processes.
[0070] In some embodiments, in response to a change in the structured configuration data, sending a change notification including configuration identification information of the structured configuration data to a client process subscribed to the structured configuration data comprises:
[0071] Monitoring changes to the metadata key-value pairs via the distributed key-value storage component;
[0072] In response to a change in the metadata key-value pair, a change notification including the configuration identification information is sent to the client process that subscribes to the metadata key-value pair.
[0073] Please continue reading Figure 2 ,like Figure 2 As shown, ETCO monitors metadata key-value pair changes (i.e., Figure 2After a process modifies the KV, a push notification is sent to subscribed clients. The distributed key-value storage component monitors changes to the metadata key-value pairs, specifically using the component's Watch mechanism. This means the component continuously monitors changes to the metadata key-value pairs it stores, including updates to the configuration identifier and change timestamp within the key-value pairs.
[0074] The client process that subscribes to the structured configuration data will, after startup or during operation, subscribe to the metadata key-value pairs corresponding to the required structured configuration data through the client of the distributed key-value storage component, thereby establishing a monitoring relationship for changes to these metadata key-value pairs.
[0075] When a metadata key-value pair in a distributed key-value storage component changes in response to a change in structured configuration data, the component's Watch mechanism captures the change in real time and immediately identifies all client processes that have subscribed to the metadata key-value pair.
[0076] The distributed key-value storage component automatically sends change notifications to these client processes. The configuration identification information contained in the notifications, such as the table name storing the structured configuration data and the primary key ID of the corresponding record, can accurately point to the changed structured configuration data. This provides a clear positioning basis for the client process to subsequently query the latest configuration data from the relational database, ensuring that the client process can promptly and accurately obtain and process changes in the structured configuration data.
[0077] In some embodiments, after the client process queries the relational database for updated structured configuration data based on the configuration identification information and updates the configuration data cached by the client process, the method further includes:
[0078] When a master node of the relational database fails, a slave node with the latest data is selected as a new master node based on the replication log sequence number stored in the distributed key-value storage component;
[0079] After the new master node is determined, the master node identification information recorded in the distributed key-value storage component is updated.
[0080] See also Figure 3 , Figure 3 A flow chart of configuration management provided in an embodiment of the present application shows that after the client process queries the updated structured configuration data from the relational database according to the configuration identification information and updates the locally cached configuration data, when the master node of the relational database fails, the deployed daemon process will monitor the connection interruption of the master node in real time, thereby triggering the failover process.
[0081] The distributed key-value storage component pre-stores the replication log sequence number of each slave node. The log sequence number serves as a key identifier for recording the location of database logs and can accurately reflect the synchronization progress of each node's data. The larger the log sequence number value, the closer the node's data is to the latest state before the master node failed. Based on this, db_monitor will query the log sequence numbers of all slave nodes through tools (such as Ansible), select the slave node with the largest log sequence number, and promote it to the new master node to ensure that the new master node has the most complete and latest data, minimizing the risk of data loss. After determining the new master node, db_monitor will immediately update the master node identification information recorded in the distributed key-value storage component. This identification information is usually stored in the form of a specific key-value pair, such as the key is / database / master_ip and the value is the IP address of the new master node. This allows subsequent client processes to obtain the location information of the new master node by querying the key-value pair, ensuring that the connection between the client and the relational database can be maintained continuously, and ensuring the high availability and data continuity of distributed system configuration management.
[0082] In some embodiments, the sending a change notification including configuration identification information of the structured configuration data to a client process subscribing to the structured configuration data further includes:
[0083] When the client process fails to connect to the relational database, it connects to the updated master node in response to the update of the master node identification information stored in the distributed key-value storage component; wherein, when the client process regularly pulls configuration data, it carries the local configuration version number, and the relational database determines whether to return an unmodified response based on the version number.
[0084] When a client process fails to connect to a relational database, for example, due to a failure of the original master node, the client process initiates a fault-tolerance mechanism and continuously monitors the master node identification information stored in the distributed key-value storage component through the Watch mechanism of the component.
[0085] When the master node identification information in the distributed key-value storage component is updated due to master node switching, the client process can perceive this change in real time and immediately try to establish a connection based on the updated master node identification information, thereby achieving automatic connection with the updated master node, ensuring the continuity of communication between the client process and the relational database, and avoiding configuration access interruption caused by master node failure switching.
[0086] When the client process periodically pulls configuration data, it actively carries the locally cached configuration version number, which is used to identify the version status of the configuration data currently held by the client. After receiving the pull request, the relational database compares the local version number carried by the client with the latest version number of the corresponding configuration data stored in the database. If the two are consistent, it indicates that the client's local configuration data is not outdated, and the database returns an unmodified response, thereby reducing unnecessary configuration data transmission, network bandwidth consumption, and database processing pressure. If the version numbers are inconsistent, the database returns the latest configuration data, ensuring that the client can obtain updated content in a timely manner. This mechanism significantly improves the efficiency of the configuration pull process while ensuring the timeliness of configuration data.
[0087] In some embodiments, the value of the metadata key is in a structured data format, including at least one of an operation type, a primary key ID, and a timestamp information; wherein the operation type includes an insert operation and an update operation.
[0088] The values in the metadata key-value pairs use a structured data format, such as JSON. This format has a clear hierarchical structure and is easy to parse. It can carry various types of change-related information in a standardized manner, making it easier for distributed key-value storage components and client processes to process and identify the information.
[0089] The insert operation is used to identify new structured configuration data being added to the relational database, while the update operation is used to identify existing structured configuration data being modified in the database. The primary key ID is the unique identifier of the corresponding structured configuration data in the relational database table. This ID can be used to accurately locate the specific configuration record that has changed, ensuring that the client process can accurately query the corresponding latest data after receiving the change notification. The timestamp records the specific time when the configuration change occurred, providing a reliable basis for the timing management and version tracing of the change, and facilitating subsequent auditing and analysis of the configuration modification history.
[0090] This structured data format design that contains key information enables metadata key-value pairs to clearly and accurately convey the change details of structured configuration data, laying the foundation for distributed key-value storage components to send effective change notifications to client processes, and also ensuring that client processes can quickly understand the changes and perform corresponding update operations after receiving the notifications.
[0091] In some embodiments, in response to the change of the metadata key-value pair, sending a change notification including the configuration identification information to the client process subscribed to the metadata key-value pair includes:
[0092] Based on the asynchronous notification mechanism, when the metadata key-value pair changes, a change notification containing the configuration identification information is sent to the client process that subscribes to the metadata key-value pair.
[0093] Based on the asynchronous notification mechanism, when the metadata key-value pair in the distributed key-value storage component changes, a change notification containing configuration identification information is sent to the client process that subscribes to the metadata key-value pair. Specifically, the asynchronous notification mechanism here is different from the traditional polling mechanism. It does not require the client process to continuously send query requests to the distributed key-value storage component to obtain change information. Instead, the distributed key-value storage component actively pushes notifications when metadata key-value pairs change, thereby reducing unnecessary communication interactions and lowering system resource consumption.
[0094] This mechanism is implemented through the Watch function of the distributed key-value storage component. That is, after the client process subscribes to the metadata key-value pair, the distributed key-value storage component will establish a long-term listening connection with the client process. When the metadata key-value pair is updated due to changes in structured configuration data (such as changes in fields, operation types, timestamps, etc.), the distributed key-value storage component will immediately send a change notification to all client processes that have subscribed to the metadata key-value pair through the listening connection. The configuration identification information contained in the notification, such as the table name storing the structured configuration data and the primary key ID of the corresponding record, can accurately guide the client process to locate the specific structured configuration data that has changed, allowing the client process to clearly identify the content that needs to be updated without having to traverse all configuration data.
[0095] The asynchronous notification mechanism ensures that the client process can be informed of configuration changes in real time and efficiently, providing timely trigger signals for subsequent queries from relational databases (such as PostgreSQL) and updates to the local cache, further ensuring the consistency and synchronization efficiency of configuration data in the distributed system.
[0096] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method.
[0097] The embodiment of the present application also provides a configuration management device, Figure 4 A schematic diagram of the structure of a configuration management device provided in an embodiment of the present application is shown in FIG. Figure 4 As shown, including:
[0098] An updating unit 21 is configured to update the structured configuration data through a transaction mechanism of a relational database in response to a configuration modification request;
[0099] The sending unit 22 is configured to send a change notification including configuration identification information of the structured configuration data to a client process subscribing to the structured configuration data in response to a change in the structured configuration data;
[0100] The query unit 23 is configured to query the updated structured configuration data from the relational database according to the configuration identification information by the client process, and update the configuration data cached by the client process.
[0101] Furthermore, in a possible implementation of the embodiment of the present disclosure, the updating unit 21 is further configured to:
[0102] In the relational database, metadata key-value pairs corresponding to the structured configuration data in a distributed key-value storage component are synchronously updated; wherein the metadata key-value pairs include the configuration identification information and a change timestamp.
[0103] Furthermore, in a possible implementation of the embodiment of the present disclosure, the sending unit 22 is further configured to:
[0104] Monitoring changes to the metadata key-value pairs via the distributed key-value storage component;
[0105] In response to a change in the metadata key-value pair, a change notification including the configuration identification information is sent to the client process that subscribes to the metadata key-value pair.
[0106] Furthermore, in a possible implementation of the embodiment of the present disclosure, as Figure 5 As shown, the device also includes:
[0107] a determining unit 24 configured to, after the client process in the query unit 23 queries the updated structured configuration data from the relational database according to the configuration identification information and updates the configuration data cached by the client process, select, when a master node of the relational database fails, a slave node with the latest data as a new master node based on a replication log sequence number stored in a distributed key-value storage component;
[0108] The updating unit 21 is further configured to update the master node identification information recorded in the distributed key-value storage component after determining a new master node.
[0109] Furthermore, in a possible implementation of the embodiment of the present disclosure, the sending unit 22 is further configured to:
[0110] When the client process fails to connect to the relational database, it connects to the updated master node in response to the update of the master node identification information stored in the distributed key-value storage component; wherein, when the client process regularly pulls configuration data, it carries the local configuration version number, and the relational database determines whether to return an unmodified response based on the version number.
[0111] Furthermore, in a possible implementation of the embodiment of the present disclosure, the value of the metadata key value is in a structured data format, including at least one of an operation type, a primary key ID, and a timestamp information; wherein the operation type includes an insert operation and an update operation.
[0112] Furthermore, in a possible implementation of the embodiment of the present disclosure, the sending unit 22 is further configured to:
[0113] Based on the asynchronous notification mechanism, when the metadata key-value pair changes, a change notification containing the configuration identification information is sent to the client process that subscribes to the metadata key-value pair.
[0114] For the description of the features in the embodiment corresponding to the configuration management device, please refer to the relevant description of the embodiment corresponding to the configuration management method, and will not be repeated here.
[0115] An embodiment of the present application further provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above configuration management method embodiments.
[0116] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. The computer program is configured to execute the steps of any one of the above configuration management method embodiments when running.
[0117] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.
[0118] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in any one of the above configuration management method embodiments are implemented.
[0119] An embodiment of the present application further provides another computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of any of the above configuration management method embodiments are implemented.
[0120] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0121] The above is a detailed introduction to a configuration management method, device, electronic device and storage medium provided by the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core ideas of the present application. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.
Claims
1. A configuration management method, characterized in that: include: In response to a configuration modification request, updating structured configuration data through a transaction mechanism of a relational database; In response to a change in the structured configuration data, sending a change notification including configuration identification information of the structured configuration data to a client process that subscribes to the structured configuration data; The client process queries the updated structured configuration data from the relational database according to the configuration identification information, and updates the configuration data cached by the client process.
2. The configuration management method according to claim 1, wherein: The updating of the structured configuration data by using a transaction mechanism of a relational database in response to the configuration modification request includes: In the relational database, metadata key-value pairs corresponding to the structured configuration data in a distributed key-value storage component are synchronously updated; wherein the metadata key-value pairs include the configuration identification information and a change timestamp.
3. The configuration management method according to claim 2, characterized in that: In response to a change in the structured configuration data, sending a change notification including configuration identification information of the structured configuration data to a client process subscribing to the structured configuration data comprises: Monitoring changes to the metadata key-value pairs via the distributed key-value storage component; In response to a change in the metadata key-value pair, a change notification including the configuration identification information is sent to the client process that subscribes to the metadata key-value pair.
4. The configuration management method according to claim 1, wherein: After the client process queries the relational database for updated structured configuration data based on the configuration identification information and updates the configuration data cached by the client process, the method further includes: When a master node of the relational database fails, a slave node with the latest data is selected as a new master node based on the replication log sequence number stored in the distributed key-value storage component; After the new master node is determined, the master node identification information recorded in the distributed key-value storage component is updated.
5. The configuration management method according to claim 4, characterized in that: The sending of a change notification containing the configuration identification information of the structured configuration data to a client process subscribing to the structured configuration data further includes: When the client process fails to connect to the relational database, it connects to the updated master node in response to the update of the master node identification information stored in the distributed key-value storage component; wherein, when the client process regularly pulls configuration data, it carries the local configuration version number, and the relational database determines whether to return an unmodified response based on the version number.
6. The configuration management method according to claim 2, characterized in that: The value of the metadata key value is in a structured data format, and includes at least one of an operation type, a primary key ID, and a timestamp information; wherein the operation type includes an insert operation and an update operation.
7. The configuration management method according to claim 3, characterized in that: In response to the change of the metadata key-value pair, sending a change notification including the configuration identification information to the client process subscribed to the metadata key-value pair includes: Based on the asynchronous notification mechanism, when the metadata key-value pair changes, a change notification containing the configuration identification information is sent to the client process that subscribes to the metadata key-value pair.
8. A configuration management device, characterized in that: include: An updating unit, configured to update the structured configuration data through a transaction mechanism of a relational database in response to a configuration modification request; a sending unit configured to send, in response to a change in the structured configuration data, a change notification containing configuration identification information of the structured configuration data to a client process subscribing to the structured configuration data; A query unit is used for the client process to query the updated structured configuration data from the relational database according to the configuration identification information, and to update the configuration data cached by the client process.
9. An electronic device, characterized in that: include: memory for storing computer programs; A processor, configured to implement the steps of the configuration management method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the configuration management method according to any one of claims 1 to 7.