CN115118590A - Method, device, system, equipment and storage medium for managing configuration data - Google Patents

Method, device, system, equipment and storage medium for managing configuration data Download PDF

Info

Publication number
CN115118590A
CN115118590A CN202210709856.0A CN202210709856A CN115118590A CN 115118590 A CN115118590 A CN 115118590A CN 202210709856 A CN202210709856 A CN 202210709856A CN 115118590 A CN115118590 A CN 115118590A
Authority
CN
China
Prior art keywords
server
message
configuration
configuration item
modified
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210709856.0A
Other languages
Chinese (zh)
Inventor
丁磊磊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN202210709856.0A priority Critical patent/CN115118590A/en
Publication of CN115118590A publication Critical patent/CN115118590A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • H04L41/0813Configuration setting characterised by the conditions triggering a change of settings
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/085Retrieval of network configuration; Tracking network configuration history
    • H04L41/0853Retrieval of network configuration; Tracking network configuration history by actively collecting configuration information or by backing up configuration information
    • H04L41/0856Retrieval of network configuration; Tracking network configuration history by actively collecting configuration information or by backing up configuration information by backing up or archiving configuration information

Abstract

The application provides a method, a device, a system, equipment and a storage medium for managing configuration data, wherein the method comprises the following steps: if receiving a configuration modification request, modifying a first configuration item indicated by the configuration modification request in the database according to the configuration modification request; after the modification is finished, reading the modified first configuration item from the database, and loading and updating the first configuration item to the local of the first server; after the modification is completed, generating a first message, wherein the first message is used for indicating that the first configuration item is modified; and notifying a second server in the cluster of the first message, so that the second server updates the local first configuration item after acquiring the first message. The method and the device can accelerate the reading of the configuration data, reduce the time delay and simultaneously ensure the consistency of the configuration data of each server as far as possible.

Description

Method, device, system, equipment and storage medium for managing configuration data
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method, an apparatus, a system, a device, and a storage medium for managing configuration data.
Background
In a cluster, in order to ensure the stability of the service, a corresponding configuration needs to be set for the servers in the cluster. If the configuration data is stored locally in each server, if the configuration data of any one server is modified, the configuration data of other servers cannot be synchronously modified, so that the configuration data of the servers are inconsistent. In the prior art, a cache server independent of a background server is built, configuration data is stored in the cache server, and a server in a cluster acquires the configuration data from the cache server through a network. Although the scheme can ensure the consistency of the configuration data acquired by the server, the data acquisition through network communication has certain time consumption to cause time delay, and the scheme cannot meet the requirements of interfaces with higher performance requirements and the timeliness of business scenes which are required to support dynamic modification.
Disclosure of Invention
The method and the device aim to solve the technical problems that in the prior art, the configuration data of each server is not synchronized due to the fact that the configuration data are stored locally, and the data reading delay is caused due to the fact that the configuration data are stored in a cache server. The application provides a method, a device, a system, equipment and a storage medium for managing configuration data, and mainly aims to quicken the reading of the configuration data, reduce the time delay and simultaneously ensure the consistency of the configuration data of each server as far as possible.
In order to achieve the above object, the present application provides a method for managing configuration data, applied to a first server, the method including:
if receiving a configuration modification request, modifying a first configuration item indicated by the configuration modification request in the database according to the configuration modification request;
after the modification is finished, reading the modified first configuration item from the database, and loading and updating the first configuration item to the local of the first server;
after the modification is completed, generating a first message, wherein the first message is used for indicating that the first configuration item is modified;
and notifying the second server in the cluster of the first message, so that the second server updates the local first configuration item after acquiring the first message.
In addition, to achieve the above object, the present application further provides a device for managing configuration data, applied to a first server, the device comprising:
the modification module is used for modifying a first configuration item indicated by the configuration modification request in the database according to the configuration modification request if the configuration modification request is received;
the reading and updating module is used for reading the modified first configuration item from the database and loading and updating the first configuration item to the local of the first server after the modification is finished;
the message generating module is used for generating a first message after the modification is finished, wherein the first message is used for indicating that the first configuration item is modified;
and the first message notification module is used for notifying the second server in the cluster of the first message, so that the second server updates the local first configuration item after acquiring the first message.
In addition, to achieve the above object, the present application also provides a management system for configuration data, including: the system comprises a first server, a second server and a database;
the first server is used for modifying a first configuration item indicated by the configuration modification request in the database according to the configuration modification request if the configuration modification request is received, reading the modified first configuration item from the database after the modification is finished, loading and updating the modified first configuration item to the local of the first server, generating a first message, wherein the first message is used for indicating that the first configuration item is modified, and informing the first message to a second server in the cluster,
and the second server is used for updating the local first configuration item after the first message is obtained.
To achieve the above object, the present application further provides a computer device comprising a memory, a processor and computer readable instructions stored on the memory and executable on the processor, wherein the processor executes the computer readable instructions to perform the steps of the method for managing configuration data according to any one of the preceding claims.
To achieve the above object, the present application further provides a computer readable storage medium having stored thereon computer readable instructions, which, when executed by a processor, cause the processor to execute the steps of the method for managing configuration data according to any one of the preceding claims.
According to the management method, the management device, the management system, the management equipment and the management storage medium of the configuration data, each server stores the initial configuration data read from the database in the local server, only when the configuration items in the database are modified, the local server can synchronously load, update and modify the modified configuration items, and the used configuration data are still read from the local server; even if the database is temporarily in a problem, the local configuration data of the server can still be used, and the dependence on the components is reduced. In addition, if any one server in the cluster modifies the configuration items in the database, other servers can also be informed in time, so that the other servers can update the local corresponding configuration items in time, and the consistency of the configuration data of each server in the cluster is realized. According to the method and the device, the reading of the configuration data is accelerated, the time delay is reduced, and meanwhile the consistency of the configuration data of each server is guaranteed as far as possible.
For a user, the operation is simple and convenient, the environment is not required to be restarted, and the configuration items can be successfully modified in the cluster configuration environment by directly clicking the configuration data management page.
Drawings
Fig. 1 is an application scenario diagram of a management method for configuration data in an embodiment of the present application;
FIG. 2 is a flowchart illustrating a method for managing configuration data according to an embodiment of the present application;
fig. 3 is a block diagram illustrating a configuration of a device for managing configuration data according to an embodiment of the present disclosure;
fig. 4 is a block diagram of an internal structure of a computer device according to an embodiment of the present application.
The implementation, functional features and advantages of the objectives of the present application will be further explained with reference to the accompanying drawings.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present application without making creative efforts shall fall within the protection scope of the present application. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The management method of configuration data provided by the present application can be applied to the application environment as shown in fig. 1, where the application environment includes a management system of configuration data, and the system includes: a first server 10, a second server 20 and a database 30;
the first server 10 is configured to modify a first configuration item indicated by the configuration modification request in the database 30 according to the configuration modification request if the configuration modification request is received, read the modified first configuration item from the database 30 after the modification is completed, load and update the modified first configuration item to the local of the first server 10, generate a first message, the first message is used to indicate that the first configuration item is modified, notify the first message to the second server 20 in the cluster,
and the second server 20 is configured to synchronously update the local first configuration item after the first message is acquired.
Fig. 2 is a flowchart illustrating management of configuration data according to an embodiment of the present application. Referring to fig. 2, the method is illustrated as applied to the first server 10 in fig. 1. The management of the configuration data comprises the following steps S100-S400.
S100: and if the configuration modification request is received, modifying the first configuration item indicated by the configuration modification request in the database according to the configuration modification request.
Specifically, the cluster includes at least two servers, and the first server is a server that receives a configuration modification request from a user and responds to the configuration modification request. The configuration modification request may be distributed by load balancing modules in the cluster according to a load balancing policy.
The database stores the configuration data of the cluster. After the servers in the cluster are started, the configuration data in the database are read, and the configuration data are stored in the local server. The configuration data in the database comprises a plurality of configuration items, and each configuration item can be modified by different users through different servers in the cluster. The same configuration item may also be modified by different servers.
The configuration modification request carries a first configuration item to be modified and a corresponding target value, and the first server modifies the first configuration item in the database according to the configuration modification request, namely, the first configuration item to be modified in the database is modified to the target value from a current value.
A second server in the cluster may also be assigned to modify the configuration item in response to other configuration modification requests, where the second server becomes the first server and the first server becomes the second server. In this embodiment, the first server and the second server are relative identities, and are not fixed identities, and the identity of each server may be switched.
In addition, the configuration modification request may include more than one first configuration item requiring modification, which is specifically determined according to the user requirement.
S200: and after the modification is finished, reading the modified first configuration item from the database and loading and updating the first configuration item to the local of the first server.
Specifically, after the first configuration item in the database is modified according to the configuration modification request, the first server reads the modified first configuration item from the database, and loads and updates the modified first configuration item to the local of the first server. When the server in the cluster is started, the initial configuration data in the database is loaded in advance to the server for local storage.
In this embodiment, the first server does not directly change the local first configuration item after receiving the configuration modification request, but changes the first configuration item in the database first, and then obtains the modified first configuration item from the modified database to update the local. Therefore, when other first servers modify the first configuration item again in a short time after the first server modifies the first configuration item, the first server needs to frequently modify and update the local first configuration item, and frequent modification of the local configuration data by the first server is reduced. In addition, the first configuration item in the database is modified firstly, and other second servers can be notified as soon as possible when the first configuration item in the database needs to be modified, so that the second servers can update the first configuration item as synchronously as possible. The rapid modification of the configuration item in this embodiment can support dynamic modification of the configuration item, so as to achieve the support of the performance and function of the interface with high performance requirement.
In one embodiment, the configuration data local to the server may be stored locally using a class variable. More specifically, using the volatile key modification, the configuration items are saved using the fields of the class, so that the modifications are read in real-time. Compared with the method of caching by using a map data structure, the retrieval is long due to the fact that the map mode is used for storing and the key value is needed to be retrieved every time, and the configuration data cannot be taken from the map when the map mode is used for reading every time, so that the access speed of the memory can be increased.
Because the memory is accessed most quickly and can be cached without a data structure such as a map, since the map is retrieved by the key value every time,
s300: and after the modification is completed, generating a first message, wherein the first message is used for indicating that the first configuration item is modified.
Specifically, after the first configuration item in the database is modified according to the configuration modification request, the first server generates a first message.
S400: and notifying a second server in the cluster of the first message, so that the second server updates the local first configuration item after acquiring the first message.
In particular, the first server may notify the second server in the cluster of the first message in different ways.
The server in the cluster reads the configuration data in the database and stores the configuration data in the local when starting, if the configuration data is modified in other working periods, all the configuration data are not read from the database again and loaded to the local, but only the modified configuration items are synchronously loaded to update the local configuration items.
After the second server obtains the first message, the second server may obtain the modified first configuration item from the database to update the local first configuration item. The second server may also extract the modified first configuration item from the first message to update the local first configuration item. The second server may further obtain the modified first configuration item from the redis cache to update the local first configuration item.
It should be understood that the order of execution of the steps is not meant to be sequential, and the order of execution of the steps should be determined by their function and inherent logic, and should not be limited in any way to the implementation process of the embodiments of the present application. The execution sequence of step S200 and step S300 does not have a strict sequence, and may be synchronous, or step S200 may be executed after step S300 is executed first, or step S300 may be executed after step S200 is executed first, which is not limited in the present application. In addition, step S100 precedes steps 200-S400, and step S400 follows step S300.
In addition, at the same time, a plurality of first servers in the cluster may receive different configuration modification requests to modify the first configuration items in the database, and if the same first configuration item is modified by two different servers, the execution sequence of modifying the first configuration items in the database has a precedence order.
In this embodiment, each server stores initial configuration data read from the database in the local server, and only when a configuration item in the database is modified, the local server loads and updates the modified configuration item synchronously, and the used configuration data is still read from the local server; even if the database is temporarily in a problem, the local configuration data of the server can still be used, and the dependence on the components is reduced. In addition, if any one server in the cluster modifies the configuration items in the database, other servers can be notified in time, so that the other servers can update the local corresponding configuration items in time, and the consistency of the configuration data of each server in the cluster is realized. According to the method and the device, the reading of the configuration data is accelerated, the time delay is reduced, and meanwhile the consistency of the configuration data of each server is ensured as far as possible.
In one embodiment, step S400 specifically includes:
and pushing the first message to the message middleware, so that the modified first configuration item is loaded and updated to the local corresponding to the second server after the second server monitors and consumes the first message in the message middleware.
Specifically, the first server serves as a message producer to produce a first message after a first configuration item in the database is changed, and the first message is pushed to the message middleware. The message middleware may place the received first message in a message queue for consumption by a second server in the cluster.
The message middleware can be implemented by kafka or rabbitMQ, which is not limited in this application.
The second server acquires the modified first configuration item after consuming the first message, and updates the local first configuration item according to the modified first configuration item.
The second server may obtain the modified first configuration item from the database, may also extract the modified first configuration item from the first message, and may also obtain the modified first configuration item from the redis cache, which is not limited in this application.
In the embodiment, the message middleware is used for caching and consuming the messages, and because the message middleware is a cache queue for caching the messages carried by the system, no extra burden is added to the system, the multiplexing of the message middleware is realized, and the system resources are fully utilized.
In one embodiment, step S400 specifically includes:
and broadcasting the first message to a second server in the cluster in an http request mode, so that the second server loads and updates the modified first configuration item to the local corresponding to the second server after receiving the first message.
Specifically, the first server queries a server management table from the database, the server management table records service IP addresses and ports of all servers in the cluster, and the first server broadcasts the first message to the second server in an http request manner according to the IP address and the port of the second server in the cluster.
The second server obtains the modified first configuration item after receiving the first message, and updates the local first configuration item according to the modified first configuration item.
In this embodiment, the first server modifies the first configuration item of the database, and notifies the second server to synchronously update the local first configuration item in a http request manner, so that real-time update and synchronization of configuration data in each server in the cluster are realized.
In one embodiment, the method further comprises:
and if the notification of the received first message returned by the message middleware is not received, broadcasting the first message to a second server in the cluster in an http request mode, so that the second server loads and updates the modified first configuration item to the local corresponding to the second server after receiving the first message.
In particular, the purpose of the message middleware is to relieve cluster pressure, but may fail if the message middleware is overburdened. The message middleware can normally receive the pushed message under normal conditions and return a notice of the received message to a producer of the message. If the message middleware fails, the pushed message cannot be normally received, and the notification of the received message cannot be returned. Therefore, the first server can judge whether the message middleware is normal according to whether the notification that the first message returned by the message middleware is received within the preset time length after the first message is pushed. If the first server does not receive the notification of the received first message returned by the message middleware within the preset time length, the first server indicates that the message middleware is possibly too busy and has not come to receive the first message or determines that the message middleware is abnormal. In order to reduce the delay, the first server does not wait for the message middleware to propagate the first message, but timely changes the policy to query a server management table from a database, the server management table records the service IP addresses and the ports of all the servers in the cluster, and the first server broadcasts the first message to the second server in an http request mode according to the IP addresses and the ports of other servers in the cluster, namely, the second server is informed that the first configuration item is modified.
The second server obtains the modified first configuration item after receiving the first message, and updates the local first configuration item according to the modified first configuration item.
The message middleware stores a topic (topic) of the message, a Producer ID (PID) and a Consumer ID (CID), the message middleware stores the topic of the first message, the Producer ID is a code corresponding to a first server, and the Consumer ID is a code corresponding to a second server which has successfully applied for registering as a Consumer to the message middleware.
In this embodiment, when the message middleware fails, the first message is broadcast in an http request manner, so that when the message middleware fails, the second server can still be notified that the first configuration has been modified, so that the second server can timely and synchronously update the local first configuration item, thereby maximally implementing synchronous update of configuration data in each server in the cluster, achieving the purpose of solving the emergency situation, reducing the burden on the message middleware, and ensuring the reliability of the system.
In one embodiment, reading the modified first configuration item from the database and loading the update to the local of the first server in step S200 includes:
reading the modified first configuration item from the database and storing the modified first configuration item into a redis cache, setting a validity period as a first valid duration and setting a corresponding first time stamp for the modified first configuration item stored in the redis cache, and removing the first configuration item of which the accumulated storage duration exceeds the first valid duration by the redis cache, wherein the first time stamp is a storage time stamp of data stored in the redis cache or a reading time stamp of data read from the database by a first server,
loading and updating the modified first configuration item to the local of the first server;
in step S400, updating the local first configuration item by the second server after acquiring the first message includes:
and after the second server acquires the first message, preferentially acquiring the modified first configuration item corresponding to the current latest first timestamp from the redis cache, and loading and updating the modified first configuration item corresponding to the current latest first timestamp to the local corresponding to the second server.
Specifically, a redis cache, i.e., a Remote Dictionary Server (Remote Dictionary Server) end, is a key-value storage system, and the redis cache is an acceleration cache of the database. The first server reads the modified first configuration item from the database and stores the modified first configuration item into the redis cache, so that other servers can preferentially read the modified first configuration item from the redis cache, and the data reading speed is higher.
The Redis cache stores the latest first configuration item in an overlay mode, and also can simultaneously store first configuration items with different first time stamps. That is, the first server may overwrite the historical first configuration item in the redis cache with the latest first configuration item in an overwriting manner, and set a corresponding validity period, that is, a lifetime and a first timestamp, for the latest first configuration item. Therefore, only one first configuration item with a unique version is stored in the redis cache at the same time under normal conditions, and reading is facilitated.
The first timestamp is a reading time when the first server reads the modified first configuration item from the database or a storing time when the first server stores the modified first configuration item into the redis cache.
The first server side can also store the latest first configuration item into the redis cache in a non-covering mode, and meanwhile, the original historical first configuration item of the redis cache cannot be cleared by covering. In order to distinguish the first configuration items stored at different times, a corresponding first timestamp or a storage timestamp may be marked for the first configuration item of each version in the redis cache. This facilitates the external reading of the latest first configuration item according to the first time stamp or the stored time stamp.
And the second server preferentially acquires the first configuration item corresponding to the latest first timestamp from the redis cache, and updates the local first configuration item by using the latest first configuration item. And if the modified first configuration item in the redis cache is expired and cleared, namely the second server does not read the modified first configuration item from the redis cache, the second server acquires the modified first configuration item from the database.
In addition, the redis cache can also cache initial configuration data read from the database by the first server when the server is started, so that other servers can directly go to the redis cache to obtain the initial configuration data.
In one embodiment, the first message carries a second timestamp, where the second timestamp is a modification timestamp of the first configuration item or a read timestamp of the first server reading the modified first configuration item from the database;
step S400 specifically includes:
and pushing the first message to a message middleware, and if at least two first messages carrying different second timestamps exist in the message middleware, enabling the second server to consume the first message corresponding to the latest second timestamp and then load and update the local first configuration item by using the latest modified first configuration item.
Specifically, if the first server receives at least two configuration modification requests in sequence to require modification of the first configuration item or at least two different first servers in the cluster receive different configuration modification requests to require modification of the first configuration item, the corresponding at least two first messages are generated in succession, and because the first messages are removed by the message middleware after being consumed by all the second servers and the times when the second servers consume the first messages are not necessarily consumed synchronously, the corresponding at least two first messages may exist in the message middleware at the same time. Since the first messages are all used for indicating that the first configuration item is modified, the first message consuming the latest second timestamp can be selected according to the second timestamp carried by the first message, and the latest modified first configuration item is loaded and updated locally according to the consumed second message. Therefore, the second server only needs to consume the latest first message and update the latest first configuration item, and does not need to consume the historical first message, so that frequent updating of the first configuration item is reduced, consumption of the historical message is also reduced, and the updating efficiency and the updating time of the configuration item are improved.
In addition, the message middleware may also reserve the first message corresponding to the latest second timestamp and remove the first messages of other second timestamps when there are at least two first messages carrying different second timestamps. The consumption of the second server to the history message can be reduced, and the updating efficiency of the configuration items is improved.
The second server in this embodiment may obtain the latest first configuration item from the database after consuming the latest first message. Or the first server reads the modified first configuration item from the database and stores the modified first configuration item in the redis cache, and the second server acquires the latest first configuration item from the redis cache after consuming the latest first message. The speed of reading data from the redis cache is faster than the speed of reading data from the database, so that the speed of reading the modified first configuration item from the redis cache can be increased.
In one embodiment, before step S100, the method further comprises:
and if second messages generated by other first servers in the cluster are acquired before the initial configuration data in the database are loaded after the starting, and the second messages are used for indicating that the second configuration items are modified, directly loading other initial configuration data and the modified second configuration items in the database.
Specifically, after being started, the servers in the cluster read initial configuration data in the database and store the initial configuration data locally.
If the first server acquires the second message before loading the initial configuration data, other initial configuration data and the modified second configuration item in the database are directly loaded, so that the second configuration item is not modified after the initial configuration data is loaded, the operation flow is reduced, and the reading and updating of the configuration data are accelerated.
In addition, the second message carries a third timestamp, where the third timestamp is a modification timestamp of the second configuration item or a read timestamp of the second configuration item that is modified by the other first servers from the database.
And thirdly, the initial configuration data comprises the initial configuration data of the necessary configuration items, and the unnecessary configuration items to be used in the operation process of the server are loaded to the local part in the use process.
In one embodiment, step S100 specifically includes:
and if a plurality of configuration modification requests are received, generating a plurality of corresponding tasks according to the plurality of configuration modification requests, adding the tasks into the thread queue to queue for sequential execution.
Specifically, if a plurality of configuration modification requests are received by the same first server successively, each configuration modification request generates a write task, and the generated write tasks are added into the thread queue and queued for execution. The write tasks in the thread queue can be executed by a plurality of threads, in order to prevent the confusion of data modification caused by the simultaneous modification of the same first configuration item of the database, only one write task can be executed in the thread queue at each time, and the thread can execute another write task after the execution of the write task is completed.
In addition, in order to prevent the configuration data of the database from being modified by different servers at the same time to cause data modification confusion, a multithread lock can be added, and only one server is allowed to write the database at a time.
And modifying the configuration item in a non-high-frequency operation mode, reading the configuration data from the server locally when the configuration data is used, correspondingly updating the local configuration item after the configuration data of the database is modified by the server, performing reading and writing of the configuration data in parallel, considering multithreading reading and writing, cluster notification, message middleware exception processing and reading and writing of the database during modification, and still using the local configuration item of the server before the modification is completed.
The present application also provides a management system of configuration data, referring to fig. 1, the system including: a first server 10, a second server 20 and a database 30;
the first server 10 is configured to modify a first configuration item indicated by the configuration modification request in the database 30 according to the configuration modification request if the configuration modification request is received, read the modified first configuration item from the database 30 after the modification is completed, load and update the modified first configuration item to the local of the first server 10, generate a first message, the first message is used to indicate that the first configuration item is modified, notify the first message to the second server 20 in the cluster,
and the second server 20 is configured to update the local first configuration item after acquiring the first message.
In one embodiment, the system further includes message middleware (not shown),
the first server 10 is specifically configured to push the first message to the message middleware;
the second server 20 is specifically configured to, after monitoring and consuming the first message in the message middleware, load and update the modified first configuration item to a local location corresponding to the second server 20.
In one embodiment, the first server 10, in particular for broadcasting the first message by means of an http request to the second server 20 in the cluster,
the second server 20 is specifically configured to load and update the modified first configuration item to a local location corresponding to the second server 20 after receiving the first message.
In one embodiment, the first server 10 is further configured to broadcast the first message to the second servers 20 in the cluster by means of an http request if no notification of the received first message returned by the message middleware is received,
the second server 20 is specifically configured to load and update the modified first configuration item to a local location corresponding to the second server 20 after receiving the first message.
In one embodiment, the system further comprises a redis cache (not shown in the figure);
the first server 10 is specifically configured to read the modified first configuration item from the database 30 and store the modified first configuration item in the redis cache, set an expiration date as a first effective duration and set a corresponding first timestamp for the modified first configuration item stored in the redis cache,
a redis cache, configured to remove a first configuration item whose accumulated storage duration exceeds a first valid duration, where the first timestamp is a storage timestamp of the data stored in the redis cache or a read timestamp of the data read from the database 30 by the first server 10,
the first server 10 is further specifically configured to load and update the modified first configuration item to a local of the first server 10;
the second server 20 is specifically configured to preferentially acquire the modified first configuration item corresponding to the current latest first timestamp from the redis cache after the first message is acquired, and load and update the modified first configuration item corresponding to the current latest first timestamp to the local corresponding to the second server 20.
In one embodiment, the first message carries a second timestamp, where the second timestamp is a modification timestamp of the first configuration item or a reading timestamp of the first server 10 reading the modified first configuration item from the database 30;
the first server 10 is specifically configured to push the first message to the message middleware;
the second server 20 is specifically configured to, if at least two first messages carrying different second timestamps exist in the message middleware, consume the first message corresponding to the latest second timestamp and update the latest modified first configuration item with the local first configuration item.
In an embodiment, the first server 10 is further configured to, if a second message generated by other first servers 10 in the cluster is acquired before the initial configuration data in the database 30 is loaded after startup, and the second message is used to indicate that the second configuration item is modified, directly load the other initial configuration data and the modified second configuration item in the database 30.
Fig. 3 is a block diagram of a management apparatus for configuration data according to an embodiment of the present application. Referring to fig. 3, the management apparatus of configuration data includes:
a modification module 100, configured to modify, if a configuration modification request is received, a first configuration item indicated by the configuration modification request in a database according to the configuration modification request;
the reading and updating module 200 is configured to read the modified first configuration item from the database and load and update the modified first configuration item to the local of the first server after the modification is completed;
a message generating module 300, configured to generate a first message after the modification is completed, where the first message is used to indicate that the first configuration item is modified;
the first message notification module 400 is configured to notify a second server in the cluster of the first message, so that the second server updates the local first configuration item after acquiring the first message.
In an embodiment, the first message notification module 400 is specifically configured to push the first message to the message middleware, so that after the second server monitors and consumes the first message in the message middleware, the modified first configuration item is loaded and updated to the local corresponding to the second server.
In an embodiment, the first message notification module 400 is specifically configured to broadcast a first message to a second server in the cluster by means of an http request, so that the second server loads and updates the modified first configuration item to a local corresponding to the second server after receiving the first message.
In one embodiment, the apparatus further comprises:
and the second message notification module is used for broadcasting the first message to a second server in the cluster in an http request mode if the notification of the received first message returned by the message middleware is not received, so that the second server loads and updates the modified first configuration item to the local corresponding to the second server after receiving the first message.
In one embodiment, the read update module 200 includes:
the storage module is used for reading the modified first configuration item from the database and storing the modified first configuration item into a redis cache, setting an effective period as a first effective duration and setting a corresponding first timestamp for the modified first configuration item stored in the redis cache, and removing the first configuration item of which the accumulated storage duration exceeds the first effective duration by the redis cache, wherein the first timestamp is a storage timestamp stored in the redis cache or a reading timestamp of data read from the database by a first server,
the loading and updating module is used for loading and updating the modified first configuration item to the local of the first server;
the first message notification module 400 is specifically configured to notify the second server in the cluster of the first message, so that the second server preferentially obtains the modified first configuration item corresponding to the current latest first timestamp from the redis cache after obtaining the first message, and loads and updates the modified first configuration item corresponding to the current latest first timestamp to the local corresponding to the second server.
In one embodiment, the first message carries a second timestamp, where the second timestamp is a modification timestamp of the first configuration item or a read timestamp of the first server reading the modified first configuration item from the database;
the first message notification module 400 is specifically configured to push the first message to a message middleware, and if at least two first messages carrying different second timestamps exist in the message middleware, enable the second server to consume the first message corresponding to the latest second timestamp and then load and update the local first configuration item by using the latest modified first configuration item.
In one embodiment, the apparatus further comprises:
and the loading module is used for directly loading other initial configuration data and the modified second configuration item in the database if second messages generated by other first servers in the cluster are acquired before the initial configuration data in the database are loaded after the starting, and the second messages are used for indicating that the second configuration item is modified.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
Wherein the meaning of "first" and "second" in the above modules/units is only to distinguish different modules/units, and is not used to define which module/unit has higher priority or other defining meaning. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or modules is not necessarily limited to those steps or modules explicitly listed, but may include other steps or modules not explicitly listed or inherent to such process, method, article, or apparatus, and such that a division of modules presented in this application is merely a logical division and may be implemented in a practical application in a further manner.
For specific limitations of the management apparatus of the configuration data, reference may be made to the above limitations of the management method of the configuration data, which are not described herein again. The respective modules in the management apparatus of the configuration data may be entirely or partially implemented by software, hardware, and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
Fig. 4 is a block diagram of an internal structure of a computer device according to an embodiment of the present application. The computer device may specifically be the first server in fig. 1. As shown in fig. 4, the computer apparatus includes a processor, a memory, a network interface, an input device, and a display screen connected through a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory includes a storage medium and an internal memory. The storage medium may be a nonvolatile storage medium or a volatile storage medium. The storage medium stores an operating system and may also store computer readable instructions that, when executed by the processor, may cause the processor to implement a method of managing configuration data. The internal memory provides an environment for the operating system and execution of computer readable instructions in the storage medium. The internal memory may also have computer-readable instructions stored therein that, when executed by the processor, cause the processor to perform a method of managing configuration data. The network interface of the computer device is used for communicating with an external server through a network connection. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the computer equipment, an external keyboard, a touch pad or a mouse and the like.
In one embodiment, a computer device is provided, which includes a memory, a processor, and computer readable instructions (e.g., a computer program) stored on the memory and executable on the processor, and when the processor executes the computer readable instructions, the steps of the method for managing configuration data in the above embodiments are implemented, for example, steps S100 to S400 shown in fig. 2 and other extensions of the method and related steps. Alternatively, the processor, when executing the computer readable instructions, implements the functions of the modules/units of the management apparatus for configuration data in the above embodiments, such as the functions of the modules 100 to 400 shown in fig. 3. To avoid repetition, further description is omitted here.
The Processor may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. The general purpose processor may be a microprocessor or the processor may be any conventional processor or the like, the processor being the control center of the computer device and the various interfaces and lines connecting the various parts of the overall computer device.
The memory may be used to store computer readable instructions and/or modules that the processor implements by running or executing and invoking data stored in the memory, various functions of the computer device. The memory may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, video data, etc.) created according to the use of the cellular phone, etc.
The memory may be integrated in the processor or may be provided separately from the processor.
It will be appreciated by those skilled in the art that the configuration shown in fig. 4 is a block diagram of only a portion of the configuration associated with the present application, and is not intended to limit the computing device to which the present application may be applied, and that a particular computing device may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer readable storage medium is provided, on which computer readable instructions are stored, which when executed by a processor implement the steps of the method for managing configuration data in the above embodiments, such as the steps S100 to S400 shown in fig. 2 and extensions of other extensions and related steps of the method. Alternatively, the computer readable instructions, when executed by the processor, implement the functions of the modules/units of the management apparatus of configuration data in the above-described embodiments, such as the functions of the modules 100 to 400 shown in fig. 3. To avoid repetition, further description is omitted here.
It will be understood by those of ordinary skill in the art that all or part of the processes of the methods of the embodiments described above may be implemented by instructing associated hardware to implement computer readable instructions, which may be stored in a computer readable storage medium, and when executed, may include processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), double-rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), synchronous Link (Synchlink) DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and bus dynamic RAM (RDRAM).
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, apparatus, article, or method that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, apparatus, article, or method. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, apparatus, article or method that comprises the element.
The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments. Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solution of the present application may be substantially or partially embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) as described above and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present application.
The above description is only a preferred embodiment of the present application, and not intended to limit the scope of the present application, and all modifications of equivalent structures and equivalent processes, which are made by the contents of the specification and the drawings of the present application, or which are directly or indirectly applied to other related technical fields, are included in the scope of the present application.

Claims (11)

1. A method for managing configuration data, applied to a first server, is characterized in that the method comprises the following steps:
if a configuration modification request is received, modifying a first configuration item indicated by the configuration modification request in a database according to the configuration modification request;
after modification is completed, reading the modified first configuration item from the database, and loading and updating the first configuration item to the local of the first server;
after the modification is completed, generating a first message, wherein the first message is used for indicating that the first configuration item is modified;
and notifying a second server in the cluster of the first message, so that the second server updates the local first configuration item after acquiring the first message.
2. The method according to claim 1, wherein the notifying the first message to a second server in the cluster, so that the second server updates the local first configuration item after acquiring the first message, comprises:
and pushing the first message to a message middleware, so that the modified first configuration item is loaded and updated to the local corresponding to the second server after the second server monitors and consumes the first message in the message middleware.
3. The method according to claim 1, wherein the notifying the first message to a second server in the cluster, so that the second server updates the local first configuration item after acquiring the first message, includes:
and broadcasting the first message to a second server in the cluster in an http request mode, so that the second server loads and updates the modified first configuration item to the local corresponding to the second server after receiving the first message.
4. The method of claim 2, further comprising:
and if the notification that the first message is received and returned by the message middleware is not received, broadcasting the first message to a second server in the cluster in an http request mode, so that the second server loads and updates the modified first configuration item to the local corresponding to the second server after receiving the first message.
5. The method of claim 1,
the reading the modified first configuration item from the database and loading the update to the local of the first server includes:
reading the modified first configuration item from the database and storing the modified first configuration item into a redis cache, setting an effective period as a first effective duration and setting a corresponding first timestamp for the modified first configuration item stored in the redis cache, and removing the first configuration item of which the accumulated storage duration exceeds the first effective duration by the redis cache, wherein the first timestamp is a storage timestamp of data stored into the redis cache or a reading timestamp of data read from the database by the first server,
loading and updating the modified first configuration item to the local of the first server;
the enabling the second server to update the local first configuration item after acquiring the first message includes:
and after the second server acquires the first message, preferentially acquiring the modified first configuration item corresponding to the current latest first timestamp from the redis cache, and loading and updating the modified first configuration item corresponding to the current latest first timestamp to the local corresponding to the second server.
6. The method according to claim 1, wherein the first message carries a second timestamp, and the second timestamp is a modification timestamp of the first configuration item or a read timestamp of the first server reading the modified first configuration item from a database;
the notifying a second server in the cluster of the first message so that the second server updates the local first configuration item after acquiring the first message includes:
and pushing the first message to a message middleware, and if at least two first messages carrying different second timestamps exist in the message middleware, enabling the second server to consume the first message corresponding to the latest second timestamp and then load and update the local first configuration item by using the latest modified first configuration item.
7. The method of claim 1, wherein prior to said receiving a configuration modification request, said method further comprises:
and if second messages generated by other first servers in the cluster are acquired before the initial configuration data in the database are loaded after starting, and the second messages are used for indicating that the second configuration items are modified, directly loading other initial configuration data and the modified second configuration items in the database.
8. A system for managing configuration data, the system comprising: the system comprises a first server, a second server and a database;
the first server is configured to modify a first configuration item indicated by a configuration modification request in a database according to the configuration modification request if the configuration modification request is received, read the modified first configuration item from the database after the modification is completed, load and update the modified first configuration item to a local of the first server, generate a first message, where the first message is used to indicate that the first configuration item is modified, and notify a second server in a cluster of the first message,
and the second server is used for updating the local first configuration item after the first message is obtained.
9. An apparatus for managing configuration data applied to a first server, the apparatus comprising:
the modification module is used for modifying a first configuration item indicated by the configuration modification request in a database according to the configuration modification request if the configuration modification request is received;
the reading and updating module is used for reading the modified first configuration item from the database and loading and updating the modified first configuration item to the local of the first server after the modification is finished;
the message generation module is used for generating a first message after the modification is completed, wherein the first message is used for indicating that the first configuration item is modified;
and the first message notification module is used for notifying a second server in the cluster of the first message, so that the second server updates the local first configuration item after acquiring the first message.
10. A computer device comprising a memory, a processor and computer readable instructions stored on the memory and executable on the processor, wherein the processor when executing the computer readable instructions performs the steps of the method for managing configuration data according to any one of claims 1 to 7.
11. A computer readable storage medium having computer readable instructions stored thereon, which, when executed by a processor, cause the processor to perform the steps of the method of managing configuration data according to any one of claims 1-7.
CN202210709856.0A 2022-06-22 2022-06-22 Method, device, system, equipment and storage medium for managing configuration data Pending CN115118590A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210709856.0A CN115118590A (en) 2022-06-22 2022-06-22 Method, device, system, equipment and storage medium for managing configuration data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210709856.0A CN115118590A (en) 2022-06-22 2022-06-22 Method, device, system, equipment and storage medium for managing configuration data

Publications (1)

Publication Number Publication Date
CN115118590A true CN115118590A (en) 2022-09-27

Family

ID=83328789

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210709856.0A Pending CN115118590A (en) 2022-06-22 2022-06-22 Method, device, system, equipment and storage medium for managing configuration data

Country Status (1)

Country Link
CN (1) CN115118590A (en)

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107404509A (en) * 2016-05-20 2017-11-28 北京融聚世界网络科技有限公司 Distributed Services configure system and approaches to IM
CN107463511A (en) * 2017-01-23 2017-12-12 北京思特奇信息技术股份有限公司 A kind of data internationalization implementation method and device based on multi-level buffer
CN108132807A (en) * 2016-12-01 2018-06-08 北京云中融信网络科技有限公司 Parameter loading method and device
US20180248940A1 (en) * 2017-02-27 2018-08-30 International Business Machines Corporation Distributed data management
CN109586948A (en) * 2018-10-16 2019-04-05 深圳壹账通智能科技有限公司 Update method, apparatus, computer equipment and the storage medium of system configuration data
CN111563102A (en) * 2020-04-10 2020-08-21 中国联合网络通信集团有限公司 Cache updating method, server, system and storage medium
CN111770172A (en) * 2020-06-29 2020-10-13 深圳前海微众银行股份有限公司 Message middleware consumption proxy method, device, proxy server and storage medium
CN112069265A (en) * 2020-09-11 2020-12-11 中国工商银行股份有限公司 Configuration data synchronization method, service data system, computer system and medium
CN112994914A (en) * 2019-12-16 2021-06-18 厦门雅迅网络股份有限公司 Parameter unification configuration method and system for distributed multi-module cloud platform system
CN113220485A (en) * 2021-05-25 2021-08-06 金蝶软件(中国)有限公司 Processing method and device for remote procedure call service and readable storage medium
CN113641410A (en) * 2021-06-07 2021-11-12 广发银行股份有限公司 Netty-based high-performance gateway system processing method and system
CN114328618A (en) * 2021-11-30 2022-04-12 苏州浪潮智能科技有限公司 Cache data synchronization method, device, equipment and storage medium

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107404509A (en) * 2016-05-20 2017-11-28 北京融聚世界网络科技有限公司 Distributed Services configure system and approaches to IM
CN108132807A (en) * 2016-12-01 2018-06-08 北京云中融信网络科技有限公司 Parameter loading method and device
CN107463511A (en) * 2017-01-23 2017-12-12 北京思特奇信息技术股份有限公司 A kind of data internationalization implementation method and device based on multi-level buffer
US20180248940A1 (en) * 2017-02-27 2018-08-30 International Business Machines Corporation Distributed data management
CN109586948A (en) * 2018-10-16 2019-04-05 深圳壹账通智能科技有限公司 Update method, apparatus, computer equipment and the storage medium of system configuration data
CN112994914A (en) * 2019-12-16 2021-06-18 厦门雅迅网络股份有限公司 Parameter unification configuration method and system for distributed multi-module cloud platform system
CN111563102A (en) * 2020-04-10 2020-08-21 中国联合网络通信集团有限公司 Cache updating method, server, system and storage medium
CN111770172A (en) * 2020-06-29 2020-10-13 深圳前海微众银行股份有限公司 Message middleware consumption proxy method, device, proxy server and storage medium
CN112069265A (en) * 2020-09-11 2020-12-11 中国工商银行股份有限公司 Configuration data synchronization method, service data system, computer system and medium
CN113220485A (en) * 2021-05-25 2021-08-06 金蝶软件(中国)有限公司 Processing method and device for remote procedure call service and readable storage medium
CN113641410A (en) * 2021-06-07 2021-11-12 广发银行股份有限公司 Netty-based high-performance gateway system processing method and system
CN114328618A (en) * 2021-11-30 2022-04-12 苏州浪潮智能科技有限公司 Cache data synchronization method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
CN112260876B (en) Dynamic gateway route configuration method, platform, computer equipment and storage medium
CN107133234B (en) Method, device and system for updating cache data
CN110263275A (en) A kind of method, apparatus, mobile terminal and storage medium accessing webpage
CN109992354B (en) Container processing method, device, main body server, system and storage medium
CN107040576B (en) Information pushing method and device and communication system
CN110555041A (en) Data processing method, data processing device, computer equipment and storage medium
CN106302709B (en) A kind of method and system of network file management
CN107026879B (en) Data caching method and background application system
CN110968603B (en) Data access method and device
CN110781149A (en) Method, device, equipment and storage medium for managing live broadcast room information
CN112882738A (en) Configuration information updating method and device under micro-service architecture and electronic equipment
CN114528255A (en) Metadata management method, electronic device and computer program product
CN107025257B (en) Transaction processing method and device
CN112202834A (en) Data processing method, data processing device and node server
CN112860787A (en) Method for switching master nodes in distributed master-slave system, master node device and storage medium
CN113946427A (en) Task processing method, processor and storage medium for multi-operating system
CN113329051A (en) Data acquisition method and device and readable storage medium
CN115118590A (en) Method, device, system, equipment and storage medium for managing configuration data
CN111880910A (en) Data processing method and device, server and storage medium
CN111159233A (en) Distributed caching method, system, computer device and storage medium
CN114675902B (en) Management method and management device for software version based on embedded equipment
CN112115393B (en) Page loading method, system, device and medium
CN113961298A (en) Page switching method, device, equipment and medium
CN112115166A (en) Data caching method and device, computer equipment and storage medium
CN115037753B (en) Message notification method and system

Legal Events

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