CN113541987B - A method and device for updating configuration data - Google Patents
A method and device for updating configuration data Download PDFInfo
- Publication number
- CN113541987B CN113541987B CN202010301426.6A CN202010301426A CN113541987B CN 113541987 B CN113541987 B CN 113541987B CN 202010301426 A CN202010301426 A CN 202010301426A CN 113541987 B CN113541987 B CN 113541987B
- Authority
- CN
- China
- Prior art keywords
- configuration
- update
- updating
- zookeeper
- configuration item
- 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.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 70
- 230000004048 modification Effects 0.000 claims description 13
- 238000012986 modification Methods 0.000 claims description 13
- 238000004590 computer program Methods 0.000 claims description 9
- 238000012217 deletion Methods 0.000 claims description 6
- 230000037430 deletion Effects 0.000 claims description 6
- 230000008569 process Effects 0.000 description 27
- 238000012545 processing Methods 0.000 description 19
- 238000004891 communication Methods 0.000 description 8
- 238000010586 diagram Methods 0.000 description 8
- 230000006870 function Effects 0.000 description 8
- 230000008859 change Effects 0.000 description 4
- 230000003287 optical effect Effects 0.000 description 4
- 238000001914 filtration Methods 0.000 description 2
- 239000013307 optical fiber Substances 0.000 description 2
- 230000000644 propagated effect Effects 0.000 description 2
- 239000004065 semiconductor Substances 0.000 description 2
- 230000001360 synchronised effect Effects 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 239000000835 fiber Substances 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L41/00—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
- H04L41/08—Configuration management of networks or network elements
- H04L41/0803—Configuration setting
- H04L41/0813—Configuration setting characterised by the conditions triggering a change of settings
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L41/00—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
- H04L41/08—Configuration management of networks or network elements
- H04L41/0803—Configuration setting
- H04L41/0813—Configuration setting characterised by the conditions triggering a change of settings
- H04L41/082—Configuration setting characterised by the conditions triggering a change of settings the condition being updates or upgrades of network functionality
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Information Transfer Between Computers (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a method and a device for updating configuration data, and relates to the technical field of computers. The method comprises the steps of obtaining configuration update information according to connection between a pre-established ZooKeeper client and a ZooKeeper server, determining an update configuration item and an update type thereof according to the configuration update information, and updating configuration data in an Nginx shared memory according to the update configuration item and the update type thereof. This embodiment can shorten the time for updating the configuration data.
Description
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and apparatus for updating configuration data.
Background
Nginx is a high performance HTTP and reverse proxy web server. Because of the strong expansion capability, the Nginx is widely applied to service scenes such as system current limiting, malicious user filtering, load balancing and the like. Since the configuration data that the nginnx depends on in different traffic scenarios is different, it is necessary to update the configuration data according to the change of the traffic scenario.
In the prior art, configuration data is manually updated, and the update of the configuration data is completed by restarting Nginx.
However, in the prior art, it takes a long time to complete the update process, and the processing efficiency of the service data is reduced.
Disclosure of Invention
In view of this, the embodiments of the present invention provide a method and apparatus for updating configuration data, which can shorten the time for updating the configuration data.
In a first aspect, an embodiment of the present invention provides a method for updating configuration data, including:
Acquiring a configuration update message according to the connection between a pre-established ZooKeeper client and a ZooKeeper server;
determining an update configuration item and an update type thereof according to the configuration update message;
and updating the configuration data in the Nginx shared memory according to the update configuration item and the update type thereof.
Alternatively, the process may be carried out in a single-stage,
The method further comprises the steps of:
obtaining ZooKeeper configuration information;
and calling a ZooKeeper client to enable the ZooKeeper client to be connected with a ZooKeeper server according to the ZooKeeper configuration information.
Alternatively, the process may be carried out in a single-stage,
After the calling ZooKeeper client, before the acquiring the configuration update message, further comprises:
Acquiring configuration data in the ZooKeeper server through the ZooKeeper client;
And writing the configuration data acquired from the ZooKeeper server into the Nginx shared memory.
Alternatively, the process may be carried out in a single-stage,
Further comprises:
Generating configuration data structure information according to configuration data in the ZooKeeper server, wherein the configuration data structure information comprises a path and identifiers of configuration items under the path;
The configuration update message comprises an update path and an identifier of a configuration item under the update path;
the step of determining the update configuration item and the update type thereof according to the configuration update message comprises the following steps:
and determining the identification of the update configuration item and the update type thereof according to the update path, the identification of the configuration item under the update path, the identification of the path and the identification of the configuration item under the path.
Alternatively, the process may be carried out in a single-stage,
If the update type is a configuration item modification, the method further comprises:
Acquiring an update configuration value of the update configuration item in the ZooKeeper server through the ZooKeeper client;
The updating the configuration data in the Nginx shared memory according to the updating configuration item and the updating type thereof comprises the following steps:
and modifying the configuration value of the update configuration item in the Nginx shared memory into the update configuration value.
Alternatively, the process may be carried out in a single-stage,
If the update type is configuration item deletion, the method further comprises:
Deleting the identification of the update configuration item under the update path in the configuration data structure information;
The updating the configuration data in the Nginx shared memory according to the updating configuration item and the updating type thereof comprises the following steps:
and deleting the identifier and the configuration value of the updated configuration item in the Nginx shared memory.
Alternatively, the process may be carried out in a single-stage,
If the update type is a configuration item addition, the method further comprises:
Acquiring an update configuration value of the update configuration item in the ZooKeeper server through the ZooKeeper client;
Adding the identification of the updated configuration item under the updated path in the configuration data structure information;
The updating the configuration data in the Nginx shared memory according to the updating configuration item and the updating type thereof comprises the following steps:
and adding the identification of the update configuration item and the update configuration value into the Nginx shared memory.
In a second aspect, an embodiment of the present invention provides an apparatus for updating configuration data, including:
The configuration management module is configured to acquire a configuration update message according to the connection between the pre-established ZooKeeper client and the ZooKe eper server;
and the configuration updating module is configured to update the configuration data in the Nginx shared memory according to the update configuration item and the update type thereof.
Alternatively, the process may be carried out in a single-stage,
The configuration management module is configured to acquire an update configuration value of the update configuration item in the ZooKeeper server through the ZooKeeper client if the update type is configuration item modification;
The configuration updating module is configured to modify the configuration value of the updating configuration item in the Nginx shared memory into the updating configuration value.
In a third aspect, an embodiment of the present invention provides an electronic device, including:
One or more processors;
Storage means for storing one or more programs,
The one or more programs, when executed by the one or more processors, cause the one or more processors to implement the methods of any of the embodiments described above.
In a fourth aspect, embodiments of the present invention provide a computer readable medium having stored thereon a computer program which, when executed by a processor, implements a method as in any of the embodiments described above.
The embodiment of the invention has the advantages that after the configuration data in the ZooKeeper server is updated, the ZooKeeper client can timely and quickly acquire the configuration update message and update the configuration data in the Nginx shared memory based on the configuration update message, and the updated configuration data can be immediately used for service processing without restarting the Nginx. Therefore, the embodiment of the invention can shorten the time spent in the updating process and improve the processing efficiency of the business data.
Further effects of the above-described non-conventional alternatives are described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a flow chart of a method of updating configuration data provided by one embodiment of the present invention;
FIG. 2 is a flow chart of a method of updating configuration data provided by another embodiment of the present invention;
FIG. 3 is a schematic diagram of an apparatus for updating configuration data according to an embodiment of the present invention;
FIG. 4 is a flow chart of a method of updating configuration data provided by yet another embodiment of the present invention;
FIG. 5 is an exemplary system architecture diagram in which embodiments of the present invention may be applied;
Fig. 6 is a schematic diagram of a computer system suitable for use in implementing an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention will now be described with reference to the accompanying drawings, in which various details of the embodiments of the present invention are included to facilitate understanding, and are to be considered merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
The Nginx shared memory can store configuration data of different service scenes, and the Nginx can realize services such as system current limiting, malicious user filtering, load balancing and the like according to the configuration data stored in the shared memory. Along with the change of the service requirement, the configuration data in the shared memory needs to be correspondingly adjusted. The prior art typically updates the configuration data in the shared memory manually and then restarts ng the ng x to validate the configuration data.
Since the nginnx needs to be restarted, it takes a long time to update the configuration data in the prior art, thereby affecting the processing of corresponding services by the nginnx.
In view of this, an embodiment of the present invention provides a method for updating configuration data, as shown in fig. 1, including:
And 101, acquiring a configuration update message according to the connection between the pre-established ZooKeeper client and the ZooKeeper server.
When the stored configuration data is updated, the ZooKeeper server can push a configuration update message to the ZooKeeper client. The configuration update message may include an identification of the configuration item under the update path. The configuration update message may further include information such as an identification of the update configuration item, an update type, and a value of the configuration item under the update path. The identification of the configuration item may be the name or number of the configuration item, etc.
In order to ensure the stability of the service, in an actual application scene, the ZooKeeper client interacts with a server on the ZooKeeper server cluster.
Step 102, determining an update configuration item and an update type according to the configuration update message.
The configuration update message may include an update type, which may also be determined based on changes in the configuration items before and after the update. The update configuration item may be one item or a plurality of items. The update type comprises configuration item addition, configuration item modification, configuration item deletion and the like. For example, if the update configuration item is a and the update type is delete, then a in the nginnx shared memory is deleted. If the update configuration item is B and the update type is increased, B is increased in the Nginx shared memory. If the update configuration item is C and the update type is modification, modifying C in the Nginx shared memory.
And 103, updating the configuration data in the Nginx shared memory according to the update configuration item and the update type thereof.
After the configuration data in the ZooKeeper server is updated, the ZooKeeper client can timely and quickly acquire the configuration update message, update the configuration data in the Nginx shared memory based on the configuration update message, and the updated configuration data can be immediately used for service processing without restarting the Nginx. Therefore, the embodiment of the invention can shorten the time spent in the updating process and improve the processing efficiency of the business data.
In one embodiment of the invention, the method further comprises:
obtaining ZooKeeper configuration information;
And calling the ZooKeeper client to enable the ZooKeeper client to be connected with the ZooKeeper server according to the ZooKeeper configuration information.
The ZooKeeper configuration information includes a ZooKeeper service cluster host, port information, a directory path of configuration data, and the like.
The ZooKeeper client can establish connection with the ZooKeeper server according to the ZooKeeper service cluster host and the port information, and obtain the configuration data in the ZooKeeper server through the directory path of the configuration data.
After the ZooKeeper client is connected with the ZooKeeper server, the function address for processing the configuration update message can be specified, and after the ZooKeeper client receives the configuration update message pushed by the ZooKeeper server, the configuration update message is put into the specified function address to trigger the processing of the subsequent configuration update message.
According to the embodiment of the invention, the ZooKeeper client is connected with the ZooKeeper server by calling the ZooKeeper client, so that the configuration data in the ZooKeeper server can be conveniently and rapidly stored in the shared memory.
After the ZooKeeper configuration information is obtained, before the ZooKeeper client is called, the method can further comprise verifying whether the ZooKeeper configuration information meets the preset configuration condition, if so, executing the call of the ZooKeeper client, otherwise, terminating the current flow. The configuration condition may be that the ZooKeeper configuration information includes a ZooKeeper service cluster host and port information, and the configuration condition may also be that the ZooKeeper configuration information includes a ZooKeeper service cluster host, port information and a directory path of configuration data.
In one embodiment of the present invention, after invoking the ZooKeeper client, before acquiring the configuration update message, the method further comprises:
Acquiring configuration data in a ZooKeeper server through a ZooKeeper client;
and writing configuration data obtained from the ZooKeeper server into the Nginx shared memory.
Before updating the configuration data in the Nginx shared memory, the existing configuration data in the ZooKeeper server needs to be written into the Nginx shared memory, so that the subsequent business processing is ensured to be smoothly carried out.
In the embodiment of the invention, the configuration data of all the configuration packets in the WATCHPATH directory are read and stored in the memory in Hashmap, HASHMAP KEY is the name of the configuration item, and value is the configuration value.
WATCHPATH catalogue is as follows:
the WATCHPATH directory is a directory path configured in the configuration information, the next level is a grouping node of the configuration data, and the next level of the grouping node is actual configuration data.
HASHMAP KEY is config1, and the corresponding value is the configuration value of config 1. config1, config2, and config3 may filter, load balance, and request routing traffic for malicious users, respectively.
Compared with the method for manually writing the existing configuration data in the ZooKeeper server into the Nginx shared memory, the embodiment of the invention does not need to restart the Nginx and does not influence the service processing process.
In one embodiment of the invention, the method further comprises:
Generating configuration data structure information according to configuration data in a ZooKeeper server, wherein the configuration data structure information comprises identifiers of paths and configuration items under the paths;
The configuration update message comprises an update path and an identifier of a configuration item under the update path;
determining an update configuration item and an update type thereof according to the configuration update message, including:
and determining the identification of the update configuration item and the update type thereof according to the update path, the identification of the update configuration item under the update path and the identification of the configuration item under the path.
The configuration data structure information has the structure that:
the hash_map < string, set < string > >, the outer hash_map structure key is the path, and the value is the identification of all configuration items contained in the path.
For example, the content stored under the/WATCHPATH/configGroup 1 directory is,
key:/watchPath/configGroup1
Value, set containing two string members of config1 and config 2.
For example, the configuration data structure information before update, that is, the directory structure of the configuration data in the ZooKeeper server before update is:
The configuration update message comprises that the update path is/WATCHPATH/configGroup 1, and the identifier of the configuration item under the update path is config2. As can be seen from the configuration update message,/WATCHPATH/conf igGroup1, the configuration items are updated, and the identifiers of the configuration items config1 are absent after the update by comparing the identifiers of the configuration items before and after the update with the identifiers of the configuration items WATCHPATH/configGr oup, so that the update operation is to delete the configuration items config1.
If the identifiers of the configuration items under the update path are config1, config2, and config4, the update operation is to add the configuration item config4.
If the identifiers of the configuration items under the update path are config1 and config2, the update operation is to modify the configuration items config1 and config2, that is, if the identifiers of the configuration items under the update path have not changed, the values of the respective configuration items under the update path are modified.
The embodiment of the invention determines which change happens to the configuration item under which path through the configuration data structure information, can reduce the number of data transmission between the ZooKeeper client and the ZooKeeper server and the times that the ZooKeeper client accesses the ZooKeeper server, and simultaneously quickens the updating efficiency of the configuration data.
It should be noted that, in the actual application scenario, the identification of the update configuration item and the update type thereof may not be determined through the configuration data structure information. At this time, the configuration update message may include information such as an update type, an update path, and an identification of an update configuration item.
In one embodiment of the invention, if the update type is a configuration item modification, the method further comprises:
acquiring an update configuration value of an update configuration item in a ZooKeeper server through a ZooKeeper client;
updating the configuration data in the Nginx shared memory according to the update configuration item and the update type thereof, wherein the updating comprises the following steps:
and modifying the configuration value of the update configuration item in the Nginx shared memory into an update configuration value.
Along the above example, if configGroup a is modified, updating the configuration items to be config1 and config2, and obtaining the values of the configuration items config1 and config2 updated in the ZooKeeper server, namely the updated configuration values of config1 and config 2. Since the modification does not involve a change in the configuration data structure information, the embodiment of the present invention does not require updating the configuration data structure information.
In one embodiment of the present invention, if the update type is a configuration item delete, the method further comprises:
deleting the identification of the update configuration item under the update path in the configuration data structure information;
updating the configuration data in the Nginx shared memory according to the update configuration item and the update type thereof, wherein the updating comprises the following steps:
and deleting the identification and the configuration value of the updated configuration item in the Nginx shared memory.
Along the above example, after deleting the update configuration item config1, the configuration data structure information is changed to:
timely changing the configuration data structure information can ensure the accuracy and reliability of the subsequent updating configuration data.
In one embodiment of the present invention, if the update type is a configuration item addition, the method further comprises:
acquiring an update configuration value of an update configuration item in a ZooKeeper server through a ZooKeeper client;
adding an identifier of an update configuration item under an update path in the configuration data structure information;
updating the configuration data in the Nginx shared memory according to the update configuration item and the update type thereof, wherein the updating comprises the following steps:
And adding the identification of the update configuration item and the update configuration value into the Nginx shared memory.
Along the above example, if the update configuration item is config4 and the update type is configuration item increment, the configuration data structure information is changed to:
Similar to the deletion of the configuration item, the configuration data structure information needs to be adjusted in time after the configuration item is added to prevent errors in the subsequent update type and determination of the updated configuration item.
As shown in fig. 2, an embodiment of the present invention provides a method for updating configuration data, including:
step 201, obtaining ZooKeeper configuration information.
And 202, calling the ZooKeeper client so that the ZooKeeper client is connected with the ZooKeeper server according to the ZooKeeper configuration information.
And 203, acquiring configuration data in the ZooKeeper server through the ZooKeeper client.
And 204, writing configuration data obtained from the ZooKeeper server into the Nginx shared memory.
And 205, generating configuration data structure information according to configuration data in the ZooKeeper server, wherein the configuration data structure information comprises identifiers of paths and configuration items under the paths.
And 206, acquiring a configuration update message according to the connection between the ZooKeeper client and the ZooKeeper server, wherein the configuration update message comprises an update path and an identifier of a configuration item under the update path.
Step 207, determining the identity of the updated configuration item and the update type thereof according to the identity of the updated path, the identity of the configuration item under the updated path and the identity of the configuration item under the path, if the update type is the modification of the configuration item, executing step 208, if the update type is the deletion of the configuration item, executing step 209, and if the update type is the addition of the configuration item, executing step 210.
Step 208, obtaining the update configuration value of the update configuration item in the ZooKeeper server through the ZooKeeper client, and modifying the configuration value of the update configuration item in the Nginx shared memory into the update configuration value.
Step 209, deleting the identifier of the update configuration item under the update path in the configuration data structure information, and deleting the identifier and the configuration value of the update configuration item in the Nginx shared memory.
Step 210, obtaining an update configuration value of an update configuration item in the ZooKeeper server through the ZooKeeper client, adding an identifier of the update configuration item under an update path in configuration data structure information, and adding the identifier of the update configuration item and the update configuration value into the Nginx shared memory.
The embodiment of the invention updates the configuration data in the Nginx shared memory based on the ZooKeeper service without restarting the Nginx, and can reduce the influence of the configuration data update process on the business processing process. In addition, the embodiment of the invention can rapidly determine the update type based on the configuration data structure information, thereby improving the update efficiency of the configuration data and ensuring the update accuracy.
As shown in fig. 3, an embodiment of the present invention provides an apparatus for updating configuration data, including:
The configuration management module 301 is configured to obtain a configuration update message according to the connection between the pre-established ZooKeeper client and the ZooKeeper server;
The configuration updating module 302 is configured to update the configuration data in the nginnx shared memory according to the update configuration item and the update type thereof.
In one embodiment of the present invention, the configuration management module 301 is configured to obtain ZooKe eper configuration information, and call the ZooKeeper client to make the ZooKeeper client connect to the ZooKeeper server according to Zoo Keeper configuration information.
In one embodiment of the present invention, the configuration management module 301 is configured to obtain configuration data in the ZooKeeper server through the ZooKe eper client, and write the configuration data obtained from the ZooKeeper server into the nginnx shared memory.
In one embodiment of the present invention, the configuration management module 301 is configured to generate configuration data structure information according to the configuration data in the ZooKe eper server, where the configuration data structure information includes identifiers of paths and configuration items under the paths, and determines the identifiers of the update configuration items and the update types thereof according to the update paths, the identifiers of the configuration items under the update paths, and the identifiers of the configuration items under the paths.
In one embodiment of the present invention, if the update type is a configuration item modification, the configuration management module 301 is configured to obtain, by the ZooKeeper client, an update configuration value of an update configuration item in the ZooKeeper server;
The configuration updating module 302 is configured to modify the configuration value of the update configuration item in the nginnx shared memory into an update configuration value.
In one embodiment of the present invention, if the update type is a configuration item deletion, the configuration management module 301 is configured to delete the identifier of the update configuration item under the update path in the configuration data structure information;
the configuration update module 302 is configured to delete the identifier and the configuration value of the updated configuration item in the nginnx shared memory.
In one embodiment of the present invention, if the update type is that the configuration item is added, the configuration management module 301 is configured to obtain, through the ZooKeeper client, an update configuration value of the update configuration item in the ZooKeeper server;
The configuration update module 302 is configured to add the identification of the update configuration item and the update configuration value to the nginnx shared memory.
After the start-up, there are multiple independent Nginx workbench processes. The nmginx Worker process invokes the configuration management module 301 and the configuration update module 302, respectively, to implement updating of the configuration data.
Specifically, the nmginx Worker process loads the configuration management module 301 under OpenResty framework using the following statements:
lua_package_cpath"/export/soPath/configCenter.so;;"。
As shown in fig. 4, the configuration management module 301 sends an update configuration item and an update type thereof to the configuration update module 302 through an HTTP request, and the configuration update module 302 updates the configuration data in the nginnx shared memory according to the update configuration item and the update type thereof. In the practical application scenario, the configuration management module 301 and the configuration update module 302 run in the LuaJIT virtual machine in two threads, and since the LuaJIT virtual machine does not support multi-thread running, the HTTP protocol must be used to communicate between the configuration management module 301 and the configuration update module 302, if the communication is forced between the two threads directly, the nmginx Worker process is crashed, which causes an online accident.
As shown in fig. 4, nmginx is generally in a multi-process mode, and when the system is started, a plurality of nmginx Worker processes will perform initialization processing simultaneously, so that synchronization is required by using a security. Specifically, the nmginx Worker first determines whether a mark corresponding to the nmginx Worker exists in the shared memory, if the mark does not exist in the shared memory, then acquires the synchronous lock, loads the configuration management module, adds the mark in the nmginx shared memory after the configuration management module completes the initialization flow, so as to identify that the nmginx Worker completes the initialization of the configuration management module, and finally releases the synchronous lock. After the nmginx Worker releases the synchronization lock, other nmginx workers blocked by the lock can execute the initialization flow.
The configuration management module comprises the steps of establishing connection between a ZooKeeper client and a ZooKeeper server, acquiring configuration data in the ZooKeeper server through the ZooKeeper client, writing the configuration data acquired from the ZooKeeper server into an Nginx shared memory, and generating configuration data structure information according to the configuration data in the ZooKeeper server.
As shown in fig. 4, N nminbx Worker processes are obtained after nminbx is started, and a configuration management module and a configuration update module can be run in each nminbx Worker process. In fig. 4, only one nmginx Worker process runs the configuration management module and the configuration update module, and because the nmginx Worker process can update the configuration data in the nmginx shared memory, other nmginx Worker processes can share the updated configuration data and execute service logic based on the updated configuration data, so as to realize a corresponding service flow.
An embodiment of the present invention provides an electronic device, including:
One or more processors;
Storage means for storing one or more programs,
The one or more programs, when executed by the one or more processors, cause the one or more processors to implement the methods of any of the embodiments described above.
Fig. 5 illustrates an exemplary system architecture 500 of a method of updating configuration data or an apparatus of updating configuration data to which embodiments of the present invention may be applied.
As shown in fig. 5, the system architecture 500 may include terminal devices 501, 502, 503, a network 504, and a server 505. The network 504 is used as a medium to provide communication links between the terminal devices 501, 502, 503 and the server 505. The network 504 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
A user may interact with the server 505 via the network 504 using the terminal devices 501, 502, 503 to receive or send messages or the like. Various communication client applications may be installed on the terminal devices 501, 502, 503, such as shopping class applications, web browser applications, search class applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only).
The terminal devices 501, 502, 503 may be a variety of electronic devices having a display screen and supporting web browsing, including but not limited to smartphones, tablets, laptop and desktop computers, and the like.
The server 505 may be a server providing various services, such as a background management server (by way of example only) providing support for shopping-type websites browsed by users using the terminal devices 501, 502, 503. The background management server may analyze and process the received data such as the product information query request, and feedback the processing result (e.g., the target push information, the product information—only an example) to the terminal device.
It should be noted that, the method for updating configuration data provided by the embodiment of the present invention is generally performed by the server 505, and accordingly, the device for updating configuration data is generally disposed in the server 505.
It should be understood that the number of terminal devices, networks and servers in fig. 5 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 6, there is illustrated a schematic diagram of a computer system 600 suitable for use in implementing an embodiment of the present invention. The terminal device shown in fig. 6 is only an example, and should not impose any limitation on the functions and the scope of use of the embodiment of the present invention.
As shown in fig. 6, the computer system 600 includes a Central Processing Unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the system 600 are also stored. The CPU 601, ROM 602, and RAM 603 are connected to each other through a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
Connected to the I/O interface 605 are an input section 606 including a keyboard, a mouse, and the like, an output section 607 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, a speaker, and the like, a storage section 608 including a hard disk, and the like, and a communication section 609 including a network interface card such as a LAN card, a modem, and the like. The communication section 609 performs communication processing via a network such as the internet. The drive 610 is also connected to the I/O interface 605 as needed. Removable media 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is installed as needed on drive 610 so that a computer program read therefrom is installed as needed into storage section 608.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication portion 609, and/or installed from the removable medium 611. The above-described functions defined in the system of the present invention are performed when the computer program is executed by a Central Processing Unit (CPU) 601.
The computer readable medium shown in the present invention may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of a computer-readable storage medium may include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules involved in the embodiments of the present invention may be implemented in software or in hardware. The described modules may also be provided in a processor, for example, a processor may be described as comprising a sending module, an obtaining module, a determining module and a first processing module. The names of these modules do not in some cases limit the module itself, and for example, the transmitting module may also be described as "a module that transmits a picture acquisition request to a connected server".
As a further aspect, the invention also provides a computer readable medium which may be comprised in the device described in the above embodiments or may be present alone without being fitted into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to include:
Acquiring a configuration update message according to the connection between a pre-established ZooKeeper client and a ZooKeeper server;
determining an update configuration item and an update type thereof according to the configuration update message;
and updating the configuration data in the Nginx shared memory according to the update configuration item and the update type thereof.
According to the technical scheme provided by the embodiment of the invention, after the configuration data in the ZooKeeper server is updated, the ZooKeeper client can timely and quickly acquire the configuration update message, and update the configuration data in the Nginx shared memory based on the configuration update message, so that the updated configuration data can be immediately used for service processing without restarting the Nginx. Therefore, the embodiment of the invention can shorten the time spent in the updating process and improve the processing efficiency of the business data.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives can occur depending upon design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.
Claims (9)
1. A method of updating configuration data, comprising:
Acquiring a configuration update message according to the connection between a pre-established ZooKeeper client and a ZooKeeper server; before the configuration update message is acquired, the method further comprises the steps of acquiring configuration data in the ZooKeeper server through the ZooKeeper client;
The configuration updating message comprises an updating path and an identifier of the configuration item under the updating path, and determines the identifier of the updating configuration item and the updating type thereof according to the updating path, the identifier of the configuration item under the updating path, the identifier of the path and the identifier of the configuration item under the path;
and updating the configuration data in the Nginx shared memory according to the update configuration item and the update type thereof.
2. The method as recited in claim 1, further comprising:
obtaining ZooKeeper configuration information;
and calling a ZooKeeper client to enable the ZooKeeper client to be connected with a ZooKeeper server according to the ZooKeeper configuration information.
3. The method of claim 1, wherein,
If the update type is a configuration item modification, the method further comprises:
Acquiring an update configuration value of the update configuration item in the ZooKeeper server through the ZooKeeper client;
The updating the configuration data in the Nginx shared memory according to the updating configuration item and the updating type thereof comprises the following steps:
and modifying the configuration value of the update configuration item in the Nginx shared memory into the update configuration value.
4. The method of claim 1, wherein,
If the update type is configuration item deletion, the method further comprises:
Deleting the identification of the update configuration item under the update path in the configuration data structure information;
The updating the configuration data in the Nginx shared memory according to the updating configuration item and the updating type thereof comprises the following steps:
and deleting the identifier and the configuration value of the updated configuration item in the Nginx shared memory.
5. The method of claim 1, wherein,
If the update type is a configuration item addition, the method further comprises:
Acquiring an update configuration value of the update configuration item in the ZooKeeper server through the ZooKeeper client;
Adding the identification of the updated configuration item under the updated path in the configuration data structure information;
The updating the configuration data in the Nginx shared memory according to the updating configuration item and the updating type thereof comprises the following steps:
and adding the identification of the update configuration item and the update configuration value into the Nginx shared memory.
6. An apparatus for updating configuration data, comprising:
The configuration management module is configured to acquire a configuration update message according to the connection between a pre-established ZooKeeper client and a ZooKeeper server, determine an update configuration item and an update type thereof according to the configuration update message, acquire configuration data in the ZooKeeper server through the ZooKeeper client before acquiring the configuration update message, write the configuration data acquired from the ZooKeeper server into an Nginx shared memory, generate configuration data structure information according to the configuration data in the ZooKeeper server, wherein the configuration data structure information comprises a path and an identifier of a configuration item under the path, and the configuration update message comprises an update path and an identifier of the configuration item under the update path, and determine the identifier of the update configuration item and the update type thereof according to the update path, the identifier of the configuration item under the update path, the path and the identifier of the configuration item under the path;
and the configuration updating module is configured to update the configuration data in the Nginx shared memory according to the update configuration item and the update type thereof.
7. The apparatus of claim 6, wherein,
The configuration management module is configured to acquire an update configuration value of the update configuration item in the ZooKeeper server through the ZooKeeper client if the update type is configuration item modification;
The configuration updating module is configured to modify the configuration value of the updating configuration item in the Nginx shared memory into the updating configuration value.
8. An electronic device, comprising:
One or more processors;
Storage means for storing one or more programs,
When executed by the one or more processors, causes the one or more processors to implement the method of any of claims 1-5.
9. A computer readable medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to any of claims 1-5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010301426.6A CN113541987B (en) | 2020-04-16 | 2020-04-16 | A method and device for updating configuration data |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010301426.6A CN113541987B (en) | 2020-04-16 | 2020-04-16 | A method and device for updating configuration data |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113541987A CN113541987A (en) | 2021-10-22 |
CN113541987B true CN113541987B (en) | 2024-12-31 |
Family
ID=78120243
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010301426.6A Active CN113541987B (en) | 2020-04-16 | 2020-04-16 | A method and device for updating configuration data |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113541987B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114465882B (en) * | 2021-12-24 | 2024-10-01 | 天翼云科技有限公司 | Gateway configuration loading and obtaining method and device and computer equipment |
CN114489731B (en) * | 2022-01-26 | 2025-08-22 | 珠海金山数字网络科技有限公司 | Information processing method and device |
CN115695183A (en) * | 2022-10-26 | 2023-02-03 | 山石网科通信技术股份有限公司 | Configuration data processing method and device, storage medium and electronic equipment |
CN117579485B (en) * | 2024-01-12 | 2024-04-09 | 腾讯科技(深圳)有限公司 | Configuration changing method, device, equipment and storage medium |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106878376A (en) * | 2016-12-23 | 2017-06-20 | 微梦创科网络科技(中国)有限公司 | A configuration management method and system |
Family Cites Families (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090037929A1 (en) * | 2007-07-30 | 2009-02-05 | Tresys Technology, Llc | Secure Inter-Process Communications Using Mandatory Access Control Security Policies |
CN101702692B (en) * | 2009-10-30 | 2011-12-07 | 南京中兴软创科技股份有限公司 | System for updating information processing system thermally and method thereof |
US9135269B2 (en) * | 2011-12-07 | 2015-09-15 | Egnyte, Inc. | System and method of implementing an object storage infrastructure for cloud-based services |
US20190171650A1 (en) * | 2017-12-01 | 2019-06-06 | Chavdar Botev | System and method to improve data synchronization and integration of heterogeneous databases distributed across enterprise and cloud using bi-directional transactional bus of asynchronous change data system |
US9807154B2 (en) * | 2014-09-26 | 2017-10-31 | Lenovo Enterprise Solutions (Singapore) Pte, Ltd. | Scalable logging control for distributed network devices |
CN106850242A (en) * | 2015-12-03 | 2017-06-13 | 阿里巴巴集团控股有限公司 | A kind of information processing method and device |
CN106603281A (en) * | 2016-12-07 | 2017-04-26 | 乐视控股(北京)有限公司 | Configuration file management method and system |
CN108712457B (en) * | 2018-04-03 | 2022-06-07 | 苏宁易购集团股份有限公司 | Method and device for adjusting dynamic load of back-end server based on Nginx reverse proxy |
CN109343979A (en) * | 2018-09-28 | 2019-02-15 | 珠海沙盒网络科技有限公司 | A kind of configuring management method and system |
CN110968356B (en) * | 2018-09-29 | 2023-09-29 | 北京金山云网络技术有限公司 | Method and device for acquiring configuration information |
CN109347675B (en) * | 2018-10-31 | 2022-04-08 | 新华三大数据技术有限公司 | Server configuration method and device and electronic equipment |
CN109460389B (en) * | 2018-11-29 | 2021-08-06 | 四川长虹电器股份有限公司 | OpenResty-based log recording method |
CN109976872B (en) * | 2019-02-21 | 2021-05-18 | 北京达佳互联信息技术有限公司 | Data processing method and device, electronic equipment and storage medium |
-
2020
- 2020-04-16 CN CN202010301426.6A patent/CN113541987B/en active Active
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106878376A (en) * | 2016-12-23 | 2017-06-20 | 微梦创科网络科技(中国)有限公司 | A configuration management method and system |
Also Published As
Publication number | Publication date |
---|---|
CN113541987A (en) | 2021-10-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN113541987B (en) | A method and device for updating configuration data | |
CN111258627B (en) | Interface document generation method and device | |
CN106487869A (en) | For being controlled to labeling data and standardized cloudy network agent | |
US20200213365A1 (en) | Tag-Based Security Policy Creation in a Distributed Computing Environment | |
US11722481B2 (en) | Multiple identity provider authentication system | |
US11882154B2 (en) | Template representation of security resources | |
CN113517985B (en) | File data processing method and device, electronic equipment and computer readable medium | |
CN111427701A (en) | Workflow engine system and business processing method | |
CN106570097A (en) | Sequence generating method and device | |
CN112015383B (en) | A login method and device | |
WO2025158261A1 (en) | Request processing method and apparatus, and task execution method and apparatus | |
CN119415219A (en) | Container image acquisition method, device, equipment, medium and program product | |
CN112925628A (en) | Service management method and device | |
CN115114364B (en) | Method, device, apparatus and computer-readable medium for matching interface | |
WO2024045646A1 (en) | Method, apparatus and system for managing cluster access permission | |
CN117194068A (en) | Cross-process data transmission method, system, equipment and storage medium | |
CN113556370B (en) | Service calling method and device | |
CN116455616A (en) | Method, device, system, equipment and medium for synchronizing network security control strategy | |
CN112882741B (en) | Application management system and method | |
CN112306791B (en) | Performance monitoring method and device | |
CN113726885A (en) | Method and device for adjusting flow quota | |
CN113778969B (en) | A log processing method and device | |
CN113778703A (en) | An event monitoring method, related device and event monitoring system | |
CN113760487A (en) | Service processing method and device | |
CN117857209B (en) | A method, device and system for detecting email security |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |