Database configuration update method

By constructing a graph structure to evaluate the occurrence frequency and in-degree data of candidate nodes, the target candidate node is automatically determined, which solves the problem of low configuration update efficiency when node failure occurs in distributed database systems, and achieves efficient database configuration update and balanced data distribution.

CN121387917BActive Publication Date: 2026-03-31TIANJIN NANKAI UNIV GENERAL DATA TECH
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-12-24
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

In distributed database systems, node replacement requires manual editing of configuration files when a node fails, which is inefficient.

Method used

By constructing a graph structure, target candidate nodes are automatically determined based on the evaluation values ​​of candidate nodes. The evaluation values ​​are based on the occurrence frequency and in-degree data of candidate nodes, thereby achieving automated database configuration updates.

Benefits of technology

It improves the efficiency of database configuration updates, balances update efficiency with data distribution balance, and reduces manual intervention.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121387917B_ABST
    Figure CN121387917B_ABST
Patent Text Reader

Abstract

The application provides a database configuration updating method, which can be applied to the technical field of databases. The method comprises the following steps: obtaining a plurality of candidate node groups and a node to be updated based on a database configuration file, wherein each candidate node group comprises a plurality of candidate nodes, and each candidate node is a primary node or a secondary node; in response to the node to be updated being a primary node, determining, based on the node to be updated, a first target node group from the plurality of candidate node groups, wherein the first target node group comprises the node to be updated and the node to be updated is a primary node; determining a target candidate node from the plurality of candidate nodes that are secondary nodes in the first target node group based on respective evaluation values of the plurality of candidate nodes that are secondary nodes, wherein the evaluation value represents the influence degree of the candidate node on at least one of the stability of the database or the data distribution balance, and the evaluation value is obtained based on a graph structure constructed based on the plurality of candidate node groups and the node to be updated; and determining the target candidate node as the primary node of the first target node group.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of database, and more particularly to a database configuration updating method. BACKGROUND

[0002] In a distributed database system, in order to improve availability, a master-slave redundancy mode can be adopted. In the case of node failure, relevant staff needs to manually edit configuration files to replace the node to be updated, which is relatively low in efficiency. SUMMARY

[0003] In view of the above problems, the present application provides a database configuration updating method.

[0004] According to a first aspect of the present application, a database configuration updating method is provided, comprising: obtaining a plurality of candidate node groups and a node to be updated based on a database configuration file, wherein the candidate node group comprises a plurality of candidate nodes, and the candidate node is a master node or a slave node; in response to the node to be updated being a master node, determining a first target node group comprising the node to be updated and the node to be updated being a master node from the plurality of candidate node groups based on the node to be updated; determining a target candidate node from the plurality of candidate nodes as slave nodes based on the evaluation value of each of the plurality of candidate nodes as slave nodes in the first target node group, wherein the evaluation value represents the degree of influence of the candidate node on at least one of the stability of the database or the data distribution balance, and the evaluation value is obtained based on a graph structure constructed based on the plurality of candidate node groups and the node to be updated; and determining the target candidate node as the master node of the first target node group.

[0005] According to an embodiment of the present application, the evaluation value is determined by: obtaining the frequency of occurrence of each candidate node in the plurality of candidate node groups and the out-degree and in-degree data of each candidate node determined based on the graph structure; and determining the evaluation value based on the frequency of occurrence and the out-degree and in-degree data.

[0006] According to an embodiment of the present application, the graph structure is determined by: for a first candidate node and a second candidate node in any candidate node group, in response to the first candidate node being a master node of the any candidate node group and the second candidate node being a slave node of the any candidate node group, taking the first candidate node as an out-node of the second candidate node and taking the second candidate node as an in-node of the first candidate node.

[0007] According to an embodiment of the present application, the out-degree and in-degree data comprises: out-degree data and in-degree data, and the determination of the evaluation value based on the frequency of occurrence and the out-degree and in-degree data comprises: weighting and summing the out-degree data, the in-degree data and the frequency of occurrence based on a preset weight value to obtain the evaluation value.

[0008] According to an embodiment of the present invention, determining a target candidate node from among the multiple candidate nodes that are secondary nodes in the first target node group based on their respective evaluation values ​​includes: determining a target evaluation value from among the evaluation values ​​of the multiple candidate nodes that are secondary nodes in the first target node group; and determining the candidate node that corresponds to the target evaluation value from among the multiple candidate nodes that are secondary nodes as the target candidate node.

[0009] According to an embodiment of the present invention, the method further includes: in response to the node to be updated being a secondary node, determining a second target node group from the plurality of candidate node groups, which includes the node to be updated and the node to be updated being a secondary node, based on the node to be updated; and deleting the node to be updated from the second target node group.

[0010] According to an embodiment of the present invention, the method further includes: for any candidate node group among the plurality of candidate node groups, in response to the fact that all candidate nodes included in the candidate node group are invalid candidate nodes, determining the candidate node group as an isolated node group.

[0011] According to an embodiment of the present invention, for any candidate node among the plurality of candidate nodes included in the plurality of candidate node groups, in response to the candidate node being a master node in the candidate node group, the node to be updated being a master node and the candidate node being the node to be updated, the candidate node is determined to be the invalid candidate node; in response to the candidate node being a slave node in the candidate node group, the node to be updated being a slave node and the candidate node being the node to be updated, the candidate node is determined to be the invalid candidate node.

[0012] According to an embodiment of the present invention, the above-mentioned method of obtaining multiple candidate node groups and nodes to be updated based on a database configuration file includes: parsing the database configuration file to obtain the file paths of the nodes to be updated and the candidate nodes; accessing the candidate node file paths to obtain candidate node files; and parsing the candidate node files to obtain the multiple candidate node groups.

[0013] According to an embodiment of the present invention, the candidate node file is updated based on the target candidate node to obtain an updated candidate node file; a new data distribution strategy is generated based on the candidate node file; and the data distribution of the multiple candidate nodes in the multiple candidate node groups is updated based on the new data distribution strategy.

[0014] A second aspect of the present invention provides a database configuration update apparatus, comprising: an acquisition module, configured to acquire, based on a database configuration file, a plurality of candidate node groups and a node to be updated, wherein the candidate node groups include a plurality of candidate nodes, and the candidate nodes are master nodes or slave nodes; a first target node group determination module, configured to, in response to the node to be updated being a master node, determine, based on the node to be updated, a first target node group from the plurality of candidate node groups that includes the node to be updated and is the master node; a target candidate node determination module, configured to determine a target candidate node from the plurality of candidate nodes that are slave nodes in the first target node group based on the evaluation values ​​of each of the candidate nodes that are slave nodes in the first target node group, wherein the evaluation values ​​characterize the degree of influence of the candidate node on at least one of the stability or data distribution balance of the database, and the evaluation values ​​are obtained based on a graph structure constructed from the plurality of candidate node groups and the node to be updated; and a master node determination module, configured to determine the target candidate node as the master node of the first target node group.

[0015] A third aspect of the present invention provides an electronic device comprising: one or more processors; and a memory for storing one or more computer programs, wherein the one or more processors execute the one or more computer programs to implement the steps of the method described above.

[0016] A fourth aspect of the present invention also provides a computer-readable storage medium having a computer program or instructions stored thereon, wherein the computer program or instructions, when executed by a processor, implement the steps of the above-described method.

[0017] A fifth aspect of the present invention also provides a computer program product, including a computer program or instructions that, when executed by a processor, implement the steps of the above-described method.

[0018] According to an embodiment of the present invention, by identifying the first target node group, which includes the node to be updated and is the master node, from multiple candidate node groups, the first target node group affected by the master node update can be quickly locked. Then, the target candidate node is determined based on the evaluation values ​​of multiple candidate nodes in the first target node group. That is, the impact of each secondary node on the stability of the database and the data distribution balance is quantified by the evaluation value, thereby accurately selecting the target candidate node as the master node, so as to take into account both update efficiency and data distribution balance when updating the master node. Attached Figure Description

[0019] The above-described features, other objects, and advantages of the present invention will become clearer from the following description of embodiments of the invention with reference to the accompanying drawings, in which:

[0020] Figure 1An application scenario diagram of the database configuration update method and apparatus according to an embodiment of the present invention is shown;

[0021] Figure 2 A flowchart of a database configuration update method according to an embodiment of the present invention is shown;

[0022] Figure 3 A graph structure according to an embodiment of the present invention is shown;

[0023] Figure 4 A structural block diagram of a database configuration update apparatus according to an embodiment of the present invention is shown;

[0024] Figure 5 A block diagram of an electronic device suitable for implementing a database configuration update method according to an embodiment of the present invention is shown. Detailed Implementation

[0025] Hereinafter, embodiments of the present invention will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the invention. In the following detailed description, numerous specific details are set forth to provide a thorough understanding of the embodiments of the invention for ease of explanation. However, it will be apparent that one or more embodiments may be practiced without these specific details. Furthermore, descriptions of well-known structures and techniques are omitted in the following description to avoid unnecessarily obscuring the concept of the invention.

[0026] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the invention. The terms “comprising,” “including,” etc., as used herein indicate the presence of the stated features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.

[0027] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein are to be interpreted in a manner consistent with the context of this specification, and not in an idealized or overly rigid way.

[0028] When using expressions such as "at least one of A, B and C", they should generally be interpreted in accordance with the meaning that is commonly understood by those skilled in the art (e.g., "a system having at least one of A, B and C" should include, but is not limited to, a system having A alone, a system having B alone, a system having C alone, a system having A and B, a system having A and C, a system having B and C, and / or a system having A, B and C, etc.).

[0029] In distributed systems, node replacement is required when a node fails. The configuration process for node replacement involves manual replacement by relevant personnel, based on the system architecture configuration files and the specific node to be configured. However, distributed systems typically have a large number of nodes, making manual replacement inefficient.

[0030] In view of this, embodiments of the present invention provide a database configuration update method, the method comprising: obtaining multiple candidate node groups and nodes to be updated based on a database configuration file, wherein the candidate node groups include multiple candidate nodes, and the candidate nodes are primary nodes or secondary nodes; in response to the node to be updated being a primary node, determining a first target node group from the multiple candidate node groups, including the node to be updated and the node to be updated being a primary node, based on the node to be updated; determining a target candidate node from the multiple candidate nodes that are secondary nodes in the first target node group based on the evaluation values ​​of each of the multiple candidate nodes that are secondary nodes, wherein the evaluation values ​​characterize the degree of influence of the candidate node on at least one of the stability of the database or the data distribution balance, and the evaluation values ​​are obtained based on a graph structure constructed from the multiple candidate node groups and the nodes to be updated; and determining the target candidate node as the primary node of the first target node group.

[0031] Figure 1 The diagram illustrates an application scenario of the database configuration update method and apparatus according to an embodiment of the present invention.

[0032] like Figure 1 As shown, application scenario 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 serves as a medium for providing a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.

[0033] Users can use the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 via the network 104 to receive or send messages, etc. Various communication client applications can be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social media platform software, etc. (for example only).

[0034] The first terminal device 101, the second terminal device 102, and the third terminal device 103 can be various electronic devices with displays and support web browsing, including but not limited to smartphones, tablets, laptops, and desktop computers.

[0035] Server 105 can be a server that provides various services, such as a backend management server that supports websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103 (this is just an example). The backend management server can analyze and process data such as received user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal devices.

[0036] It should be noted that the database configuration update method provided in this embodiment of the invention can generally be executed by server 105. Correspondingly, the database configuration update device provided in this embodiment of the invention can generally be located in server 105. The database configuration update method provided in this embodiment of the invention can also be executed by a server or server cluster that is different from server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or server 105. Correspondingly, the database configuration update device provided in this embodiment of the invention can also be located in a server or server cluster that is different from server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or server 105.

[0037] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.

[0038] The following will be based on Figure 1 The described scene, through Figures 2-3 The database configuration update method according to an embodiment of the present invention will be described in detail.

[0039] Figure 2 A flowchart of a database configuration update method according to an embodiment of the present invention is shown.

[0040] like Figure 2 As shown, the database configuration update method in this embodiment includes operations S210 to S240.

[0041] When operating S210, based on the database configuration file, multiple candidate node groups and nodes to be updated are obtained.

[0042] The candidate node group includes multiple candidate nodes, which can be either master nodes or slave nodes.

[0043] According to an embodiment of the present invention, each candidate node group may include at least one master node and multiple slave nodes.

[0044] In operation S220, in response to the node to be updated being the master node, a first target node group, including the node to be updated and the node to be updated being the master node, is determined from multiple candidate node groups based on the node to be updated.

[0045] For example, for candidate node group 1: [primary node: A; secondary nodes: B, C], candidate node group 2: [primary node: B; secondary nodes: C, D] and candidate node group 3: [primary node: C; secondary nodes: E, F], the node to be updated is A. Then candidate node group 1 can be determined as the first target node group (for ease of description, letters are used as examples here. The actual candidate node group format should be 192.168.XI).

[0046] In operation S230, a target candidate node is determined from the multiple candidate nodes that are secondary nodes in the first target node group based on their respective evaluation values.

[0047] The evaluation value characterizes the degree of influence of candidate nodes on at least one of the stability of the database or the balance of data distribution. The evaluation value is obtained based on the graph structure constructed from multiple candidate node groups and nodes to be updated.

[0048] According to an embodiment of the present invention, the above-mentioned graph structure can be obtained by modeling the topological relationship of multiple candidate node groups. During the process of updating the database configuration, after updating the master node in the first target node group according to the node to be updated, the above-mentioned graph structure can be updated in real time to ensure the accuracy of subsequent database configuration updates. Furthermore, after updating the master-slave relationship of the first target node group, it is necessary to synchronously check the identity of the target candidate node in multiple candidate node groups other than the first target node group (i.e., whether the target candidate node is a master node or a slave node). In the case of being a slave node, the in-and-out edge relationship between the master node and the target candidate node in the candidate node group is updated synchronously.

[0049] In operation S240, the target candidate node is determined as the master node of the first target node group.

[0050] According to an embodiment of the present invention, by identifying the first target node group, which includes the node to be updated and is the master node, from multiple candidate node groups, the first target node group affected by the master node update can be quickly locked. Then, the target candidate node is determined based on the evaluation values ​​of multiple candidate nodes in the first target node group. That is, the impact of each secondary node on the stability of the database and the data distribution balance is quantified by the evaluation value, thereby accurately selecting the target candidate node as the master node, so as to take into account both update efficiency and data distribution balance when updating the master node.

[0051] According to an embodiment of the present invention, the above evaluation value is determined by the following operations: obtaining the occurrence frequency of each candidate node in a plurality of candidate node groups and the in-degree data of each candidate node determined based on the graph structure; and determining the evaluation value based on the occurrence frequency and in-degree data.

[0052] According to embodiments of the present invention, the frequency of occurrence of each candidate node represents its importance and stability. Candidate nodes with high occurrence frequencies are more widely distributed in the database system, and when used as master nodes, they can better ensure the overall stability of the system. For example, if there are 50 candidate node groups, and candidate node A appears in 30 of these groups, then the frequency of candidate node A is 60%.

[0053] According to an embodiment of the present invention, by jointly determining the evaluation value by the occurrence frequency of candidate nodes and the in-degree and out-degree of each candidate node determined based on the graph structure, the evaluation value can reflect both the data distribution balance of candidate nodes in the entire graph structure through the in-degree and the impact of candidate nodes on database stability through the occurrence frequency. Thus, the target candidate node with high stability and the ability to quickly take over the load can be determined as the master node of the first target node group.

[0054] According to an embodiment of the present invention, the aforementioned in-degree data includes out-degree data and in-degree data. Determining an evaluation value based on the occurrence frequency and in-degree data includes: performing a weighted summation of the out-degree data, in-degree data, and occurrence frequency based on a preset weight value to obtain the evaluation value.

[0055] The evaluation value of each candidate node can be calculated using the following formula (1).

[0056] (1)

[0057] Where node represents a candidate node. This represents the evaluation value of the candidate node. This represents the in-degree data of the candidate node. This represents the out-degree data of the candidate nodes. This indicates the frequency of occurrence of candidate nodes. This indicates the preset weight value.

[0058] According to embodiments of the present invention, the in-degree data of the candidate node represents the number of edges pointing to the candidate node in the graph structure, reflecting the degree to which the candidate node is depended on by other master nodes as a secondary node. Candidate nodes with higher in-degree data have higher dependency in the database system and are more stable when acting as master nodes.

[0059] According to an embodiment of the present invention, the out-degree data of the candidate node represents the number of edges originating from the candidate node in the graph structure, reflecting the number of secondary nodes managed by the candidate node as a master node. Candidate nodes with higher out-degree data have stronger secondary node management capabilities and can effectively distribute data.

[0060] According to an embodiment of the present invention, the above graph structure is determined by the following operation: for a first candidate node and a second candidate node in any candidate node group, in response to the first candidate node being the master node of any candidate node group and the second candidate node being the slave node of any candidate node group, the first candidate node is used as the output node of the second candidate node and the second candidate node is used as the input node of the first candidate node.

[0061] Figure 3 A diagram structure according to an embodiment of the present invention is shown.

[0062] like Figure 3 As shown, the graph structure includes candidate node A, candidate node B, candidate node C, candidate node D, and candidate node E.

[0063] For example, in candidate node group 1, the primary node is candidate node A, and the secondary nodes are candidate node B and candidate node C. In candidate node group 2, the primary node is candidate node B, and the secondary nodes are candidate node D and candidate node E. Based on the aforementioned candidate node group 1 and candidate node group 2, it can be determined that the output nodes of candidate node A include candidate node B and candidate node C, and the output nodes of candidate node B include candidate node D and candidate node E.

[0064] According to an embodiment of the present invention, the above graph structure can be represented as a directed graph G=(V, E), where V is the set of candidate nodes and E is the set of directed edges.

[0065] According to an embodiment of the present invention, by modeling the primary and secondary relationships in the candidate node group as in-and-out edges of a graph structure, the scattered candidate node groups can be transformed into a unified graph structure. Then, when determining the evaluation value of each candidate node, the in-and-out degree data in the graph structure can be read to directly measure the dependency and management capability of each candidate node, thereby improving the efficiency of database configuration update.

[0066] According to an embodiment of the present invention, the above-mentioned determination of a target candidate node from multiple candidate nodes serving as secondary nodes based on their respective evaluation values ​​in the first target node group includes: determining a target evaluation value from the evaluation values ​​of multiple candidate nodes serving as secondary nodes in the first target node group; and determining the candidate node corresponding to the target evaluation value from the multiple candidate nodes serving as secondary nodes as the target candidate node.

[0067] For example, taking the candidate node group 1 mentioned above as an example, it includes a main node A, a secondary node B, and a secondary node C. The evaluation value of secondary node B is 70, and the evaluation value of secondary node C is 80. Then, the evaluation value 80 with the highest evaluation value can be selected as the target evaluation value. Furthermore, the secondary node C corresponding to the evaluation value 80 is selected as the target candidate node.

[0068] According to embodiments of the present invention, by locking the target evaluation value from the evaluation values ​​corresponding to each of the multiple candidate nodes that serve as secondary nodes, and then determining the target candidate node through the target evaluation value, complex multi-dimensional trade-offs can be avoided, thereby improving the speed of determining the target candidate node.

[0069] According to an embodiment of the present invention, the method further includes: in response to the node to be updated being a secondary node, determining a second target node group from a plurality of candidate node groups, which includes the node to be updated and the node to be updated being a secondary node, based on the node to be updated; and deleting the node to be updated from the second target node group.

[0070] For example, for candidate node group 1: [primary node: A; secondary nodes: B, C], and candidate node group 4: [primary node E; secondary nodes: F, G], when the node to be updated is B, the second target node group is determined as candidate node group 1. The updated candidate node group 1 is obtained by updating candidate node group 1: [primary node: A; secondary node: C].

[0071] According to an embodiment of the present invention, the above method further includes: for any candidate node group among a plurality of candidate node groups, in response to the fact that all candidate nodes included in the candidate node group are invalid candidate nodes, determining the candidate node group as an isolated node group.

[0072] For example, for candidate node group 4: [master node E; secondary nodes: F, G], if the nodes to be updated are node E, node F and node G, then candidate node group 4 is determined to be an isolated node group.

[0073] According to an embodiment of the present invention, the above method further includes: for any candidate node among the multiple candidate nodes included in the multiple candidate node groups, in response to the candidate node being the master node in the candidate node group, the node to be updated being the master node and the candidate node being the node to be updated, determining the candidate node as an invalid candidate node; in response to the candidate node being a slave node in the candidate node group, the node to be updated being a slave node and the candidate node being the node to be updated, determining the candidate node as an invalid candidate node.

[0074] For example, in candidate node group 5 [primary node: candidate node A], if the node to be updated is candidate node A, then candidate node A can be determined to be an invalid candidate node, and candidate node group 5 is an isolated node group. In candidate node group 6 [primary node: candidate node A, secondary node: candidate node B], if the node to be updated includes both candidate node A and candidate node B, then both candidate node A and candidate node B can be determined to be invalid nodes, and candidate node group 6 is an isolated node group.

[0075] According to an embodiment of the present invention, after constructing the graph structure, it is possible to detect whether multiple candidate node groups are isolated node groups, and then further determine the first target node group or the second target node group from the multiple candidate node groups.

[0076] According to an embodiment of the present invention, by marking all nodes to be updated as invalid candidate nodes, and then marking the candidate node group as an isolated node group when all nodes in the candidate node group are invalid candidate nodes, the number of candidate nodes that need to be evaluated can be reduced before the evaluation value is determined, thereby reducing the amount of computation of hardware devices and improving the efficiency of database configuration updates.

[0077] According to an embodiment of the present invention, the above-mentioned method of obtaining multiple candidate node groups and nodes to be updated based on a database configuration file includes: parsing the database configuration file to obtain the file paths of the nodes to be updated and the candidate nodes; accessing the candidate node file paths to obtain the candidate node files; and parsing the candidate node files to obtain multiple candidate node groups.

[0078] According to embodiments of the present invention, the aforementioned database configuration file may be, for example, a conf.ini file. The multiple candidate node groups may be stored in the distributed database in the form of XML (Extensible Markup Language) files. The nodes to be updated may be stored in the database configuration file as a list. The format of the nodes to be updated may be, for example, [192.168.X.101, 192.168.Y.102, 192.168.Z.103]. Candidate node files can be obtained based on the corresponding candidate node file paths in the database configuration file, and the node structure within them can be parsed using an XML parsing tool to obtain multiple candidate node groups.

[0079] According to an embodiment of the present invention, the above method further includes: updating the candidate node file based on the target candidate node to obtain the updated candidate node file; generating a new data distribution strategy based on the candidate node file; and updating the data distribution of multiple candidate nodes in multiple candidate node groups based on the new data distribution strategy.

[0080] According to an embodiment of the present invention, the candidate node file may be, for example, an XML file. During the generation of the candidate node file, the syntax of the XML is automatically processed to ensure that the generated XML file retains the basic structure of the original file and can be directly recognized and used by the database system.

[0081] For example, for candidate node group 1, the primary node is candidate node A, and the secondary nodes are candidate node B and candidate node C. All data shards (including some redundant data) of candidate node B and candidate node C can form the data on primary node A. After selecting candidate node B as the target candidate node and determining it as the primary node of candidate node group 1, it is necessary to back up the data of candidate node B on candidate node C (i.e., generate a new data distribution strategy), so as to further update the data distribution of candidate node B and candidate node C according to the new data distribution strategy.

[0082] According to embodiments of the present invention, updating the candidate node file through the target candidate node can improve the accuracy of topology information, thereby improving the accuracy of the graph structure. At the same time, the data distribution of multiple candidate nodes in multiple candidate node groups is updated according to the new data distribution strategy, and data is migrated or synchronized between nodes. Thus, after the master node is switched in multiple candidate node groups, the data distribution in each candidate node group is balanced.

[0083] Based on the above-described database configuration update method, this invention also provides a database configuration update apparatus. The following will be combined with... Figure 4 The device is described in detail.

[0084] Figure 4 A structural block diagram of a database configuration update apparatus according to an embodiment of the present invention is shown.

[0085] like Figure 4 As shown, the database configuration update device 400 of this embodiment includes an acquisition module 410, a first target node group determination module 420, a target candidate node determination module 430, and a master node determination module 440.

[0086] The obtaining module 410 is used to obtain multiple candidate node groups and nodes to be updated based on the database configuration file. The candidate node groups include multiple candidate nodes, which are either primary nodes or secondary nodes. In one embodiment, the obtaining module 410 can be used to perform the operation S210 described above, which will not be repeated here.

[0087] The first target node group determination module 420 is used to determine a first target node group, which includes the node to be updated and is the main node, from multiple candidate node groups in response to the node to be updated being the main node. In one embodiment, the first target node group determination module 420 can be used to perform the operation S220 described above, which will not be repeated here.

[0088] The target candidate node determination module 430 is used to determine target candidate nodes from among the multiple candidate nodes that are secondary nodes in the first target node group, based on the evaluation values ​​of each of the candidate nodes that are secondary nodes. The evaluation values ​​characterize the degree of influence of the candidate node on at least one of the stability of the database or the data distribution balance. The evaluation values ​​are obtained based on the graph structure constructed from the multiple candidate node groups and the nodes to be updated. In one embodiment, the target candidate node determination module 430 can be used to perform the operation S230 described above, which will not be repeated here.

[0089] The master node determination module 440 is used to determine the target candidate node as the master node of the first target node group. In one embodiment, the master node determination module 440 can be used to perform the operation S240 described above, which will not be repeated here.

[0090] According to embodiments of the present invention, any plurality of modules among the obtaining module 410, the first target node group determining module 420, the target candidate node determining module 430, and the master node determining module 440 can be combined into one module, or any one of these modules can be split into multiple modules. Alternatively, at least part of the functionality of one or more of these modules can be combined with at least part of the functionality of other modules and implemented in one module. According to embodiments of the present invention, at least one of the obtaining module 410, the first target node group determining module 420, the target candidate node determining module 430, and the master node determining module 440 can be at least partially implemented as hardware circuitry, such as a field-programmable gate array (FPGA), a programmable logic array (PLA), a system-on-a-chip, a system-on-a-substrate, a system-on-package, an application-specific integrated circuit (ASIC), or any other reasonable means of integrating or packaging circuitry, or implemented in hardware or firmware, or in any one of software, hardware, and firmware implementations, or in a suitable combination of any of these. Alternatively, at least one of the following modules can be implemented, at least partially, as a computer program module, which can perform corresponding functions when the computer program module is run.

[0091] Figure 5 A block diagram of an electronic device suitable for implementing a database configuration update method according to an embodiment of the present invention is shown.

[0092] like Figure 5 As shown, an electronic device 500 according to an embodiment of the present invention includes a processor 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage portion 508 into a random access memory (RAM) 503. The processor 501 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or an associated chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 501 may also include onboard memory for caching purposes. The processor 501 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present invention.

[0093] RAM 503 stores various programs and data required for the operation of electronic device 500. Processor 501, ROM 502, and RAM 503 are interconnected via bus 504. Processor 501 executes various operations of the method flow according to embodiments of the present invention by executing programs in ROM 502 and / or RAM 503. It should be noted that the programs may also be stored in one or more memories other than ROM 502 and RAM 503. Processor 501 may also execute various operations of the method flow according to embodiments of the present invention by executing programs stored in said one or more memories.

[0094] According to an embodiment of the present invention, the electronic device 500 may further include an input / output (I / O) interface 505, which is also connected to a bus 504. The electronic device 500 may also include one or more of the following components connected to the input / output (I / O) interface 505: an input section 506 including a keyboard, mouse, etc.; an output section 507 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the input / output (I / O) interface 505 as needed. A removable medium 511, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 510 as needed so that computer programs read from it can be installed into the storage section 508 as needed.

[0095] The present invention also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or it may exist independently and not assembled into the device / apparatus / system. The computer-readable storage medium carries one or more programs, which, when executed, implement the method according to the embodiments of the present invention.

[0096] According to embodiments of the present invention, the computer-readable storage medium may be a non-volatile computer-readable storage medium, such as including, but not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In the present invention, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. For example, according to embodiments of the present invention, the computer-readable storage medium may include ROM 502 and / or RAM 503 and / or one or more memories other than ROM 502 and RAM 503 described above.

[0097] Embodiments of the present invention also include a computer program product comprising a computer program containing program code for performing the methods shown in the flowchart. When the computer program product is run on a computer system, the program code is used to cause the computer system to implement the database configuration update method provided in the embodiments of the present invention.

[0098] When the computer program is executed by the processor 501, it performs the functions defined in the system / apparatus of this invention. According to embodiments of the invention, the systems, apparatuses, modules, units, etc., described above can be implemented by computer program modules.

[0099] In one embodiment, the computer program may rely on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may also be transmitted and distributed in the form of signals over a network medium, and may be downloaded and installed via the communication section 509, and / or installed from a removable medium 511. The program code contained in the computer program can be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination thereof.

[0100] In such an embodiment, the computer program can be downloaded and installed from a network via communication section 509, and / or installed from removable medium 511. When the computer program is executed by processor 501, it performs the functions defined in the system of this embodiment of the invention. According to embodiments of the invention, the systems, devices, apparatuses, modules, units, etc., described above can be implemented by computer program modules.

[0101] According to embodiments of the present invention, program code for executing the computer programs provided in the embodiments of the present invention can be written in any combination of one or more programming languages. Specifically, these computational programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages ​​include, but are not limited to, languages ​​such as Java, C++, Python, "C", or similar programming languages. The program code can be executed entirely on the user's computing device, partially on the user's device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0102] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0103] Those skilled in the art will understand that the features described in the various embodiments of the present invention can be combined and / or combined in various ways, even if such combinations or combinations are not explicitly described in the present invention. In particular, the features described in the various embodiments of the present invention can be combined and / or combined in various ways without departing from the spirit and teachings of the present invention. All such combinations and / or combinations fall within the scope of the present invention.

[0104] The embodiments of the present invention have been described above. However, these embodiments are merely illustrative and not intended to limit the scope of the invention. Although various embodiments have been described above, this does not mean that the measures in the various embodiments cannot be used advantageously in combination. Various substitutions and modifications can be made by those skilled in the art without departing from the scope of the invention, and all such substitutions and modifications should fall within the scope of the invention.

Claims

1. A database configuration update method characterized by, The method comprises: obtaining a plurality of candidate node groups and a to-be-updated node based on a database configuration file, wherein each candidate node group comprises a plurality of candidate nodes, and each candidate node is a primary node or a secondary node; in response to the to-be-updated node being a primary node, determining, based on the to-be-updated node, a first target node group from the plurality of candidate node groups, wherein the first target node group comprises the to-be-updated node and the to-be-updated node is a primary node; determining, based on respective evaluation values of the plurality of candidate nodes that are secondary nodes in the first target node group, a target candidate node from the plurality of candidate nodes that are secondary nodes, wherein the evaluation value represents the degree of influence of the candidate node on at least one of the stability of the database or the data distribution balance, and the evaluation value is obtained based on a graph structure constructed based on the plurality of candidate node groups and the to-be-updated node; determining the target candidate node as a primary node of the first target node group. The evaluation value is determined by: obtaining the frequency of occurrence of each candidate node in the plurality of candidate node groups and the out-degree and in-degree data of each candidate node determined based on the graph structure; determining the evaluation value based on the frequency of occurrence and the out-degree and in-degree data.

2. The method of claim 1, wherein, The graph structure is determined by: for a first candidate node and a second candidate node in any candidate node group, in response to the first candidate node being a primary node of the any candidate node group and the second candidate node being a secondary node of the any candidate node group, taking the first candidate node as an out-node of the second candidate node and taking the second candidate node as an in-node of the first candidate node.

3. The method of claim 1, wherein, The out-degree and in-degree data comprises out-degree data and in-degree data, and the evaluation value is determined based on the frequency of occurrence and the out-degree and in-degree data by: weighting and summing the out-degree data, the in-degree data, and the frequency of occurrence based on a preset weight value to obtain the evaluation value.

4. The method according to any one of claims 1 to 3, characterized in that, The evaluation value is determined by: determining a target evaluation value from the respective evaluation values of the plurality of candidate nodes that are secondary nodes in the first target node group; determining the target candidate node from the candidate nodes that are secondary nodes corresponding to the target evaluation value.

5. The method according to any one of claims 1 to 3, characterized in that, The method further comprises: in response to the to-be-updated node being a secondary node, determining, based on the to-be-updated node, a second target node group from the plurality of candidate node groups, wherein the second target node group comprises the to-be-updated node and the to-be-updated node is a secondary node; deleting the to-be-updated node in the second target node group.

6. The method of any one of claims 1-3, wherein, The method further comprises: for any candidate node group in the plurality of candidate node groups, in response to the plurality of candidate nodes included in the candidate node group all being invalid candidate nodes, determining the candidate node group as an isolated node group.

7. The method of claim 6, wherein, The method further comprises: for any candidate node in the plurality of candidate nodes included in the plurality of candidate node groups, In response to the candidate node being a primary node in the candidate node group, the to-be-updated node being a primary node and the candidate node being the to-be-updated node, determining that the candidate node is the invalid candidate node; In response to the candidate node being a secondary node in the candidate node group, the to-be-updated node being a secondary node and the candidate node being the to-be-updated node, determining that the candidate node is the invalid candidate node.

8. The method of any one of claims 1-3, wherein, The method further comprises: obtaining a plurality of candidate node groups and a to-be-updated node based on the database configuration file, wherein the database configuration file comprises: parsing the database configuration file to obtain a to-be-updated node and a candidate node file path; accessing the candidate node file path to obtain a candidate node file; 9. The method of claim 8, wherein, parsing the candidate node file to obtain the plurality of candidate node groups. The method further comprises: updating the candidate node file based on the target candidate node to obtain an updated candidate node file; generating a new data distribution strategy based on the candidate node file; updating data distribution of the plurality of candidate nodes in the plurality of candidate node groups based on the new data distribution strategy.

Citation Information

Patent Citations

  • Database cluster main node switching method and system and management and control platform

    CN117271227A