Method and device for checking parameter configuration of database
By dynamically adjusting the database configuration check method, combining the dynamic parameter configuration library and whitelist, the accuracy problems caused by the static check library are solved, and more efficient database configuration check is achieved.
Patent Information
- Application Number
- CN202410009492.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-03
- Publication Date
- 2025-07-11
AI Technical Summary
In the prior art, the database configuration check library is static and cannot be modified dynamically, resulting in poor inspection accuracy and inability to adapt to the personalized configuration differences of different database nodes.
By obtaining the actual application parameters of the database, establishing a dynamic parameter configuration library and parameter whitelist, combining the default parameter configuration library for inspection, and dynamically adjusting the inspection logic to improve accuracy.
Improve the accuracy of database configuration checks, adapt to the personalized configuration of different database nodes, reduce false positives, and ensure the reliability of inspection results.
Smart Images

Figure CN120295992A_ABST
Abstract
Description
Technical Field
[0001] This application relates to database technologies, and particularly to a method and apparatus for checking parameter configurations of a database. Background Art
[0002] During the initial deployment and subsequent maintenance and management of a database, parameter configurations of the database are modified and optimized. For a large number of database clusters, in order to ensure the uniformity and standardization of database configurations, it is necessary to periodically check and adjust the parameters of the database configurations to ensure that the database environment configurations are consistent.
[0003] In related technologies, for parameter configuration checking of a database, a unified standard parameter configuration library is mainly formulated in advance to determine the standard value of each parameter. During the check, for each parameter of each database node, it is checked one by one against the parameter standard configuration library to obtain a final check result and determine whether the database configuration complies with the specifications.
[0004] However, the database configuration check library is static and cannot be dynamically modified, so the accuracy of the check is poor. Summary of the Invention
[0005] This application provides a method and apparatus for checking database configurations, which can check the parameter configurations of a target database according to multiple check contents, thereby improving the accuracy of the check.
[0006] On the one hand, this application provides a method for checking parameter configurations of a database, including:
[0007] Obtain a first parameter with non-unique corresponding parameter content from all parameters of the default parameter configuration library corresponding to the database, and obtain multiple parameter contents corresponding to the first parameter according to the actual application of the database, and obtain a dynamic parameter configuration library based on the first parameter and the parameter contents corresponding to the first parameter;
[0008] Obtain a second parameter existing in a preset parameter set from all parameters of the default parameter configuration library to obtain a parameter whitelist; where the parameters in the preset parameter set are parameters that do not require parameter content checking;
[0009] Check the parameters of the database configuration according to the default parameter configuration library, the dynamic parameter configuration library, and the parameter whitelist.
[0010] On the other hand, this application provides an apparatus for checking parameter configurations of a database, including: a memory and a processor, where the memory is used to store an executable program;
[0011] The processor is used to read and execute the executable program to implement the above method for checking parameter configurations of a database.
[0012] Compared with the related art, the present application includes obtaining a first parameter with non-unique corresponding parameter content from all parameters in a default parameter configuration library, obtaining multiple parameter contents corresponding to the first parameter based on the actual application of a database to obtain a dynamic parameter configuration library, obtaining a second parameter with corresponding parameter content that does not need to be checked from all parameters in the default parameter configuration library to obtain a parameter whitelist, and jointly checking the configuration of the target database with the default parameter configuration library, the dynamic parameter configuration library, and the parameter whitelist. Therefore, the configuration of the target database is checked according to multiple inspection contents, thereby improving the accuracy of the inspection.
[0013] Other features and advantages of the present application will be described in the following specification, and partly become obvious from the specification, or are understood by implementing the present application. Other advantages of the present application can be realized and obtained through the solutions described in the specification and the accompanying drawings. Description of the Drawings
[0014] The drawings are used to provide an understanding of the technical solutions of the present application, and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the technical solutions of the present application and do not constitute a limitation to the technical solutions of the present application.
[0015] Figure 1 It is a schematic flowchart of a method for checking parameter configuration of a database provided by an embodiment of the present application;
[0016] Figure 2 It is a schematic flowchart of another method for checking parameter configuration of a database provided by an embodiment of the present application. Detailed Embodiments
[0017] The present application describes multiple embodiments, but the description is exemplary rather than restrictive, and it is obvious to those of ordinary skill in the art that there can be more embodiments and implementation solutions within the scope of the embodiments described in the present application. Although many possible feature combinations are shown in the drawings and discussed in the detailed embodiments, many other combination ways of the disclosed features are also possible. Unless specifically restricted, any feature or element of any embodiment can be combined with any other feature or element in any other embodiment, or can replace any other feature or element in any other embodiment.
[0018] This application includes and contemplates combinations with features and elements known to those of ordinary skill in the art. The disclosed embodiments, features, and elements of this application can also be combined with any conventional features or elements to form unique inventive solutions defined by the claims. Any feature or element of any embodiment can also be combined with features or elements from other inventive solutions to form another unique inventive solution defined by the claims. Therefore, it should be understood that any feature shown and / or discussed in this application can be implemented alone or in any suitable combination. Therefore, the embodiments are not subject to other limitations except those made in accordance with the appended claims and their equivalents. In addition, various modifications and changes can be made within the scope of the appended claims.
[0019] In addition, when describing representative embodiments, the specification may have presented the method and / or process as a particular sequence of steps. However, to the extent that the method or process does not depend on the particular order of the steps described herein, the method or process should not be limited to the described particular order of steps. As will be understood by those of ordinary skill in the art, other step orders are possible. Therefore, the particular order of steps set forth in the specification should not be construed as a limitation on the claims. In addition, the claims directed to the method and / or process should not be limited to performing their steps in the order written, and those skilled in the art can readily understand that these orders can vary and still remain within the spirit and scope of the embodiments of this application.
[0020] An embodiment of this application provides a method for checking parameter configuration of a database, as Figure 1 shown, including:
[0021] Step 101: Obtain a first parameter with non-unique corresponding parameter content from all parameters of the default parameter configuration library corresponding to the database, and obtain multiple parameter contents corresponding to the first parameter according to the actual application of the database, and obtain a dynamic parameter configuration library based on the first parameter and the parameter contents corresponding to the first parameter;
[0022] Step 102: Obtain a second parameter existing in a preset parameter set from all parameters of the default parameter configuration library to obtain a parameter whitelist; wherein the parameters in the preset parameter set are parameters that do not require parameter content checking;
[0023] Step 103: Check the parameters configured in the database according to the default parameter configuration library, the dynamic parameter configuration library, and the parameter whitelist.
[0024] In the related art, for database parameter configuration checking, a unified parameter standard configuration library is mainly formulated in advance to determine the standard value of each parameter. During the check, for each parameter of each database node, it is checked one by one against the parameter standard configuration library to obtain the final check result and determine whether the database configuration meets the specifications. However, this check method is static and cannot be dynamically modified. Since the database roles of each node are different and the hardware configurations may also be different, the corresponding configuration parameters will also vary. Based on the default static configuration library for checking, false alarms with inconsistent results may occur, thus affecting the accuracy of the check.
[0025] The method for checking the parameter configuration of a database provided by an embodiment of the present application obtains a first parameter with non-unique corresponding parameter content from all the parameters of the default parameter configuration library, and obtains multiple parameter contents corresponding to the first parameter based on the actual application of the database to obtain a dynamic parameter configuration library. A second parameter whose corresponding parameter content does not need to be checked is obtained from all the parameters of the default parameter configuration library to obtain a parameter whitelist. The configuration of the target database is checked by combining the default parameter configuration library, the dynamic parameter configuration library, and the parameter whitelist. Therefore, the configuration of the target database is checked according to multiple check contents, thereby improving the accuracy of the check.
[0026] In an exemplary example, the checking of the parameters of the database configuration according to the default parameter configuration library, the dynamic parameter configuration library, and the parameter whitelist includes:
[0027] First, check the parameters of the database configuration according to the default parameter configuration library, and obtain target parameters whose parameter content is inconsistent with that in the default parameter configuration;
[0028] Secondly, check the target parameters according to the dynamic parameter configuration library and the parameter whitelist.
[0029] Exemplarily, the number of target parameters may be one or multiple.
[0030] In an exemplary example, the checking of the target parameters according to the dynamic parameter configuration library and the parameter whitelist includes:
[0031] For each of the target parameters, the following operations are performed:
[0032] First, determine whether the target parameter exists in the parameter whitelist;
[0033] If the target parameter exists in the parameter whitelist, skip reporting an error for the parameter content configuration of the target parameter;
[0034] If the target parameter does not exist in the parameter whitelist, check the target parameter according to the dynamic parameter configuration library.
[0035] In an exemplary instance, the checking the target parameter according to the dynamic parameter configuration library includes:
[0036] First, determine whether there is a comparison parameter in the dynamic parameter configuration library that is the same as the target parameter;
[0037] If there is a target comparison parameter in the dynamic parameter configuration library that is the same as the target parameter, determine whether the parameter content corresponding to the target parameter is the same as one of the multiple parameter contents corresponding to the target comparison parameter;
[0038] If the parameter content corresponding to the target parameter is the same as one of the multiple parameter contents corresponding to the target comparison parameter, skip the configuration error reporting for the parameter content of the target parameter.
[0039] In an exemplary instance, if there is a target comparison parameter in the dynamic parameter configuration library that is the same as the target parameter, it further includes:
[0040] Report an error for the target parameter.
[0041] In an exemplary instance, if the parameter content corresponding to the target parameter is not the same as any of the multiple parameter contents corresponding to the target comparison parameter, it further includes:
[0042] Report an error for the configuration of the parameter content of the target parameter.
[0043] In an exemplary instance, the first parameter includes at least one of the following: database memory quota, database read / write permission; wherein, the database memory quota corresponds to different database hardware configurations, and the database read / write permission corresponds to different database roles.
[0044] Exemplarily, different database hardware configurations correspond to different database memory quotas, and different database roles correspond to different database read / write permissions. Therefore, the database memory quota and the database read / write permission are first parameters with non-unique corresponding parameter contents.
[0045] In an exemplary instance, when the first parameter is the database read / write permission, when the database role is the primary database, the parameter content of the first parameter is read permission and write permission, and when the database role is the standby database, the parameter content of the first parameter is read permission.
[0046] In an exemplary instance, the second parameter includes at least one of the following: the host name of the server where the database is located, the IP address of the server where the database is located, the identification information of the database, and the global transaction ID of the database.
[0047] The embodiments of the present application further provide a method for checking the parameter configuration of a database, as Figure 2 shown, including:
[0048] Step 201, check the node database according to the default parameter configuration library;
[0049] Step 202, obtain the first parameter set with inconsistent check results;
[0050] Step 203, determine whether the first parameter set is empty. If the first parameter set is empty, execute step 208. If the first parameter set is not empty, execute step 204.
[0051] Step 204, filter the parameters in the first parameter set using the parameter whitelist to obtain the second parameter set that is not filtered out;
[0052] Step 205, determine whether the second parameter set is empty. If the second parameter set is empty, execute step 208. If the second parameter set is not empty, execute step 206;
[0053] Step 206, check the parameter content of the parameters in the second parameter set according to the dynamic parameter configuration library;
[0054] Step 207, determine whether the parameter content of the parameters in the second parameter set passes the check. If it passes the check, execute step 208. If there are parameters that do not pass the check, execute step 209;
[0055] Step 208, the check passes, and the parameter configuration is completely consistent;
[0056] Step 209, the check fails, and return the parameters that fail the check.
[0057] The parameter configuration checking method for the database provided by the embodiments of the present application uses the default parameter configuration library to perform the first-round check of the full configuration. If there is no inconsistent configuration in the check, the check is terminated, indicating that the configuration of the database node of this node is completely correct. Otherwise, the parameter whitelist is used for the second-round filtering to exclude some static configuration parameters that are related to the system and whose parameter inconsistencies are normal. If the filtering is complete, the configuration of the database node of this node is completely correct. Otherwise, the dynamic parameter configuration library is used for the third-round check. The dynamic parameter configuration library will be pre-entered, including configuration items with different configurations for different roles and different hardware configuration parameters. After establishing the dynamic configuration library, the third-round filtering is performed on the non-standard configuration items with reference to the dynamic configuration library. If there are still inconsistent items at this time, the inconsistent result set at this time is the final check result, and configuration modification is required.
[0058] The parameter configuration checking method for the database provided by the embodiments of the present application can be applicable to various scenarios, various architectures, and different types of database parameter checks. The check logic formulates a dynamic parameter library for special checks of dynamic configurations corresponding to the database type, database role, hardware configuration, etc. Together with the default parameter configuration library and the parameter whitelist, multiple rounds of verification are carried out to ensure the accuracy of the check results.
[0059] The embodiments of the present application also provide a parameter configuration checking device for a database, including: a memory and a processor, where the memory is used to store an executable program;
[0060] The processor is used to read and execute the executable program to implement the parameter configuration checking method for the database described in any of the above embodiments.
[0061] The parameter configuration checking device for the database provided by the embodiments of the present application obtains the first parameter with non-unique corresponding parameter content from all the parameters of the default parameter configuration library, and obtains multiple parameter contents corresponding to the first parameter based on the actual application of the database to obtain the dynamic parameter configuration library. The second parameter whose corresponding parameter content does not need to be checked is obtained from all the parameters of the default parameter configuration library to obtain the parameter whitelist. The configuration of the target database is checked by combining the default parameter configuration library, the dynamic parameter configuration library, and the parameter whitelist. Therefore, the configuration of the target database is checked according to multiple check contents, thereby improving the accuracy of the check.
[0062] Those of ordinary skill in the art will understand that all or some of the steps in the methods disclosed above, and the functional modules / units in systems and devices, can be implemented as software, firmware, hardware, or a suitable combination thereof. In the hardware implementation, the division of functional modules / units mentioned above does not necessarily correspond to the division of physical components; for example, one physical component may have multiple functions, or one function or step may be executed by several physical components in cooperation. Some or all components may be implemented as software executed by a processor, such as a digital signal processor or a microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit. Such software can be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or transitory medium). As is well known to those of ordinary skill in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information, such as computer-readable instructions, data structures, program modules, or other data. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cassettes, tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, as is well known to those of ordinary skill in the art, communication media typically contain computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transmission mechanism, and may include any information delivery medium.
Claims
1. A method for checking parameter configuration of a database, characterized in that Including: Obtain a first parameter with non-unique corresponding parameter content from all parameters of the default parameter configuration library corresponding to the database, obtain multiple parameter contents corresponding to the first parameter according to the actual application of the database, and obtain a dynamic parameter configuration library based on the first parameter and the parameter content corresponding to the first parameter; Obtain a second parameter existing in a preset parameter set from all parameters of the default parameter configuration library to obtain a parameter whitelist; wherein, the parameters in the preset parameter set are parameters that do not require parameter content inspection; Check the parameters configured for the database according to the default parameter configuration library, the dynamic parameter configuration library, and the parameter whitelist.
2. The method according to claim 1, wherein The checking the parameters configured for the database according to the default parameter configuration library, the dynamic parameter configuration library, and the parameter whitelist includes: Check the parameters configured for the database according to the default parameter configuration library, and obtain target parameters whose parameter content is inconsistent with the parameters in the default parameter configuration; Check the target parameters according to the dynamic parameter configuration library and the parameter whitelist.
3. The method according to claim 2, wherein The checking the target parameters according to the dynamic parameter configuration library and the parameter whitelist includes: For each of the target parameters, perform the following operations: Judge whether the target parameter exists in the parameter whitelist; If the target parameter exists in the parameter whitelist, skip reporting an error for the parameter content configuration of the target parameter; If the target parameter does not exist in the parameter whitelist, check the target parameter according to the dynamic parameter configuration library.
4. The method according to claim 3, wherein The checking the target parameter according to the dynamic parameter configuration library includes: Judge whether there is a comparison parameter consistent with the target parameter in the dynamic parameter configuration library; If there is a target comparison parameter consistent with the target parameter in the dynamic parameter configuration library, judge whether the parameter content corresponding to the target parameter is consistent with one of the multiple parameter contents corresponding to the target comparison parameter; If the parameter content corresponding to the target parameter is consistent with one of the multiple parameter contents corresponding to the target comparison parameter, skip reporting an error for the parameter content configuration of the target parameter.
5. The method according to claim 4, characterized in that, If there is a target comparison parameter consistent with the target parameter in the dynamic parameter configuration library, it further includes: Report an error for the target parameter.
6. The method according to claim 4, characterized in that, If the parameter content corresponding to the target parameter is inconsistent with all of the multiple parameter contents corresponding to the target comparison parameter, it further includes: Report an error for the parameter content configuration of the target parameter.
7. The method according to claim 1, wherein The first parameter includes at least one of the following: database memory quota, database read / write permission; wherein, the database memory quota corresponds to different database hardware configurations, and the database read / write permission corresponds to different database roles.
8. The method according to claim 7, wherein When the first parameter is the database read / write permission, when the database role is the primary database, the parameter content of the first parameter is read permission and write permission, and when the database role is the standby database, the parameter content of the first parameter is read permission.
9. The method according to claim 1, wherein The second parameter includes at least one of the following: the host name of the server where the database is located, the IP address of the server where the database is located, the identification information of the database, and the global transaction ID of the database.
10. An apparatus for checking parameter configuration of a database, comprising: A memory and a processor, where the memory is used to store an executable program; The processor is used to read and execute the executable program to implement the method for checking the parameter configuration of the database according to any one of claims 1-9.