Configuration information updating method, device, server and storage medium
By monitoring the configuration information modification status of the image audit server in the database, generating and sending update patches for local updates, it solves the problem of resource waste and low efficiency caused by the image audit server frequently pulling configuration information, and achieves more efficient configuration information updates. and bandwidth savings.
Patent Information
- Application Number
- CN202010982755.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-17
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2040-09-17
AI Technical Summary
The image audit server frequently and proactively pulls the full amount of configuration information, resulting in resource waste and low efficiency, long database query time, and large bandwidth usage.
Monitor the modification status of the configuration information of the image audit server stored in the database, obtain the modification information, generate an update patch, and send it to the image audit server for local updates to avoid frequently pulling all configuration data.
Save the processing resources of the image review server, reduce the amount of database query data, improve update efficiency, and reduce data transmission bandwidth usage.
Smart Images

Figure CN114285744B
Abstract
Description
Technical Field
[0001] The embodiments of the present disclosure relate to the field of image review technology, and in particular to a configuration information updating method, device, server and storage medium. Background Art
[0002] Figure 1 This is a system architecture diagram of an image review service provided by related technologies. Figure 1 In the system shown, operators can modify the configuration information of the image review server on the configuration management interface. The information configured by operators on the configuration management interface is updated to the database through the Application Programming Interface (API) provided by the configuration server. The image review server pulls all the configuration information from the database through the API provided by the configuration server at preset intervals (for example, 30 seconds), and then writes the configuration information into the local configuration cache to replace the original configuration information. When an image review request arrives at the image review server, the image review server determines the review logic based on the information in the configuration cache.
[0003] However, in general, the configuration information of the image review server is modified less frequently. In order to obtain the latest configuration information as soon as possible, the image review server must actively pull the configuration information from the database once every preset time interval, which wastes the resources of the image review server. In addition, the amount of data pulled by the full pull method is large, which will result in a longer database query time and lower efficiency. At the same time, the data transmission will also take up more bandwidth resources. Summary of the invention
[0004] In order to solve the above technical problem or at least partially solve the above technical problem, the embodiments of the present disclosure provide a method, device, server and storage medium for updating configuration information.
[0005] A first aspect of an embodiment of the present disclosure provides a method for updating configuration information, the method comprising: monitoring the modification status of configuration information of an image review server stored in a database; in response to monitoring that the configuration information of the image review server has been modified, obtaining modification information of the configuration information; generating an update patch based on the acquired modification information; and sending the update patch to the image review server so that the image review server updates the locally stored configuration information according to the update patch.
[0006] A second aspect of the present disclosure provides a configuration information updating device, comprising:
[0007] A monitoring module, used to monitor the modification status of the configuration information of the image review server stored in the database;
[0008] An acquisition module, used for acquiring modification information of the configuration information when the monitoring module monitors that the configuration information of the image review server is modified;
[0009] A generation module, used for generating an update patch based on the modification information;
[0010] The sending module is used to send the update patch to the image review server, so that the image review server updates the locally stored configuration information according to the update patch.
[0011] A third aspect of the embodiments of the present disclosure provides a database server, including a memory and a processor;
[0012] The memory stores a computer program, and the processor executes the computer program to implement the method described in the first aspect above.
[0013] A fourth aspect of an embodiment of the present disclosure provides a computer-readable storage medium on which a computer program is stored. The computer program is executed by a processor to implement the method described in the first aspect.
[0014] Compared with the prior art, the technical solution provided by the embodiments of the present disclosure has the following advantages:
[0015] The disclosed embodiment monitors the modification status of the configuration information of the image audit server stored in the database, obtains the modification information of the configuration information when it monitors that the configuration information of the image audit server is modified, generates an update patch based on the modification information, and sends the update patch to the image audit server so that the image audit server can update the locally stored configuration information. Since the image audit server in the disclosed embodiment passively receives the update patch of the configuration information, it does not need to actively and frequently pull all the configuration data from the database as in the related art, thus saving the processing resources required for the image audit server to frequently pull the configuration information. In addition, compared with the method of pulling the configuration information in full, the disclosed embodiment sends the modification information of the configuration information to the image audit server through the update patch, which requires less data to be queried by the database, has higher update efficiency, and the bandwidth required to transmit the update patch is less than the bandwidth required to transmit all the configuration information, which can effectively save the bandwidth for data transmission. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0017] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0018] Figure 1 It is a system architecture diagram of an image review service provided by related technologies;
[0019] Figure 2 is a schematic diagram of the structure of a database server provided by an embodiment of the present disclosure;
[0020] Figure 3 is a flow chart of a method for initializing a database server provided by an embodiment of the present disclosure;
[0021] Figure 4 is a flow chart of a method for updating configuration information provided by an embodiment of the present disclosure;
[0022] Figure 5 is an architecture diagram of a configuration information updating system provided by an embodiment of the present disclosure;
[0023] Figure 6 is a flow chart of a method for updating configuration information provided by an embodiment of the present disclosure;
[0024] Figure 7 is a structural diagram of a device for updating configuration information provided by an embodiment of the present disclosure;
[0025] Figure 8 It is a structural diagram of another database server provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0026] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.
[0027] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.
[0028] Figure 2 Schematic diagram of the structure of a database server provided by an embodiment of the present disclosure. Figure 2As shown, the database server is equipped with a container cluster management system kubernetes, which can be used to manage the container nodes (PODs) of the database. In kubernetes, a POD can include multiple containers, and the containers in the same POD can share a data volume. The database in this embodiment can be used to store the configuration information of the image audit server, and the configuration information at least includes the audit logic of the image audit server. The POD referred to in this embodiment can be divided into at least two categories: the master node (or master node) and the slave node (or slave node). Among them, the container in the master node can be used to make global decisions (for example: scheduling) on the database business, as well as detect and respond to cluster events. The container in the slave node can be used to run the business services of the database, such as data transmission, reading, writing, etc. The modification of the database by the container in the slave node will be recorded in the log file of the database, and the log file can be recorded on the data volume of the master node of the database, and can also be recorded on the data volume of the slave node at the same time.
[0029] based on Figure 2 For the database server shown, the embodiment of the present disclosure provides a configuration information update solution, which at least includes a database server initialization part and a configuration information update part.
[0030] For example, Figure 3 FIG. 1 is a flow chart of a method for initializing a database server provided by an embodiment of the present disclosure. Figure 3 As shown, the method includes:
[0031] Step 301: The database server starts the POD of the database.
[0032] Specifically, the database server can start the POD of the database through the "kubectl apply –f" command of the kubernetes system, wherein the database referred to in this embodiment can be exemplarily understood as a relational database, such as a MySQL database.
[0033] Step 302: The database server defines a data volume for each POD of the database and mounts the host directory into the container of each POD.
[0034] Taking MySQL database as an example, in MySQL database, the host directory / mysql / data can be mounted to the container of POD. Of course, this is only an example and is not the only limitation of the present disclosure.
[0035] Step 303: The database server starts the initialization container of the kubernetes system, reads the host name of each POD respectively, and obtains the POD serial number from the host name. It determines whether the POD is a master node or a slave node according to the POD serial number, and performs initialization operations on the master node and the slave node.
[0036] Specifically, if the currently read POD number is 0, the current POD is determined to be a master node, and the configuration file of the master node in the initialization directory is copied to the data volume of the current POD. If the currently read POD number is not 0, the POD is determined to be a slave node, and the configuration file of the slave node in the initialization directory is copied to the data volume of the current POD, and business files (such as business files for data transmission, business files for data reading, and business files for data writing) are copied from the master node or other started slave nodes to the data volume of the POD.
[0037] Step 304: The database server starts the database container in the slave node through the official image of the database, and sets the path for reading and writing data in the container to be consistent with that of the slave node.
[0038] Step 305: The database server uses a liveness probe to check whether the database can run normally, and uses a readiness probe to check whether the database service is available.
[0039] Step 306: The database server starts a container in the master node for monitoring configuration updates, obtains the initialization content of the database log file, and monitors the modification status of the configuration information of the image review server stored in the database through the container.
[0040] The modification status includes modified and unmodified.
[0041] Step 307: The database server obtains all configuration information of the image review server from the database and sends it to the image review server, so that the image review server performs the image review task according to the configuration information.
[0042] This embodiment initializes the kubernetes system and starts the corresponding container to monitor the modification status of the configuration information stored in the database, so that the modification of the configuration information can be discovered in time, and the real-time update of the configuration information is guaranteed.
[0043] Figure 4 FIG. 1 is a flow chart of a method for updating configuration information provided by an embodiment of the present disclosure. Figure 4 As shown, the method may include the following steps:
[0044] Step 401: The database server monitors the modification status of the configuration information of the image review server stored in the database.
[0045] Step 402: In response to monitoring that the configuration information is modified, the database server obtains modification information of the configuration information.
[0046] Step 403: The database server generates an update patch based on the modification information.
[0047] Step 404: The database server sends the update patch to the image audit server, so that the image audit server updates the locally stored configuration information according to the update patch.
[0048] The database in this embodiment can be exemplarily understood as a relational database, which is used to store configuration information of the image review server, and the configuration information at least includes the review logic of the image review server and business information such as account information.
[0049] The modification status referred to in this embodiment includes two states: modified and unmodified.
[0050] For example, Figure 5 is an architecture diagram of a configuration information updating system provided by an embodiment of the present disclosure. Figure 5 In the architecture shown, the operator can modify the configuration information of the image review server stored in the database through the configuration management interface, and submit the modified content to the configuration server through the configuration management interface. The configuration server sends a modification request to the database server, and the modification request includes the modified content. After receiving the modification request, the database server calls the master node of the database based on the kubernetes system. The master node calls the slave node to run the corresponding program to modify the database, and records the modification information (for example, the database statement that executes the modification operation) in the database log file. The database log file can be recorded on the data volume of the slave node, or it can also be recorded on the data volume of the master node at the same time.
[0051] In an exemplary embodiment, the master node in the database server can be configured to read the log file of the database from the data volume of the POD of the database at intervals of a first preset time, and determine whether the configuration information stored in the database has been changed based on the content of the log file. For example, in an example, the master node can be configured to read the log file of the database from the data volume of itself and / or the slave node every 30 seconds. If the recording time of the most recent modification information recorded in the current log file is inconsistent with the recording time of the last modification information when the log file was read last time, then it is determined that the log file in the database has been modified. At this time, the newly added modification information after the last reading is obtained from the log file, and an update patch is generated according to the modification information, and the update patch is sent to the slave node. Of course, this is only an example description and not the only limitation of the present disclosure. In fact, in some other embodiments, the master node can also be configured to monitor the process used to modify the configuration information in the database server in real time. When the process is monitored to be started, the modification information of the configuration information in the database library is obtained from the log file of the database after the process is executed. The modification information can be exemplarily understood as a database statement used to modify the database.
[0052] For example, the slave node in the database server can obtain the Internet Protocol (IP) addresses and port numbers of all PODs of the image audit server by calling the endpoint application program interface (or endpoint API) of the kubernetes system. And send the update patch to the image audit server according to these IP addresses and port numbers, so that the image audit server updates the locally stored configuration information according to the update patch, and returns the update success message to the database server after the update is successful.
[0053] In this embodiment, by monitoring the modification status of the configuration information of the image audit server stored in the database, when monitoring that the configuration information of the image audit server is modified, the modification information of the configuration information is obtained, and an update patch is generated based on the modification information. By sending the update patch to the image audit server, the image audit server can update the locally stored configuration information. Since the image audit server in this embodiment passively receives the update patch of the configuration information, it is not necessary to actively and frequently pull all the configuration data from the database as in the related art, thus saving the processing resources required for the image audit server to frequently pull the configuration information. In addition, compared with the method of pulling the configuration information in full, the method of sending the modification information of the configuration information to the image audit server through the update patch in this embodiment requires less data to be queried by the database, and the update efficiency is higher. In addition, the bandwidth required to transmit the update patch is less than the bandwidth required to transmit all the configuration information, which can effectively save the bandwidth for data transmission.
[0054] Figure 6 is a flow chart of a method for updating configuration information provided by an embodiment of the present disclosure, such as Figure 6 As shown, the method may include:
[0055] Step 601: The database server monitors the modification status of the configuration information of the image review server stored in the database.
[0056] Step 602, the database server responds to monitoring that the configuration information is modified, and obtains the modification information of the configuration information.
[0057] Step 603: The database server generates an update patch based on the modification information.
[0058] Step 604: The database server sends the update patch to the image audit server, so that the image audit server updates the locally stored configuration information according to the update patch.
[0059] Step 605: In response to not receiving an update success message within a second preset time after sending the update patch, the database server resends the update patch to the image review server.
[0060] The second preset time can be set as needed and does not have to be limited to a specific time length.
[0061] Step 606: When the database server detects that it has not received an update success message fed back by the image review server after the update patch has been resent a preset number of times, it outputs an update failure notification message.
[0062] The preset number of times referred to in this embodiment can be set as needed and is not limited to a specific number.
[0063] For example, if no update success message of the image audit database is received within 20 minutes after the update patch is sent for the first time, the update patch is sent for the second time, and the timing starts after the sending is completed. If the timing reaches 20 minutes again, but the update success message is still not received, the third sending is performed, and so on, until the preset number of times (for example, 3 times) is reached, and the notification message of update failure is output in a preset form, such as voice or text. Of course, this is only an example and is not the only limitation of the present disclosure.
[0064] This embodiment can improve the update success rate and reliability by receiving an update success message after sending the update patch, and resending the update patch when the update success message is not received within a second preset time. By outputting an update failure notification message after a preset number of failures, operation and maintenance personnel can grasp the update status in time to solve the problem in time.
[0065] Figure 7 is a schematic diagram of the structure of a configuration information updating device provided by an embodiment of the present disclosure, and the device may be specifically a database server in the above embodiment, or a partial functional module of the database server. Figure 7 As shown, the updating device 70 includes:
[0066] A monitoring module 71, used to monitor the modification status of the configuration information of the image review server stored in the database;
[0067] The acquisition module 72 is used to acquire the modification information of the configuration information when the monitoring module monitors that the configuration information stored in the monitoring database is modified;
[0068] A generating module 73, used for generating an update patch based on the modification information of the configuration information;
[0069] The sending module 74 is used to send the update patch to the image review server, so that the image review server updates the locally stored configuration information according to the update patch.
[0070] In one implementation, the monitoring module 81 may include:
[0071] A reading unit, used for reading a log file of a database from a data volume of a container node POD of the database at intervals of a first preset time;
[0072] A determination module, used to determine whether the configuration information of the image review server has been changed based on the log file;
[0073] The log file is used to record the modification information of the configuration information.
[0074] In one implementation, the sending module 74 may include:
[0075] An acquisition unit, used to acquire the network interconnection protocol IP addresses and port numbers of all PODs of the image review server;
[0076] The sending unit is used to send the update patch to the POD of the image review server based on the acquired IP address and port number.
[0077] In one embodiment, the device 70 may further include:
[0078] The receiving module is used to receive the update success message fed back by the image review server.
[0079] In one implementation, the sending module 74 may also be used to:
[0080] In response to the receiving module not receiving an update success message within a second preset time after the update patch is sent, the update patch is resent to the image review server.
[0081] In one embodiment, the device 70 may further include:
[0082] The notification module is used to output a notification message of update failure when no update success message fed back by the image review server is received after the update patch is resent a preset number of times.
[0083] In one embodiment, the device 70 may further include:
[0084] The initialization module is used to start the POD of the database, perform initialization processing on the POD, and obtain the initial content of the log file of the database recorded on the data volume of the POD.
[0085] The device provided in this embodiment can be used to execute the method of any of the above method embodiments, and its execution method and beneficial effects are similar and will not be repeated here.
[0086] Figure 8 is a schematic diagram of the structure of another database server provided by an embodiment of the present disclosure, such as Figure 8 As shown, the database server 80 includes: a memory 81 and a processor 82;
[0087] The memory 81 stores a computer program, and the processor 82 executes the computer program to implement any of the above method embodiments.
[0088] The embodiments of the present disclosure further provide a computer-readable storage medium on which a computer program is stored. The computer program is executed by a processor to implement a method in any of the above method embodiments.
[0089] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0090] The above description is only a specific embodiment of the present disclosure, so that those skilled in the art can understand or implement the present disclosure. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to the embodiments described herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for updating configuration information, characterized in that: include: Monitor the modification status of the configuration information of the image review server stored in the database; In response to monitoring that the configuration information is modified, obtaining modification information of the configuration information; generating an update patch based on the modification information; Sending the update patch to the image audit server so that the image audit server updates the locally stored configuration information according to the update patch; The modification status of the configuration information of the image audit server stored in the monitoring database includes: Reading a log file of the database from a data volume of a container node POD of the database at a first preset time interval; determining whether configuration information of the image review server has been changed based on the log file; Wherein, the log file is used to record modification information of the configuration information; Before monitoring the modification status of the configuration information of the image audit server stored in the database, the method further includes: The POD of the database is started and initialized to obtain the initial content of the log file of the database recorded on the data volume of the POD.
2. The method according to claim 1, characterized in that The step of sending the update patch to the image review server comprises: Obtain the network interconnection protocol IP address and port number of the POD of the image review server; Based on the acquired IP address and port number, the update patch is sent to the POD of the image review server.
3. The method according to any one of claims 1 to 2, characterized in that: After sending the update patch to the image review server, the method further includes: Receive an update success message fed back by the image review server.
4. The method according to claim 3, characterized in that The method further comprises: In response to not receiving the update success message within a second preset time after sending the update patch, resending the update patch to the image review server.
5. The method according to claim 4, characterized in that The method further comprises: If no update success message is received from the image audit server after the update patch is resent a preset number of times, a notification message of update failure is output.
6. A configuration information updating device, characterized in that: include: A monitoring module, used to monitor the modification status of the configuration information of the image review server stored in the database; An acquisition module, configured to acquire modification information of the configuration information when the monitoring module monitors that the configuration information is modified; A generation module, used to generate an update patch based on the modification information; A sending module, used for sending the update patch to the image audit server, so that the image audit server updates the locally stored configuration information according to the update patch; The monitoring module comprises: A reading unit, used for reading a log file of a database from a data volume of a container node POD of the database at intervals of a first preset time; A determination module, used to determine whether the configuration information of the image audit server has been changed based on the log file; wherein the log file is used to record the modification information of the configuration information; Before the monitoring module, the device further includes: The initialization module is used to start the POD of the database, perform initialization processing on the POD, and obtain the initial content of the log file of the database recorded on the data volume of the POD.
7. A database server, characterized in that: include: Memory and processor; A computer program is stored in the memory, and the processor executes the computer program to implement the method according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and the computer program is executed by a processor to implement the method according to any one of claims 1 to 5.
