Method, apparatus and device for updating database configuration information, and medium

By automatically updating the database cluster user routing configuration by acquiring target metadata, the problem of missing and incorrect database cluster user routing configurations is solved, ensuring the completeness and correctness of routing configurations and improving the reliability of production line releases.

CN116340329BActive Publication Date: 2026-07-03PINGAN YIQIANBAO E COMMERCE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310257112.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-07
Publication Date
2026-07-03
Estimated Expiration
2043-03-07

AI Technical Summary

Technical Problem

In existing technologies, database cluster user routing configuration files are prone to omissions or errors, which can lead to users not being found or being deployed to the wrong cluster during production line deployment, thus affecting production line deployment.

Method used

By acquiring target metadata, the system connects to the target database cluster from the configuration management database, queries and updates the routing configuration file for each target user, and automatically updates the routing configuration at preset time intervals to ensure integrity and correctness.

Benefits of technology

Automatic updates of user routes in the database cluster were implemented, ensuring the integrity and correctness of the route configuration, avoiding omissions and errors caused by manual configuration, and improving the reliability of production line releases.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116340329B_ABST
    Figure CN116340329B_ABST
Patent Text Reader

Abstract

This invention relates to a method, apparatus, device, and medium for updating database configuration information. The method includes: acquiring target metadata; obtaining the target metadata from a configuration management database; connecting to various target databases in a target database cluster using the target metadata, and querying information about all target users in the target database cluster from each target database; updating the historical routing configuration file corresponding to each target user in the target database cluster according to a preset time interval based on the queried information of each target user in the target database cluster; the preset time interval is a period in which the frequency of user information changes is less than a preset threshold. Based on this, automatic updates of routes for all users on the production line are achieved, and the correctness and completeness of the routes are easily checked.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and in particular to methods, apparatus, devices and media for updating database configuration information. Background Technology

[0002] After a database user is created, the user's routing configuration file within the database cluster needs to be manually updated. However, since a database cluster may contain multiple users, and the number and location of users within the cluster change in real time, the user's routing configuration file also needs to be configured in real-time. This often leads to issues where users cannot be found during production deployment due to forgotten routing configuration files, impacting the deployment process. Furthermore, human configuration errors can go undetected, causing production deployments to the wrong cluster, ultimately resulting in deployment problems.

[0003] Therefore, how to automatically update the routing for all users on the production line, and facilitate the detection of the correctness and integrity of the routing, is an important research direction at present. Summary of the Invention

[0004] This invention provides a method, apparatus, device, and medium for updating database configuration information, which solves the problem that the routing configuration files of database cluster users are easily missed or erroneous in the prior art when manually configuring them. It enables automatic updating of routes for all users on the production line and facilitates the detection of the correctness and integrity of the routes.

[0005] A method for updating database configuration information, the method comprising: obtaining target metadata; wherein the target metadata is obtained from a configuration management database; connecting to each target database in a target database cluster through the target metadata, and querying information of all target users in the target database cluster from each target database; updating the historical routing configuration file corresponding to each target user in the target database cluster according to a preset time interval based on the information of each target user in the target database cluster; wherein the preset time interval is a time period in which the frequency of user information changes is less than a preset threshold.

[0006] In one embodiment, before updating the historical routing configuration file corresponding to each target user in the target database cluster according to preset time information based on the information of each target user in the target database cluster obtained by query, the method further includes: determining whether the historical routing configuration file corresponding to each target user exists; if the historical routing configuration file corresponding to the target user exists, obtaining and copying the historical routing configuration file corresponding to the target user; or, if the historical routing configuration file corresponding to the target user does not exist, creating an empty historical routing configuration file for the target user.

[0007] In one embodiment, the target metadata includes the administrator account password, the name of the target database cluster, the Internet Protocol addresses of the users included in the target database cluster, and the corresponding ports of the target databases. Accordingly, the step of connecting to each target database in the target database cluster using the target metadata and querying information of all target users in the target database cluster from each target database includes: connecting to the target database corresponding to the target user using the administrator account password, the name of the target database cluster, the Internet Protocol addresses of each target user included in the target database cluster, and the corresponding ports of the target databases in the target metadata; and querying information of all target users in the target database cluster from the target databases corresponding to each target user included in the target database cluster based on a preset query statement; wherein, the information of the target users includes the usernames of the target users.

[0008] In one embodiment, updating the historical routing configuration file corresponding to each target user in the target database cluster according to a preset time interval based on the information of each target user in the target database cluster obtained through querying includes: if it is determined that the historical routing configuration file corresponding to the target user exists, clearing the contents of the historical routing configuration file corresponding to the target user; saving the username of the target user obtained through querying, as well as the name of the target database cluster, Internet Protocol address, and port of the target database, in a preset format to the historical routing configuration file corresponding to the target user; or, if it is determined that the historical routing configuration file corresponding to the target user does not exist, saving the username of the target user obtained through querying, as well as the name of the target database cluster, Internet Protocol address, and port of the target database, in a preset format to an empty historical routing configuration file created for the target user.

[0009] In one embodiment, after acquiring and copying the historical routing configuration file corresponding to the target user; or after creating an empty historical routing configuration file for the target user, the method further includes: marking the historical routing configuration file corresponding to each target user with a corresponding time according to the current time.

[0010] In one embodiment, the method further includes: if any step in the method for updating the database configuration information fails, recording and displaying the exception and the step in which the exception occurred; if any step succeeds, recording and displaying the success and the step in which the success occurred.

[0011] In one embodiment, updating the historical routing configuration file corresponding to each target user in the target database cluster according to a preset time interval based on the information of each target user in the target database cluster obtained by querying includes: parsing the preset time interval to obtain a preset time interval; when the parsed preset time interval is the same as the current time, updating the historical routing configuration file corresponding to each target user in the target database cluster according to the preset time interval based on the information of each target user in the target database cluster obtained by querying.

[0012] An apparatus for updating database configuration information, the apparatus comprising: an acquisition module for acquiring target metadata; wherein the target metadata is acquired from a configuration management database; a processing module for connecting to various target databases in a target database cluster through the target metadata, and querying information of all target users in the target database cluster from the various target databases; and an update module for updating the historical routing configuration file corresponding to each target user in the target database cluster according to a preset time interval based on the information of each target user in the target database cluster obtained from the query; wherein the preset time interval is a time period in which the frequency of user information changes is less than a preset threshold.

[0013] A computer device includes a memory and a processor, the memory storing computer-readable instructions that, when executed by the processor, cause the processor to perform the steps of the database configuration information update method described above.

[0014] A storage medium storing computer-readable instructions, which, when executed by one or more processors, cause the one or more processors to perform the steps of the above-described method for updating database configuration information.

[0015] The aforementioned method, apparatus, device, and medium for updating database configuration information obtain target metadata from the configuration management database, thereby acquiring information on all users in the target database cluster. This lays the foundation for subsequent automatic updates of user routes based on user information and ensures the completeness of user information obtained from the target database cluster based on the target metadata. This guarantees that no user in the target database cluster is overlooked, ensuring the integrity of user route configurations while automatically updating routes for all users in the target database cluster. Furthermore, updating the historical route configuration file corresponding to each target user in the target database cluster according to preset time intervals ensures the correctness of user routes to a certain extent, avoiding errors caused by updating user route configuration files. Moreover, since all the above steps are performed by computer equipment, achieving automatic updates of user routes in the target database cluster, compared to existing manual user route configuration methods, facilitates recording and detecting problems at each step, thus facilitating the detection of route correctness. Attached Figure Description

[0016] Figure 1 This is a diagram illustrating the implementation environment of a database configuration information update method provided in one embodiment.

[0017] Figure 2 This is one of the flowcharts illustrating a method for updating database configuration information in one embodiment;

[0018] Figure 3 This is a second flowchart illustrating a method for updating database configuration information in one embodiment;

[0019] Figure 4 This is the third schematic block diagram of a method for updating database configuration information in one embodiment;

[0020] Figure 5 This is a structural block diagram of a database configuration information updating device in one embodiment;

[0021] Figure 6 This is a schematic diagram of an electronic device in one embodiment. Detailed Implementation

[0022] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0023] It should be noted that, unless otherwise defined, the technical or scientific terms used in this invention should have the ordinary meaning understood by one of ordinary skill in the art to which this invention pertains. The terms "first," "second," and similar terms used in this invention do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Terms such as "comprising" or "including" mean that the element or object preceding the word encompasses the elements or objects listed following the word and their equivalents, without excluding other elements or objects. Terms such as "connected" or "linked" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. Terms such as "upper," "lower," "left," and "right" are used only to indicate relative positional relationships; when the absolute position of the described object changes, the relative positional relationship may also change accordingly.

[0024] To facilitate understanding, the technical terms involved in this invention will first be explained.

[0025] (1) The configuration management database (CMDB) is a logical database that contains information about the entire lifecycle of configuration items and the relationships between them (including physical relationships, real-time communication relationships, non-real-time communication relationships, and dependencies). The CMDB stores and manages various configuration information of devices in the enterprise IT architecture. It is closely linked to all service support and service delivery processes, supporting the operation of these processes, realizing the value of configuration information, and relying on related processes to ensure the accuracy of the data.

[0026] (2) Internet Protocol (IP) is a network layer protocol in the TCP / IP architecture. The purpose of designing IP is to improve the scalability of the network: first, to solve the Internet problem and realize the interconnection of large-scale, heterogeneous networks; second, to separate the coupling relationship between top-level network applications and bottom-level network technologies, so as to facilitate the independent development of both.

[0027] (3) Cluster

[0028] A cluster is a computer system that uses a loosely integrated set of computer software and / or hardware connected together to perform computational tasks in a highly collaborative manner. In a sense, they can be considered a single computer. The individual computers in a cluster system are typically called nodes, and they are usually connected via a local area network (LAN), although other connection methods are also possible. Cluster computers are often used to improve the computing speed and / or reliability of individual computers. Generally, cluster computers offer a much higher performance-to-price ratio than single computers, such as workstations or supercomputers.

[0029] A database cluster uses at least two or more database servers to form a virtual, single logical database image, providing transparent data services to clients just like a single database system.

[0030] The following is combined with Figures 1-6 This invention describes a method, apparatus, device, and medium for updating database configuration information.

[0031] Figure 1 This is a diagram illustrating the implementation environment of a database configuration information update method provided in one embodiment, including computer device 110 and terminal device 120.

[0032] Computer device 110 is a device for updating database configuration information. Computer device 110 can acquire target metadata; wherein, the target metadata is used to connect to the target database on terminal device 120 to obtain user information in the target database cluster; through the target metadata, it connects to each target database in the target database cluster and queries each target database to obtain information on all target users in the target database cluster; based on the information of each target user in the target database cluster obtained from the query, it updates the historical routing configuration file corresponding to each target user in the target database cluster according to preset time interval information. It can be understood that terminal device 120 can correspond to a database server in the database cluster, providing transparent data services to the client, including user information in the target database cluster.

[0033] It should be noted that terminal device 120 and computer device 110 can be smartphones, tablets, laptops, desktop computers, etc., but are not limited to these. Computer device 110 and terminal device 120 can be remotely connected via the IP protocol.

[0034] like Figure 2 As shown, in one embodiment, a method for updating database configuration information is proposed, which can be executed by the aforementioned computer device 110. Specifically, as... Figure 2 As shown, the method for updating database configuration information provided by the present invention may include the following steps:

[0035] Step 210: Obtain target metadata; wherein, the target metadata is obtained from the configuration management database.

[0036] Specifically, target metadata can be obtained from the CMDB. This target metadata is used to connect to each target database in the target database cluster to obtain information about all users within that cluster. It's understood that the target metadata contains information about at least one target database cluster. Therefore, obtaining target metadata from the configuration management database allows for the acquisition of information about all users in each of all target database clusters, laying the foundation for subsequent automatic updates of user routes based on this user information.

[0037] It can also be understood that each target database corresponds to a database within a target database cluster, and the target metadata can be used to connect to each target database in the target database cluster. In other words, partial user information for the target database cluster can be obtained from each target database in the target database cluster. Therefore, connecting to each target database in the target database cluster yields all user information for the entire target database cluster. This step lays the foundation for subsequent automatic updates of user routes based on user information and ensures the completeness of the user information for the target database cluster obtained subsequently based on the target metadata. This guarantees that no user in the target database cluster is missed, and while achieving automatic route updates for all users in the target database cluster, it also ensures the integrity of the user route configuration within the target database cluster.

[0038] Step 220: Connect to each target database in the target database cluster through the target metadata, and query the information of all target users in the target database cluster from each target database.

[0039] The information of all target users in the target database cluster refers to the information of users contained in all target databases within the target database cluster.

[0040] Specifically, information about all target users in a target database cluster can be retrieved from the target database using a pre-defined query statement. This pre-defined query statement can vary depending on the target database type. For example, for an Oracle database, the query statement "select username from dba_users" is used to retrieve information about all target users in the target database cluster, while for a MySQL database, the query statement "select user,host from mysql.user" is used.

[0041] Step 230: Based on the information of each target user in the target database cluster obtained from the query, update the historical routing configuration file corresponding to each target user in the target database cluster according to the preset time interval information.

[0042] The preset time period is the time period during which the frequency of user information changes is less than a preset threshold, such as from 0:00 AM to 5:00 AM.

[0043] It is understandable that by updating the historical routing configuration file corresponding to each target user in the target database cluster within a time period when the frequency of user information changes is less than a preset threshold, the correctness of user routing is guaranteed to a certain extent, and errors caused by updating the user routing configuration file are avoided.

[0044] It is also understandable that since steps 210 to 230 are all completed by computer equipment, the automatic updating of user routes in the target database cluster is achieved. Compared with the manual configuration of user routes in the prior art, it is easier to record and detect problems in each step, thereby facilitating the detection of the correctness of the routes.

[0045] The database configuration information update method provided by this invention obtains target metadata from the configuration management database, thereby acquiring information on all users in the target database cluster. This lays the foundation for subsequent automatic updates of user routes based on user information and ensures the completeness of user information obtained from the target database cluster based on the target metadata. This guarantees that no user in the target database cluster is missed, ensuring the integrity of user route configurations while automatically updating routes for all users in the target database cluster. Furthermore, updating the historical route configuration file corresponding to each target user in the target database cluster according to preset time intervals ensures the correctness of user routes to a certain extent, avoiding errors caused by updating user route configuration files. Moreover, since all the above steps are performed by computer equipment, achieving automatic updates of user routes in the target database cluster, compared with existing manual user route configuration methods, facilitates the recording and detection of problems at each step, thus facilitating the detection of route correctness.

[0046] In one embodiment, the target metadata includes the administrator account password, the name of the target database cluster, the Internet Protocol addresses of the users included in the target database cluster, and the corresponding port of the target database; accordingly, such as Figure 3 As shown, the target database is connected via the target metadata, and information about all target users in the target database cluster is retrieved from the target database, including:

[0047] Step 310: Connect to the target database corresponding to the target user by using the administrator account password, the name of the target database cluster, the Internet Protocol address of each target user in the target database cluster, and the port of the corresponding target database in the target metadata.

[0048] It is understandable that by connecting to the target database corresponding to the target user based on the administrator account and querying the target database to obtain the target user information of the target database cluster, it is possible to obtain the full user information of the target database cluster and ensure the integrity of the user routes in the target database cluster in subsequent updates.

[0049] Step 320: Based on a preset query statement, retrieve the target user information from the target database corresponding to the target user; wherein, the target user information includes the target user's username.

[0050] Specifically, the process of retrieving information about the target user from the target database cluster based on a preset query statement can be found in the relevant description of step 220, which will not be repeated here for the sake of brevity.

[0051] Figure 4 This is another flowchart illustrating the method for updating database configuration information provided in an embodiment of the present invention.

[0052] In one embodiment, such as Figure 4 As shown, before updating the historical routing configuration file corresponding to each target user in the target database cluster according to the preset time information based on the information of each target user in the target database cluster obtained by query, the method further includes steps 410, 4201 and 4202.

[0053] Step 410: Determine if the historical routing configuration file for each target user exists.

[0054] It is understandable that, in order to avoid abnormal issues caused by the absence of historical route configuration files, it is advisable to first determine whether the historical route configuration file corresponding to the target user exists before updating the historical route configuration file, and to perform different operations for different situations. For specific operations, please refer to steps 4201, 430 and 4401, as well as steps 4202 and 4402.

[0055] Step 4201: If it is determined that the historical routing configuration file corresponding to the target user exists, obtain and copy the historical routing configuration file corresponding to the target user.

[0056] Step 4202 corresponds to step 4201, and either step 4201 or step 4202 can be executed.

[0057] Step 4202: If it is determined that the historical route configuration file corresponding to the target user does not exist, an empty historical route configuration file is created for the target user.

[0058] In one embodiment, after obtaining and copying the historical route configuration file corresponding to the target user (i.e., after step 4201); or after creating an empty historical route configuration file for the target user (i.e., after step 4202), the method further includes:

[0059] Step 430: Mark the corresponding time in the historical route configuration file for each target user according to the current time.

[0060] In one embodiment, such as Figure 4 As shown, combining steps 410, 4201, 4202, and 430 above, after steps 410, 4201, and 430 are executed, step 4401 can be executed to update the historical routing configuration file for each target user in the target database cluster, if the historical routing configuration file for the target user exists. Alternatively, after steps 410, 4202, and 430 are executed, step 4402 can be executed to update the historical routing configuration file for each target user in the target database cluster, if the historical routing configuration file for the target user does not exist.

[0061] Step 4401: If it is determined that the historical routing configuration file corresponding to the target user exists, clear the contents of the historical routing configuration file corresponding to the target user; save the username of the target user obtained from the query, as well as the name of the target database cluster, the Internet Protocol address and the port of the target database, to the historical routing configuration file corresponding to the target user in a preset format.

[0062] The preset format can be a format using "#" as a separator, such as "target database cluster name#target user name#Internet Protocol address#target database port" (i.e., "cluster#username#ip#port").

[0063] Step 4402: If it is determined that the historical routing configuration file corresponding to the target user does not exist, the username of the target user obtained from the query, as well as the name of the target database cluster, the Internet Protocol address and the port of the target database, are saved in the empty historical routing configuration file created for the target user in a preset format.

[0064] It is understandable that, in order to avoid incorrect file content, if the historical routing configuration file corresponding to the target user exists, the historical routing configuration file corresponding to the target user can be copied first, and the updated historical routing configuration file corresponding to each target user can be marked with the corresponding time according to the current time. The latest user routing information can be written into the cleared historical routing configuration file, which can ensure the correctness of the historical routing configuration file to a certain extent.

[0065] In one embodiment, the method further includes: if the above Figure 2 If any step in the process fails, the exception and the step in which the exception occurred will be recorded and displayed; if the above... Figure 2 If any step in the process is executed successfully, the success and the successful step are recorded and displayed.

[0066] It is understandable that by displaying Figure 2 Recording the success or failure of each step in the process helps to document the user's routing configuration file update process. Recording and displaying exceptions and the steps where exceptions occurred helps to pinpoint the errors in the user's routing configuration file update process, and facilitates the detection of the correctness of the routes and the review of their completeness.

[0067] In one embodiment, based on the information of each target user in the target database cluster obtained through querying, the historical routing configuration file corresponding to each target user in the target database cluster is updated according to the preset time information, including: parsing the preset time information to obtain the preset time; when the parsed preset time is the same as the current time, based on the information of each target user in the target database cluster obtained through querying, the historical routing configuration file corresponding to each target user in the target database cluster is updated according to the preset time information.

[0068] The database configuration information updating device provided by the present invention will be described below. The database configuration information updating device described below corresponds to the database configuration information updating method described above.

[0069] Figure 5 A schematic block diagram of a database configuration information updating device provided by the present invention. Figure 5 As shown, the database configuration information updating device provided by the present invention includes:

[0070] The acquisition module 510 is used to acquire target metadata; wherein the target metadata is acquired from the configuration management database;

[0071] Processing module 520 is used to connect to each target database in the target database cluster through the target metadata, and query the information of all target users in the target database cluster from each target database;

[0072] The update module 530 is used to update the historical routing configuration file corresponding to each target user in the target database cluster according to the information of each target user in the target database cluster obtained by querying, and according to the preset time interval information; wherein, the preset time interval is the time period in which the frequency of user information change is less than a preset threshold.

[0073] The database configuration information updating device provided by this invention obtains target metadata from the configuration management database to acquire information on all users in the target database cluster. This lays the foundation for subsequent automatic updates of user routes based on user information and ensures the completeness of user information in the target database cluster obtained from the target metadata query. This guarantees that no user in the target database cluster is missed, and while automatically updating routes for all users in the target database cluster, the integrity of user route configurations in the target database cluster is also ensured. Furthermore, updating the historical route configuration file corresponding to each target user in the target database cluster according to preset time intervals ensures the correctness of user routes to a certain extent and avoids errors caused by updating user route configuration files. Moreover, since all the above steps are performed by computer equipment, achieving automatic updates of user routes in the target database cluster, compared with the manual configuration of user routes in the prior art, facilitates the recording and detection of problems in each step, thereby facilitating the detection of route correctness.

[0074] In one embodiment, the device further includes:

[0075] The determination module is used to determine whether the historical route configuration file corresponding to each target user exists;

[0076] The acquisition and copying module is used to acquire and copy the historical routing configuration file corresponding to the target user, provided that the historical routing configuration file corresponding to the target user exists; or,

[0077] A creation module is used to create an empty historical route configuration file for the target user if it is determined that the historical route configuration file corresponding to the target user does not exist.

[0078] In one embodiment, the processing module 520 includes:

[0079] The connection unit is used to connect to the target database corresponding to the target user by using the administrator account password, the name of the target database cluster, the Internet Protocol address of each target user contained in the target database cluster, and the port of the corresponding target database in the target metadata.

[0080] The query unit is used to query information of all target users in the target database cluster from the target databases corresponding to each target user in the target database cluster based on a preset query statement; wherein, the information of the target users includes the usernames of the target users.

[0081] In one embodiment, the update module 530 includes:

[0082] The clearing unit is used to, if it is determined that a historical routing configuration file corresponding to the target user exists, clear the contents of the historical routing configuration file corresponding to the target user; and save the queried username of the target user, the name of the corresponding target database cluster, the Internet Protocol address, and the port of the target database to the historical routing configuration file corresponding to the target user according to a preset format; or,

[0083] The storage unit is used to save the username of the target user, the name of the target database cluster, the Internet Protocol address, and the port of the target database, obtained by querying, into an empty historical routing configuration file created for the target user, in a preset format, if it is determined that the historical routing configuration file corresponding to the target user does not exist.

[0084] In one embodiment, the device further includes:

[0085] The tagging module is used to tag the corresponding time in the historical route configuration file for each target user according to the current time.

[0086] In one embodiment, the device further includes:

[0087] The recording and display module is used to record and display the exception and the step in which the exception occurred if any step in the method for updating the database configuration information fails; and to record and display the success and the step in which the success occurred if any step is executed successfully.

[0088] In one embodiment, the update module 530 includes:

[0089] The parsing unit is used to parse the preset timing information to obtain the preset timing time.

[0090] The update unit is used to update the historical routing configuration file corresponding to each target user in the target database cluster according to the preset time information, based on the information of each target user in the target database cluster obtained by querying, when the preset time interval obtained by parsing is the same as the current time.

[0091] In one embodiment, a computer device is provided, the computer device including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it performs the following steps: acquiring target metadata; wherein the target metadata is acquired from a configuration management database; connecting to each target database in a target database cluster through the target metadata, and querying information of all target users in the target database cluster from each target database; based on the information of each target user in the target database cluster obtained from the query, updating the historical routing configuration file corresponding to each target user in the target database cluster according to a preset time interval; wherein the preset time interval is a period of time in which the frequency of user information changes is less than a preset threshold.

[0092] Figure 6 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 6 As shown, the electronic device may include a processor 610, a communications interface 620, a memory 630, and a communication bus 640, wherein the processor 610, communications interface 620, and memory 630 communicate with each other via the communication bus 640. The processor 610 can call logical instructions in the memory 630 to execute the database configuration information update method provided by this invention. The database configuration information update method includes: obtaining target metadata; wherein the target metadata is obtained from a configuration management database; connecting to each target database in the target database cluster through the target metadata, and querying information of all target users in the target database cluster from each target database; and updating the historical routing configuration file corresponding to each target user in the target database cluster according to a preset time interval based on the queried information of each target user in the target database cluster; wherein the preset time interval is a period in which the frequency of user information changes is less than a preset threshold.

[0093] Furthermore, the logical instructions in the aforementioned memory 630 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0094] On the other hand, the present invention also provides a computer program product, the computer program product comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions, wherein when the program instructions are executed by a computer, the computer is able to execute the database configuration information update method provided by the present invention, wherein the database configuration information update method comprises: obtaining target metadata; wherein the target metadata is obtained from a configuration management database; connecting to each target database in a target database cluster through the target metadata, and querying information of all target users in the target database cluster from each target database; and updating the historical routing configuration file corresponding to each target user in the target database cluster according to a preset time interval based on the information of each target user in the target database cluster; wherein the preset time interval is a time period in which the frequency of user information changes is less than a preset threshold.

[0095] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements a method for updating database configuration information provided by the present invention. The method for updating database configuration information includes: obtaining target metadata; wherein the target metadata is obtained from a configuration management database; connecting to each target database in a target database cluster through the target metadata, and querying information of all target users in the target database cluster from each target database; updating the historical routing configuration file corresponding to each target user in the target database cluster according to a preset time interval based on the information of each target user in the target database cluster; wherein the preset time interval is a time period in which the frequency of user information changes is less than a preset threshold.

[0096] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0097] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0098] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method of updating database configuration information, characterized by, The method includes: Obtain target metadata; wherein, the target metadata is obtained from the configuration management database; Using the target metadata, connect to each target database in the target database cluster, and query the target database to obtain information about all target users in the target database cluster; Based on the information of each target user in the target database cluster obtained from the query, the historical routing configuration file corresponding to each target user in the target database cluster is updated according to the preset time information. The preset time interval is a period of time during which the frequency of user information changes is less than a preset threshold; The step of updating the historical routing configuration file corresponding to each target user in the target database cluster based on the information of each target user obtained from the query, according to preset time intervals, includes: If a historical routing configuration file corresponding to the target user exists, clear the contents of the historical routing configuration file corresponding to the target user; save the username of the target user, the name of the corresponding target database cluster, the Internet Protocol address, and the port of the target database to the historical routing configuration file corresponding to the target user according to a preset format; or, If it is determined that the historical routing configuration file corresponding to the target user does not exist, the username of the target user, the name of the target database cluster, the Internet Protocol address and the port of the target database obtained by querying are saved in a preset format to an empty historical routing configuration file created for the target user.

2. The method for updating database configuration information as described in claim 1, characterized in that, Before updating the historical routing configuration file corresponding to each target user in the target database cluster according to preset time intervals based on the information of each target user obtained from the query, the method further includes: Determine if a historical route configuration file exists for each target user; If it is determined that a historical routing configuration file corresponding to the target user exists, obtain and copy the historical routing configuration file corresponding to the target user; or, If it is determined that the historical route configuration file corresponding to the target user does not exist, an empty historical route configuration file is created for the target user.

3. The method for updating database configuration information as described in claim 2, characterized in that, The target metadata includes the administrator account password, the name of the target database cluster, the Internet Protocol addresses of each target user in the target database cluster, and the corresponding ports of the target databases; correspondingly, the step of connecting to each target database in the target database cluster through the target metadata and querying the information of all target users in the target database cluster from each target database includes: The target database corresponding to the target user is connected by using the administrator account password, the name of the target database cluster, the Internet Protocol address of each target user in the target database cluster, and the port of the corresponding target database in the target metadata. Based on a preset query statement, information about all target users in the target database cluster is obtained from the target databases corresponding to each target user contained in the target database cluster; wherein, the information about the target users includes the usernames of the target users.

4. The method for updating database configuration information as described in claim 2, characterized in that, After obtaining and copying the historical routing configuration file corresponding to the target user; or after creating an empty historical routing configuration file for the target user, the method further includes: marking the corresponding time for the historical routing configuration file corresponding to each target user according to the current time.

5. The method for updating database configuration information as described in claim 1, characterized in that, The method further includes: if any step in the method for updating the database configuration information fails, recording and displaying the exception and the step in which the exception occurred; if any step succeeds, recording and displaying the success and the step in which the success occurred.

6. The method for updating database configuration information as described in claim 1, characterized in that, The step of updating the historical routing configuration file corresponding to each target user in the target database cluster based on the information of each target user obtained from the query, according to preset time intervals, includes: The preset timing information is parsed to obtain the preset timing time; When the preset timeout obtained from the parsing is the same as the current time, based on the information of each target user in the target database cluster obtained from the query, the historical routing configuration file corresponding to each target user in the target database cluster is updated according to the preset timeout information.

7. A device for updating database configuration information, characterized in that, The device includes: The acquisition module is used to acquire target metadata; wherein the target metadata is acquired from the configuration management database; The processing module is used to connect to each target database in the target database cluster through the target metadata, and query the target database to obtain information of all target users in the target database cluster. The update module is used to update the historical routing configuration file corresponding to each target user in the target database cluster according to the information of each target user in the target database cluster obtained by querying, and according to the preset time interval information; wherein, the preset time interval is the time period in which the frequency of user information change is less than a preset threshold. The update module includes: The clearing unit is used to, if it is determined that a historical routing configuration file corresponding to the target user exists, clear the contents of the historical routing configuration file corresponding to the target user; and save the queried username of the target user, the name of the corresponding target database cluster, the Internet Protocol address, and the port of the target database to the historical routing configuration file corresponding to the target user according to a preset format; or, The storage unit is used to save the username of the target user, the name of the target database cluster, the Internet Protocol address, and the port of the target database, obtained by querying, into an empty historical routing configuration file created for the target user, in a preset format, if it is determined that the historical routing configuration file corresponding to the target user does not exist.

8. A computer device comprising a memory and a processor, wherein the memory stores computer-readable instructions, characterized in that, When the computer-readable instructions are executed by the processor, the processor performs the steps of the method for updating database configuration information as claimed in any one of claims 1 to 6.

9. A storage medium storing computer-readable instructions, characterized in that, When the computer-readable instructions are executed by one or more processors, the one or more processors perform the steps of the method for updating database configuration information as claimed in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Design method of distributed timed task system based on etcd cluster

    CN105872073A

  • Configuration file updating method and device, equipment and storage medium

    CN114721681A