Database cluster updating method and device
By replacing data shards in the database cluster and inserting target data nodes, the problems of low database cluster update efficiency and data loss are solved, and a more efficient and stable update process is achieved.
Patent Information
- Application Number
- CN202411748655.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-02
- Publication Date
- 2024-12-31
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
During the update process, the database cluster needs to build a new cluster and a large amount of data transmission, which leads to inefficiency and the risk of data loss.
By replacing the data shards of the updated data node and the normal data node based on the same identification information, an intermediate database cluster is formed and the target update data node is inserted into the intermediate cluster, multiple data transmissions and cluster reconstruction are avoided.
Improve the stability and security of database cluster updates, reduce operation time, and reduce the burden on computer systems.
Smart Images

Figure CN119226307A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and more specifically to a database cluster updating method and device. Background Art
[0002] The database cluster uses data node replacement operations to solve the bottleneck problems of node damage or single-node computing and storage capacity that arise as the cluster scale continues to expand and the amount of data continues to increase.
[0003] The data node replacement operation in the related technology creates a new database cluster as an intermediate database cluster for temporarily storing data according to the structure of the initial database cluster, and imports all the data of the initial database cluster into the intermediate database cluster. After the data import is completed, the initial database cluster is updated. After the update is completed, the data stored in the intermediate database cluster is imported back to the updated initial database cluster.
[0004] In the above process, since a new database cluster needs to be built and all data needs to be exported, the time required for data redistribution is long and the database cluster update efficiency is low, which affects the normal use of the database cluster. In addition, when there is a large amount of data, data loss is likely to occur during the transmission process. Summary of the invention
[0005] In view of the above problems, the present invention provides a database cluster updating method, apparatus, device, medium and program product.
[0006] According to a first aspect of the present invention, a database cluster update method is provided, comprising: in response to a database cluster update instruction, determining a database cluster to be updated, wherein the database cluster to be updated includes multiple data nodes, the data nodes include data nodes to be updated and normal data nodes, each data node includes data shards, and two data shards with the same identification information are respectively set on different data nodes; based on the same identification information, replacing the data shards of the data nodes to be updated and the data shards of the normal data nodes to obtain an intermediate database cluster, wherein the intermediate database cluster includes the processed normal data nodes; updating the data nodes to be updated to obtain target update data nodes; inserting the target update data nodes into the intermediate database cluster to obtain the target database cluster.
[0007] According to an embodiment of the present invention, based on the same identification information, the data shards of the data node to be updated and the data shards of the normal data nodes are replaced to obtain an intermediate database cluster, including: determining the normal data node distribution structure corresponding to the normal data node in the database cluster to be updated, and calling the replacement command corresponding to the normal data node distribution structure when the normal data node distribution structure meets the preset distribution conditions; in response to the replacement command, determining the data shards of the data node to be updated, wherein the two data shards with the same identification information include a primary data shard and a backup data shard, and the data content stored in the primary data shard and the backup data shard is the same; when the data shard of the data node to be updated is the primary data shard, according to the identification information of the primary data shard of the data node to be updated, determining the target backup data shard corresponding to the primary data shard of the data node to be updated in the normal data node; updating the target backup data shard to the target primary data shard to obtain the processed normal data node; and determining the intermediate database cluster according to the processed normal data node.
[0008] According to an embodiment of the present invention, based on the same identification information, the data shards of the data node to be updated and the data shards of the normal data nodes are replaced to obtain an intermediate database cluster, which also includes: when the data shard of the data node to be updated is a backup data shard, the backup data shard of the data node to be updated is deleted.
[0009] According to an embodiment of the present invention, the normal data node distribution structure includes a plurality of normal data nodes, and the preset distribution condition indicates that the normal data node distribution structure does not include the data node to be updated.
[0010] According to an embodiment of the present invention, based on the same identification information, the data shards of the data nodes to be updated and the data shards of the normal data nodes are replaced to obtain an intermediate database cluster, which also includes: when there is no normal data node distribution structure corresponding to the normal data nodes in the database cluster to be updated, or when the normal data node distribution structure does not meet the preset distribution conditions, a normal data node distribution structure is constructed according to the normal data nodes of the database cluster to be updated.
[0011] According to an embodiment of the present invention, the method further includes: when there are multiple data nodes to be updated in the database cluster to be updated, traversing the primary data shard and the backup data shard of each data node to be updated; when there are primary data shards and backup data shards with the same identification information among multiple data nodes to be updated, selecting a target data node to be updated from the data nodes to be updated corresponding to the primary data shard and the data nodes to be updated corresponding to the backup data shard; wherein, based on the same identification information, replacing the data shards of the data node to be updated and the data shards of the normal data nodes to obtain an intermediate database cluster, including: replacing the data shards of the target data node to be updated and the data shards of the normal data nodes based on the same identification information to obtain a processed normal data node; replacing the data shards of multiple data nodes to be updated except the target data node to be updated and the data shards of the processed normal data nodes based on the same identification information to obtain an intermediate database cluster.
[0012] According to an embodiment of the present invention, in response to a database cluster update instruction, determining a database cluster to be updated includes: in response to the database cluster update instruction, determining configuration parameter information of the database cluster, wherein the configuration parameter information includes attribute information and user information corresponding to the database cluster; when the configuration parameter information satisfies a preset update condition, determining the database cluster as the database cluster to be updated.
[0013] According to an embodiment of the present invention, a target update data node is inserted into an intermediate database cluster to obtain a target database cluster, including: when the target update data node meets preset conditions, the target update data node is inserted into the intermediate database cluster to obtain a target database cluster; based on the same identification information, the data storage information on the data shard of the processed normal data node is input into the data shard of the target update data node in the target database cluster.
[0014] According to an embodiment of the present invention, when a target update data node meets a preset condition, the target update data node is inserted into an intermediate database cluster to obtain a target database cluster, including: obtaining first data stored in a data shard of the target update data node within a preset time period; based on the same identification information, determining a target data shard corresponding to the data shard of the target update data node in a processed normal data node; obtaining second data stored in the target data shard within a preset time period; comparing the first data with the second data to obtain a comparison result; when the comparison result indicates that the first data is consistent with the second data, inserting the target update data node into the intermediate database cluster to obtain the target database cluster.
[0015] The second aspect of the present invention provides a database cluster update device, including: a determination module, used to determine a database cluster to be updated in response to a database cluster update instruction, wherein the database cluster to be updated includes multiple data nodes, the data nodes include data nodes to be updated and normal data nodes, each data node includes data shards, and two data shards with the same identification information are respectively set on different data nodes; a replacement module, used to replace the data shards of the data nodes to be updated and the data shards of the normal data nodes based on the same identification information to obtain an intermediate database cluster, wherein the intermediate database cluster includes the processed normal data nodes; an update module, used to update the data nodes to be updated to obtain target update data nodes; and an insertion module, used to insert the target update data nodes into the intermediate database cluster to obtain the target database cluster.
[0016] A third aspect of the present invention provides an electronic device, comprising: one or more processors; 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 above method.
[0017] The fourth aspect of the present invention further provides a computer-readable storage medium on which a computer program or instruction is stored, and the steps of the above method are implemented when the above computer program or instruction is executed by a processor.
[0018] The fifth aspect of the present invention also provides a computer program product, including a computer program or instructions, which implement the steps of the above method when executed by a processor.
[0019] According to an embodiment of the present invention, in response to a database cluster update instruction, a database cluster to be updated is determined; based on the same identification information, the data shards of the data node to be updated and the data shards of the normal data node are replaced to obtain an intermediate database cluster; the data node to be updated is updated to obtain a target update data node; the target update data node is inserted into the intermediate database cluster to obtain a target database cluster. Since the technical means of replacing the data shards of the data node to be updated and the data shards of the normal data node based on the same identification information is adopted, the problem of data loss easily caused by large-scale data transmission is avoided, and the technical effect of improving the stability and security of the database cluster replacement operation is achieved. In addition, since the target update data node is inserted into the intermediate database cluster to obtain the target database cluster, the problem of long operation time caused by building multiple clusters and large-scale data transmission is avoided, and the technical effect of improving the efficiency of the replacement operation and reducing the burden on the computer system is achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The above contents and other objects, features and advantages of the present invention will become more apparent through the following description of the embodiments of the present invention with reference to the accompanying drawings, in which:
[0021] Figure 1 An application scenario diagram of a database cluster update method, apparatus, device, medium, and program product according to an embodiment of the present invention is shown;
[0022] Figure 2 A flowchart of a database cluster updating method according to an embodiment of the present invention is shown;
[0023] Figure 3 A schematic diagram of a database cluster to be updated according to an embodiment of the present invention is shown;
[0024] Figure 4 A schematic diagram of an intermediate database cluster according to an embodiment of the present invention is shown;
[0025] Figure 5 A schematic diagram showing a database cluster updating method according to an embodiment of the present invention is shown;
[0026] Figure 6 It shows a structural block diagram of a database cluster updating device according to an embodiment of the present invention;
[0027] Figure 7 A block diagram of an electronic device suitable for implementing a database cluster updating method according to an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0028] Below, 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 present invention. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of embodiments of the present invention. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of concepts of the present invention.
[0029] The terms used herein are only for describing specific embodiments and are not intended to limit the present invention. The terms "comprise", "include", etc. used herein indicate the existence of the features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.
[0030] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.
[0031] When using expressions such as "at least one of A, B, and C, etc.", they should generally be interpreted according to the meaning of the expression commonly understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).
[0032] An embodiment of the present invention provides a database cluster update method, in response to a database cluster update instruction, determining a database cluster to be updated, wherein the database cluster to be updated includes multiple data nodes, the data nodes include data nodes to be updated and normal data nodes, each data node includes data shards, and two data shards with the same identification information are respectively set on different data nodes; based on the same identification information, the data shards of the data nodes to be updated and the data shards of the normal data nodes are replaced to obtain an intermediate database cluster, wherein the intermediate database cluster includes the processed normal data nodes; the data nodes to be updated are updated to obtain target update data nodes; the target update data nodes are inserted into the intermediate database cluster to obtain the target database cluster.
[0033] Figure 1 An application scenario diagram of a database cluster updating method, apparatus, device, medium, and program product according to an embodiment of the present invention is shown.
[0034] like Figure 1 As shown, the 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 is used to provide a medium for 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, wireless communication links, or optical fiber cables, etc.
[0035] The user can use the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 through 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 platform software, etc. (only for example).
[0036] The first terminal device 101, the second terminal device 102, and the third terminal device 103 may be various electronic devices having display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0037] The server 105 may be a server that provides various services, such as a background management server (only as an example) that provides support for websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103. The background management server may analyze and process the received data such as 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 device.
[0038] It should be noted that the database cluster update method provided in the embodiment of the present invention can generally be executed by the server 105. Accordingly, the database cluster update device provided in the embodiment of the present invention can generally be set in the server 105. The database cluster update method provided in the embodiment of the present invention can also be executed by a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105. Correspondingly, the database cluster update device provided in the embodiment of the present invention can also be set in a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105.
[0039] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0040] The following will be based on Figure 1 The scene described by Figure 2~Figure 5 The database cluster updating method according to the embodiment of the present invention is described in detail.
[0041] Figure 2 A flow chart of a database cluster updating method according to an embodiment of the present invention is shown.
[0042] like Figure 2 As shown, the database cluster updating method 200 of this embodiment includes operations S210 to S240.
[0043] In operation S210, in response to a database cluster update instruction, a database cluster to be updated is determined, wherein the database cluster to be updated includes multiple data nodes, the data nodes include data nodes to be updated and normal data nodes, each data node includes a data shard, and two data shards with the same identification information are respectively set on different data nodes.
[0044] According to an embodiment of the present invention, the database cluster may be a distributed cluster, or a system architecture deployed on multiple independent computers, wherein the independent computers may be data nodes of the database cluster. In addition, the database cluster may also be a system architecture deployed on multiple servers or cloud platforms, wherein each server or cloud platform node may be a data node of the database cluster.
[0045] According to an embodiment of the present invention, a database cluster obtains data, splits the data into multiple data shards, and stores the data on multiple data nodes to achieve efficient data storage.
[0046] According to an embodiment of the present invention, data shards are set on data nodes for storing data received by the database cluster, wherein each data node is provided with at least one data shard.
[0047] According to an embodiment of the present invention, two data shards with the same identification information store the same data. Since they are set on different data nodes, the problem that when one of the data nodes is damaged, all the data stored on the data node is affected is avoided.
[0048] According to an embodiment of the present invention, when it is detected that a data node fails or requires maintenance, a database cluster update instruction is automatically generated by the system or manually generated by a maintenance person to update the database cluster.
[0049] In operation S220, based on the same identification information, data shards of the data nodes to be updated and data shards of the normal data nodes are replaced to obtain an intermediate database cluster, wherein the intermediate database cluster includes the processed normal data nodes.
[0050] According to an embodiment of the present invention, the identification information includes identity information and priority information of the data slice, wherein two data slices with the same identification information have different priorities, and data are read and written based on their corresponding priorities.
[0051] According to an embodiment of the present invention, data shards of the data nodes to be updated and data shards of normal data nodes in the database cluster to be updated are replaced, so that the priority of the data shards on the normal data nodes after the processing is higher than the data shards of the replaced data nodes to be updated.
[0052] According to an embodiment of the present invention, after the replacement processing operation is directly performed on the database cluster to be updated, the database cluster to be updated after the replacement processing operation is performed can be determined as an intermediate database cluster, and the intermediate database cluster can include normal data nodes after processing, or can include normal nodes after processing and replaced data nodes to be updated. The replaced data nodes to be updated can be modified to an unavailable state or can also be removed from the intermediate database cluster.
[0053] According to an embodiment of the present invention, since the data shards of the data nodes to be updated and the data shards of the normal data nodes are replaced, during the replacement process, since there is no data transmission operation, data loss is avoided; in addition, since the replacement processing operation is directly performed on the database cluster to be updated, there is no need to build other intermediate clusters, which improves efficiency and avoids occupation of system resources.
[0054] In operation S230, the data node to be updated is updated to obtain a target updated data node.
[0055] According to an embodiment of the present invention, updating the data node to be updated may be repairing or upgrading the data node to be updated, and using the processed data node to be updated as a target update data node.
[0056] In operation S240 , the target update data node is inserted into the intermediate database cluster to obtain a target database cluster.
[0057] According to an embodiment of the present invention, when it is confirmed that the target update data node is available, the target update data node is inserted into the intermediate database cluster, which may be performed by establishing a communication protocol connection between the target update data node and the data node of the intermediate database cluster to obtain the target database cluster.
[0058] According to an embodiment of the present invention, in the process of obtaining the target database cluster, since operations are only performed on the target update data nodes, there is no need to operate on all data nodes. While not interfering with the normal operation of most data nodes, only a small amount of system resources are required to complete the insertion operation of the target update data nodes.
[0059] According to an embodiment of the present invention, in response to a database cluster update instruction, a database cluster to be updated is determined; based on the same identification information, the data shards of the data node to be updated and the data shards of the normal data node are replaced to obtain an intermediate database cluster; the data node to be updated is updated to obtain a target update data node; the target update data node is inserted into the intermediate database cluster to obtain a target database cluster. Since the technical means of replacing the data shards of the data node to be updated and the data shards of the normal data node based on the same identification information is adopted, the problem of data loss easily caused by large-scale data transmission is avoided, and the technical effect of improving the stability and security of the database cluster replacement operation is achieved. In addition, since the target update data node is inserted into the intermediate database cluster to obtain the target database cluster, the problem of long operation time caused by building multiple clusters and large-scale data transmission is avoided, and the technical effect of improving the efficiency of the replacement operation and reducing the burden on the computer system is achieved.
[0060] According to an embodiment of the present invention, based on the same identification information, the data shards of the data node to be updated and the data shards of the normal data nodes are replaced to obtain an intermediate database cluster, including: determining the normal data node distribution structure corresponding to the normal data node in the database cluster to be updated, and calling the replacement command corresponding to the normal data node distribution structure when the normal data node distribution structure meets the preset distribution conditions; in response to the replacement command, determining the data shards of the data node to be updated, wherein the two data shards with the same identification information include a primary data shard and a backup data shard, and the data content stored in the primary data shard and the backup data shard is the same; when the data shard of the data node to be updated is the primary data shard, according to the identification information of the primary data shard of the data node to be updated, determining the target backup data shard corresponding to the primary data shard of the data node to be updated in the normal data node; updating the target backup data shard to the target primary data shard to obtain the processed normal data node; and determining the intermediate database cluster according to the processed normal data node.
[0061] According to an embodiment of the present invention, the normal data node distribution structure includes a plurality of normal data nodes, and the preset distribution condition indicates that the normal data node distribution structure does not include the data node to be updated.
[0062] According to an embodiment of the present invention, a normal data node distribution structure corresponding to normal data nodes in the database cluster to be updated is determined so that the coordinator node of the database cluster to be updated calls a replacement command to perform a replacement processing operation on the database cluster to be updated.
[0063] According to an embodiment of the present invention, compared with the method in the related art that only supports one coordination node to execute a replacement command, the present invention directly performs replacement processing between data shards on the database to be updated, and can support multiple coordination nodes to execute replacement commands at the same time, so as to improve the efficiency of database cluster update operations.
[0064] According to an embodiment of the present invention, for example, if the database cluster to be updated includes data nodes g1, g2, and g3, wherein the normal data node distribution structure corresponding to the database cluster to be updated may be "g1 and g2", "g1 and g3", "g2 and g3", and "g1, g2, and g3", if the data node to be updated is g2, then the normal data node distribution structure representing "g1 and g3" satisfies the preset distribution condition. A replacement command corresponding to the normal data node distribution structure representing "g1 and g3" is called, and the replacement command may be to adjust the "g1, g2, and g3" structure of the data nodes in the current database cluster to be updated to the "g1 and g3" structure.
[0065] According to an embodiment of the present invention, two data shards with the same identification information include a primary data shard and a backup data shard, wherein the write operation of the primary data shard has a higher priority than the backup data shard, and the write operations (such as insert, update, delete, etc.) of the database cluster will be executed on the primary data shard first, and the data of the backup data shard is the backup data of the primary shard. When the primary data shard receives the write operation, the changes to the data caused by the write operation will be synchronized to the backup data shard. The backup data shard is usually used for read operations to achieve high data availability and read scalability.
[0066] According to an embodiment of the present invention, if the data shard of the data node to be updated is the primary data shard, a target backup data shard corresponding to the primary data shard of the data node to be updated is determined in the normal data node. For example, if the data node to be updated g2 includes the primary data shard n2, and it is determined that the normal data node g3 includes the backup data shard n2, the backup data shard n2 of the normal data node g3 is determined as the target backup data shard.
[0067] According to an embodiment of the present invention, the target backup data shard is updated to the target primary data shard, that is, the priority in the identification information of the target backup data shard is updated to make it the primary data shard corresponding to the identification information. For example, the backup data shard n2 of the above-mentioned normal data node g3 is updated to the primary data shard n2, that is, the subsequent write operations of the database cluster are all performed on the primary data shard n2 of the normal data node g3, so as to avoid the problem that the write operation corresponding to the data shard n2 cannot be performed when the data node g2 to be updated is updated, resulting in abnormal data writing or deletion operations.
[0068] According to an embodiment of the present invention, after the target backup data shard is updated to the target primary data shard, the primary data shard of the data node to be updated is adjusted to the backup data shard. For example, after the backup data shard n2 of the normal data node g3 is updated to the primary data shard n2, the primary data shard n2 of the updated data node g2 is adjusted to the backup data shard n2.
[0069] According to an embodiment of the present invention, after completing the replacement process for all data shards of the data nodes to be updated, an intermediate database cluster is obtained.
[0070] According to an embodiment of the present invention, by updating the target backup data shard corresponding to the primary data shard of the data node to be updated in the normal data node, when the data node to be updated is unavailable, the primary data shard corresponding to the data node to be updated can still perform data write operations normally, and there is no need to redistribute the data stored on the data shards of all data nodes to other intermediate storage clusters, thereby avoiding a large amount of data transmission. While reducing system resource usage, the security of data during the replacement process is guaranteed.
[0071] According to an embodiment of the present invention, based on the same identification information, the data shards of the data node to be updated and the data shards of the normal data nodes are replaced to obtain an intermediate database cluster, which also includes: when the data shard of the data node to be updated is a backup data shard, the backup data shard of the data node to be updated is deleted.
[0072] According to an embodiment of the present invention, since the data node to be updated needs to be updated, the data shard on the node to be updated needs to be deleted. Since the standby data shard does not involve a write operation, the deletion operation can be performed directly.
[0073] Figure 3 A schematic diagram of a database cluster to be updated according to an embodiment of the present invention is shown; Figure 4 A schematic diagram of an intermediate database cluster according to an embodiment of the present invention is shown.
[0074] According to an embodiment of the present invention, Figure 3 As shown, the database cluster to be updated 300 includes normal data nodes g1, data nodes to be updated g2 and normal data nodes g3, wherein the normal data node g1 includes the primary data shard n1 and the backup data shard n3, the data node to be updated g2 includes the primary data shard n2 and the backup data shard n1, and the normal data node g3 includes the primary data shard n3 and the backup data shard n2. The distribution structure of the data nodes and data shards of the database cluster to be updated can be as shown in Table 1.
[0075]
[0076] Determine that the normal data node distribution structure corresponding to the database cluster to be updated is the "g1 and g3" structure, call the replacement command corresponding to the normal data node distribution structure, and after setting the data node g2 to be updated to an unavailable state, determine that the backup data shard n2 corresponding to the primary data shard n2 of the data node g2 to be updated is set on the normal data node g3 according to the identification information, and replace the backup data shard n2 of the normal data node g3 with the primary data shard n2. After the replacement is completed, replace the primary data shard n2 of the data node g2 to be updated with the backup data shard n2. At this time, it is determined that the data shards of the data node g2 to be updated are all backup data shards, and the deletion operation is performed.
[0077] After the deletion operation is completed, the intermediate database cluster is as follows: Figure 4 As shown, the intermediate database cluster 400 includes a normal data node g1 and a normal data node g3, wherein the normal data node g1 includes a primary data shard n1 and a backup data shard n3, and the normal data node g3 includes a primary data shard n2 and a primary data shard n3. The distribution structure of the data nodes and data shards of the intermediate database cluster can be shown in Table 2.
[0078]
[0079] According to an embodiment of the present invention, based on the same identification information, the data shards of the data nodes to be updated and the data shards of the normal data nodes are replaced to obtain an intermediate database cluster, which also includes: when there is no normal data node distribution structure corresponding to the normal data nodes in the database cluster to be updated, or when the normal data node distribution structure does not meet the preset distribution conditions, a normal data node distribution structure is constructed according to the normal data nodes of the database cluster to be updated.
[0080] According to an embodiment of the present invention, in the absence of a normal data node distribution structure corresponding to the normal data nodes in the database cluster to be updated, the replacement command cannot be called using the coordination node; in the case where the normal data node distribution structure does not meet the preset distribution conditions, the replacement command called using the coordination node cannot be applied to the current database cluster to be updated. Based on the above two situations, it is necessary to construct a normal data node distribution structure based on the normal data nodes of the current database cluster to be updated. For example, if the database cluster to be updated includes data node g1, data node g2, and data node g3, and g2 is the data node to be updated, wherein the normal data node distribution structure corresponding to the database cluster to be updated is "g1 and g2", the preset distribution conditions are not met, and the normal data nodes are determined to be g1 and g3, and the constructed normal data node distribution structure is "g1 and g3".
[0081] According to an embodiment of the present invention, the method further includes: when there are multiple data nodes to be updated in the database cluster to be updated, traversing the primary data shard and the backup data shard of each data node to be updated; when there are primary data shards and backup data shards with the same identification information among multiple data nodes to be updated, selecting a target data node to be updated from the data nodes to be updated corresponding to the primary data shard and the data nodes to be updated corresponding to the backup data shard; wherein, based on the same identification information, replacing the data shards of the data node to be updated and the data shards of the normal data nodes to obtain an intermediate database cluster, including: replacing the data shards of the target data node to be updated and the data shards of the normal data nodes based on the same identification information to obtain a processed normal data node; replacing the data shards of multiple data nodes to be updated except the target data node to be updated and the data shards of the processed normal data nodes based on the same identification information to obtain an intermediate database cluster.
[0082] According to an embodiment of the present invention, if there are multiple data nodes to be updated, there may be multiple data nodes to be updated with primary data shards and backup data shards having the same identification information. For example, if the database cluster to be updated includes data node g1, data node g2, and data node g3, and data node g1 and data node g2 are data nodes to be updated, wherein data node g1 to be updated includes primary data shard n1 and backup data shard n3, and data node g2 to be updated includes primary data shard n2 and backup data shard n1.
[0083] According to an embodiment of the present invention, a data node is randomly selected from the data node to be updated corresponding to the primary data shard and the data node to be updated corresponding to the backup data shard as the target data node to be updated.
[0084] According to an embodiment of the present invention, the data shards of the target data node to be updated and the data shards of the normal data node are replaced based on the same identification information. For example, g1 is the target data node to be updated. During the replacement process, since data node g2 is the data node to be updated, the master data shard n1 of the data node to be updated g1 cannot determine the corresponding target backup data node in the normal data node. At this time, a normal data node is randomly selected, and a new master data shard n1 is created on the normal data node, and the data of the master data shard n1 of the data node to be updated g1 is transmitted to the new master data shard n1 through transmission between nodes.
[0085] According to an embodiment of the present invention, after the target data node to be updated completes the replacement process, since other nodes to be updated will not have the problem of data shard identification information conflict, they can be replaced with normal data shards that have undergone the above processing to obtain an intermediate database cluster.
[0086] According to an embodiment of the present invention, by performing replacement processing on multiple to-be-updated data nodes corresponding to primary data shards and backup data shards having the same identification information, the problem of data shard loss or replacement failure during the replacement process is avoided.
[0087] According to an embodiment of the present invention, in response to a database cluster update instruction, determining a database cluster to be updated includes: in response to the database cluster update instruction, determining configuration parameter information of the database cluster, wherein the configuration parameter information includes attribute information and user information corresponding to the database cluster; when the configuration parameter information satisfies a preset update condition, determining the database cluster as the database cluster to be updated.
[0088] According to an embodiment of the present invention, the attribute information may be the IP (Internet Protocol) address of the node to be updated, the database cluster where the node to be updated is located, and the host parameters (such as the host name or IP address) of the database cluster.
[0089] According to an embodiment of the present invention, the user information may be a user name and a user password of a database administrator (DBA), where each data node corresponds to a DBA user; and a user name and a user password of a user with the highest authority in the database cluster.
[0090] According to an embodiment of the present invention, whether the configuration parameter information meets the preset update condition may be determined by determining whether the input database cluster contains the data node to be updated, and whether the input user name and user password are correct.
[0091] According to the embodiment of the present invention, by judging the configuration parameter information of the database cluster, the security of the replacement process is guaranteed, the processing of the normal database cluster is avoided, and the attack behavior of the attacking user on the database cluster is avoided.
[0092] According to an embodiment of the present invention, a target update data node is inserted into an intermediate database cluster to obtain a target database cluster, including: when the target update data node meets preset conditions, the target update data node is inserted into the intermediate database cluster to obtain a target database cluster; based on the same identification information, the data storage information on the data shard of the processed normal data node is input into the data shard of the target update data node in the target database cluster.
[0093] According to an embodiment of the present invention, the preset condition may be that the target update data node operates normally.
[0094] According to an embodiment of the present invention, when the target update data node meets a preset condition, a communication connection is established between the target update data node and other data nodes to obtain a target database cluster.
[0095] According to an embodiment of the present invention, the data storage information may be data stored on a data slice, and a record log of a data write operation, etc.
[0096] According to an embodiment of the present invention, after the data storage information on the processed data slice of the normal data node is inputted into the data slice of the target update data node, if the data slice of the target update data node is the primary data slice, the data slice of the processed normal data node needs to be adjusted to the backup data slice. For example, the data slices of the processed normal data node g3 are primary data slice n2 and primary data slice n3, and the data storage information of the primary data slice n2 of the normal data node g3 is transmitted to the primary data slice n2 of the target update data node g2. After the transmission is completed, the primary data slice n2 of the normal data node g3 is modified to the backup data slice n2.
[0097] According to an embodiment of the present invention, since the data shard needs to be rebuilt when the data node to be updated is updated, that is, the data shard of the target updated data node is empty, data needs to be restored through inter-node data transmission.
[0098] According to the embodiments of the present invention, compared with the time-consuming and low-security problems caused by the need to transmit all data in the related art, the present invention only occupies a small amount of system resources and only transmits data to the target update data node, thereby improving the efficiency of data recovery. Moreover, due to the small amount of data transmitted, it is not easy to cause data loss, thereby further improving the stability of data recovery.
[0099] According to an embodiment of the present invention, when a target update data node meets a preset condition, the target update data node is inserted into an intermediate database cluster to obtain a target database cluster, including: obtaining first data stored in a data shard of the target update data node within a preset time period; based on the same identification information, determining a target data shard corresponding to the data shard of the target update data node in a processed normal data node; obtaining second data stored in the target data shard within a preset time period; comparing the first data with the second data to obtain a comparison result; when the comparison result indicates that the first data is consistent with the second data, inserting the target update data node into the intermediate database cluster to obtain the target database cluster.
[0100] According to an embodiment of the present invention, the preset period may be a period of time after the data node to be updated completes the update.
[0101] According to an embodiment of the present invention, the first data stored in the data slice of the target update data node may be the data stored in the data slice of the target update data node in a preset period of time, the time point when the write operation is executed, and the changes caused to the data by the write operation.
[0102] According to an embodiment of the present invention, the second data stored in the target data shard may be the data stored in the data shard of the processed normal data node during a preset period of time, the time point when the write operation is executed, and the changes caused to the data by the write operation.
[0103] According to an embodiment of the present invention, the first data and the second data are compared to determine whether the data stored in the two data slices are consistent within a preset time period and whether the write operations performed are consistent.
[0104] According to an embodiment of the present invention, when the comparison result indicates that the first data is consistent with the second data, the operation status of the target update data node is normal operation, and can be formally applied to the intermediate database cluster to obtain the target database cluster after insertion.
[0105] According to an embodiment of the present invention, by verifying the operating status of the target update data node, the problem of the target update data node being unable to be used normally after being inserted into the intermediate database cluster, thereby avoiding waste of system resources, can be improved to improve the accuracy of database cluster update.
[0106] Figure 5 A schematic diagram of a database cluster updating method according to an embodiment of the present invention is shown.
[0107] According to an embodiment of the present invention, a database cluster updating method 500 is as follows: Figure 5As shown, in operation S501, in response to a database cluster update instruction, the configuration parameter information of the database cluster is determined. In operation S502, it is determined whether the configuration parameter information of the database cluster meets the preset update condition. If not, the configuration parameter information of the database cluster is re-entered. If it is satisfied, operation S503 is executed to use the database cluster as the database cluster to be updated. In operation S504, it is determined whether the normal data node distribution structure corresponding to the database cluster to be updated meets the preset distribution condition. If it is satisfied, operation S506 is executed to call the replacement command corresponding to the normal data node distribution structure. If not, operation S505 is executed to construct the normal data node distribution structure corresponding to the database cluster to be updated according to the normal data nodes of the database cluster to be updated, and then operation S506 is executed. In response to the replacement command, operations S507 and S508 are performed, wherein, in operation S507, the target standby data shard corresponding to the primary data shard of the data node to be updated is determined in the normal data node of the database cluster to be updated, the target standby data shard is updated to the target primary data shard, and the primary data shard of the data node to be updated is adjusted to the standby data shard; in operation S508, the standby data shard of the data node to be updated is deleted. After the replacement process is completed, in operation S509, the intermediate database cluster is determined. In operation S510, the data node to be updated is updated to obtain the target updated data node. In operation S511, it is determined whether the target updated data node meets the preset conditions. If not, operation S510 is performed to re-update the process. If it is satisfied, operation S512 is performed to insert the target updated data node into the intermediate database cluster to obtain the target database cluster, and based on the same identification information, the data storage information on the data shard of the processed normal data node is input to the data shard of the target updated data node.
[0108] Based on the above database cluster update method, the present invention also provides a database cluster update device. Figure 6 The device is described in detail.
[0109] Figure 6 A structural block diagram of a database cluster updating device according to an embodiment of the present invention is shown.
[0110] like Figure 6 As shown, the database cluster updating device 600 of this embodiment includes a determination module 610 , a replacement module 620 , an update module 630 and an insertion module 640 .
[0111] The determination module 610 is used to determine the database cluster to be updated in response to the database cluster update instruction, wherein the database cluster to be updated includes multiple data nodes, the data nodes include the data nodes to be updated and the normal data nodes, each data node includes a data shard, and two data shards with the same identification information are respectively set on different data nodes. In one embodiment, the determination module 610 can be used to perform the operation S210 described above, which will not be repeated here.
[0112] The replacement module 620 is used to replace the data shards of the data node to be updated and the data shards of the normal data node based on the same identification information to obtain an intermediate database cluster, wherein the intermediate database cluster includes the processed normal data node. In one embodiment, the replacement module 620 can be used to perform the operation S220 described above, which will not be repeated here.
[0113] The updating module 630 is used to perform updating processing on the data node to be updated to obtain the target updated data node. In one embodiment, the updating module 630 can be used to perform the operation S230 described above, which will not be described in detail here.
[0114] The inserting module 640 is used to insert the target update data node into the intermediate database cluster to obtain the target database cluster. In one embodiment, the inserting module 640 can be used to perform the operation S240 described above, which will not be described in detail here.
[0115] According to an embodiment of the present invention, in response to a database cluster update instruction, a database cluster to be updated is determined; based on the same identification information, the data shards of the data node to be updated and the data shards of the normal data node are replaced to obtain an intermediate database cluster; the data node to be updated is updated to obtain a target update data node; the target update data node is inserted into the intermediate database cluster to obtain a target database cluster. Since the technical means of replacing the data shards of the data node to be updated and the data shards of the normal data node based on the same identification information is adopted, the problem of data loss easily caused by large-scale data transmission is avoided, and the technical effect of improving the stability and security of the database cluster replacement operation is achieved. In addition, since the target update data node is inserted into the intermediate database cluster to obtain the target database cluster, the problem of long operation time caused by building multiple clusters and large-scale data transmission is avoided, and the technical effect of improving the efficiency of the replacement operation and reducing the burden on the computer system is achieved.
[0116] According to an embodiment of the present invention, any multiple modules of the determination module 610, the replacement module 620, the update module 630 and the insertion module 640 can be combined into one module for implementation, or any one of the modules can be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules can be combined with at least part of the functions of other modules and implemented in one module. According to an embodiment of the present invention, at least one of the determination module 610, the replacement module 620, the update module 630 and the insertion module 640 can be at least partially implemented as a hardware circuit, 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 a package, an application specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware and firmware or in any appropriate combination of any of them. Alternatively, at least one of the determination module 610, the replacement module 620, the update module 630 and the insertion module 640 can be at least partially implemented as a computer program module, and when the computer program module is run, the corresponding function can be executed.
[0117] According to an embodiment of the present invention, the replacement module 620 includes a calling submodule, a first determining submodule, a second determining submodule, a first updating submodule and a third determining submodule.
[0118] The calling submodule is used to determine the normal data node distribution structure corresponding to the normal data nodes in the database cluster to be updated, and when the normal data node distribution structure meets the preset distribution conditions, call the replacement command corresponding to the normal data node distribution structure.
[0119] The first determination submodule is used to determine the data shards of the data node to be updated in response to the replacement command, wherein the two data shards with the same identification information include a primary data shard and a backup data shard, and the data content stored in the primary data shard and the backup data shard is the same.
[0120] The second determination submodule is used to determine, in the normal data nodes, a target backup data shard corresponding to the primary data shard of the data node to be updated according to the identification information of the primary data shard of the data node to be updated when the data shard of the data node to be updated is the primary data shard.
[0121] The first updating submodule is used to update the target backup data shard to the target primary data shard to obtain a processed normal data node.
[0122] The third determination submodule is used to determine the intermediate database cluster according to the processed normal data nodes.
[0123] According to an embodiment of the present invention, the replacement module 620 further includes a deletion submodule.
[0124] The deletion submodule is used to delete the backup data shard of the data node to be updated when the data shard of the data node to be updated is a backup data shard.
[0125] According to an embodiment of the present invention, the replacement module 620 further includes a construction submodule.
[0126] The construction submodule is used to construct a normal data node distribution structure according to the normal data nodes of the database cluster to be updated when there is no normal data node distribution structure corresponding to the normal data nodes in the database cluster to be updated, or when the normal data node distribution structure does not meet the preset distribution conditions.
[0127] According to the embodiment of the present invention, the database cluster updating device 800 further includes a traversal module and a selection module.
[0128] The traversal module is used to traverse the primary data shard and the backup data shard of each data node to be updated when there are multiple data nodes to be updated in the database cluster to be updated.
[0129] The selection module is used to select a target data node to be updated from the data nodes to be updated corresponding to the primary data shard and the data nodes to be updated corresponding to the backup data shard when there are primary data shards and backup data shards with the same identification information among multiple data nodes to be updated.
[0130] The replacement module 620 includes a first replacement submodule and a second replacement submodule.
[0131] The first replacement submodule is used to replace the data slices of the target data node to be updated and the data slices of the normal data node based on the same identification information to obtain the processed normal data node.
[0132] The second replacement submodule is used to replace the data slices of multiple data nodes to be updated except the target data node to be updated and the processed data slices of normal data nodes based on the same identification information to obtain an intermediate database cluster.
[0133] According to an embodiment of the present invention, the determination module 610 includes a fourth determination submodule and a fifth determination submodule.
[0134] The fourth determining submodule is used to determine configuration parameter information of the database cluster in response to the database cluster update instruction, wherein the configuration parameter information includes attribute information and user information corresponding to the database cluster.
[0135] The fifth determination submodule is used to determine the database cluster as a database cluster to be updated when the configuration parameter information meets a preset update condition.
[0136] According to an embodiment of the present invention, the insertion module 640 includes an insertion submodule and an input submodule.
[0137] The insertion submodule is used to insert the target update data node into the intermediate database cluster to obtain the target database cluster when the target update data node meets the preset conditions.
[0138] The input submodule is used to input the data storage information on the processed data shard of the normal data node into the data shard of the target update data node in the target database cluster based on the same identification information.
[0139] According to an embodiment of the present invention, the inserting submodule includes a first acquiring unit, a determining unit, a second acquiring unit, a comparing unit and an inserting unit.
[0140] The first acquisition unit is used to acquire first data stored in the data slice of the target update data node within a preset time period.
[0141] A determination unit is used to determine, in the processed normal data nodes, a target data shard corresponding to the data shard of the target update data node based on the same identification information.
[0142] The second acquisition unit is used to acquire second data stored in the target data segment within a preset time period.
[0143] The comparison unit is used to compare the first data with the second data to obtain a comparison result.
[0144] The inserting unit is used to insert the target update data node into the intermediate database cluster to obtain the target database cluster when the comparison result indicates that the first data is consistent with the second data.
[0145] Figure 7 A block diagram of an electronic device suitable for implementing a database cluster updating method according to an embodiment of the present invention is shown.
[0146] like Figure 7As shown, the electronic device 700 according to an embodiment of the present invention includes a processor 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage part 708 to a random access memory (RAM) 703. The processor 701 may include, for example, a general-purpose microprocessor (such as a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (for example, an application-specific integrated circuit (ASIC)), etc. The processor 701 may also include an onboard memory for caching purposes. The processor 701 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.
[0147] In RAM703, various programs and data required for the operation of electronic device 700 are stored. Processor 701, ROM702 and RAM 703 are connected to each other via bus 704. Processor 701 performs various operations of the method flow according to the embodiment of the present invention by executing the program in ROM 702 and / or RAM 703. It should be noted that the program can also be stored in one or more memories other than ROM 702 and RAM 703. Processor 701 can also perform various operations of the method flow according to the embodiment of the present invention by executing the program stored in the one or more memories.
[0148] According to an embodiment of the present invention, the electronic device 700 may further include an input / output (I / O) interface 705, which is also connected to the bus 704. The electronic device 700 may further include one or more of the following components connected to the input / output (I / O) interface 705: an input portion 706 including a keyboard, a mouse, etc.; an output portion 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 708 including a hard disk, etc.; and a communication portion 709 including a network interface card such as a LAN card, a modem, etc. The communication portion 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the input / output (I / O) interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed, so that a computer program read therefrom is installed into the storage portion 708 as needed.
[0149] The present invention also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiment; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present invention is implemented.
[0150] According to an embodiment of the present invention, the computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, it may include but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present invention, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, an apparatus or a device. For example, according to an embodiment of the present invention, the computer-readable storage medium may include the ROM 702 and / or RAM 703 described above and / or one or more memories other than ROM 702 and RAM 703.
[0151] The embodiment of the present invention also includes a computer program product, which includes a computer program, and the computer program contains program code for executing the method shown in the flowchart. When the computer program product is run in a computer system, the program code is used to enable the computer system to implement the database cluster update method provided by the embodiment of the present invention.
[0152] The computer program executes the above functions defined in the system / device of the embodiment of the present invention when it is executed by the processor 701. According to the embodiment of the present invention, the system, device, module, unit, etc. described above can be implemented by a computer program module.
[0153] In one embodiment, the computer program may rely on tangible storage media such as optical storage devices, magnetic storage devices, etc. In another embodiment, the computer program may also be transmitted and distributed in the form of signals on a network medium, and downloaded and installed through the communication part 709, and / or installed from the removable medium 711. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0154] In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 709, and / or installed from the removable medium 711. When the computer program is executed by the processor 701, the above functions defined in the system of the embodiment of the present invention are performed. According to the embodiment of the present invention, the system, device, means, module, unit, etc. described above can be implemented by a computer program module.
[0155] According to an embodiment of the present invention, the program code for executing the computer program provided by the embodiment of the present invention can be written in any combination of one or more programming languages. Specifically, these computing programs can be implemented using high-level process and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, Java, C++, python, "C" language or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on the remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (e.g., using an Internet service provider to connect through the Internet).
[0156] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0157] It will be appreciated by those skilled in the art that the features described in the various embodiments of the present invention may be combined and / or combined in various ways, even if such combinations or combinations are not explicitly described in the present invention. In particular, without departing from the spirit and teachings of the present invention, the features described in the various embodiments of the present invention may be combined and / or combined in various ways. All of these combinations and / or combinations fall within the scope of the present invention.
[0158] The embodiments of the present invention are described above. However, these embodiments are only for the purpose of illustration, and are not intended to limit the scope of the present invention. Although each embodiment is described above, it does not mean that the measures in each embodiment cannot be used in combination advantageously. Without departing from the scope of the present invention, those skilled in the art may make various substitutions and modifications, which should all fall within the scope of the present invention.
Claims
1. A database cluster update method, characterized in that: The method comprises: In response to the database cluster update instruction, determine a database cluster to be updated, wherein the database cluster to be updated includes multiple data nodes, the data nodes include data nodes to be updated and normal data nodes, each of the data nodes includes a data shard, and two data shards with the same identification information are respectively set on different data nodes; Based on the same identification information, replace the data shards of the to-be-updated data nodes and the data shards of the normal data nodes to obtain an intermediate database cluster, wherein the intermediate database cluster includes the processed normal data nodes; Performing update processing on the data node to be updated to obtain a target updated data node; Insert the target update data node into the intermediate database cluster to obtain a target database cluster.
2. The method according to claim 1, characterized in that: The replacing processing of the data shards of the to-be-updated data nodes and the data shards of the normal data nodes based on the same identification information to obtain an intermediate database cluster includes: Determine a normal data node distribution structure corresponding to the normal data nodes in the database cluster to be updated, and if the normal data node distribution structure meets a preset distribution condition, call a replacement command corresponding to the normal data node distribution structure; In response to the replacement command, determine the data shards of the data node to be updated, wherein the two data shards having the same identification information include a primary data shard and a backup data shard, and the primary data shard and the backup data shard store the same data content; In the case where the data shard of the to-be-updated data node is a primary data shard, determining, in the normal data node, a target standby data shard corresponding to the primary data shard of the to-be-updated data node according to the identification information of the primary data shard of the to-be-updated data node; Updating the target backup data shard to the target primary data shard to obtain the processed normal data node; The intermediate database cluster is determined according to the processed normal data nodes.
3. The method according to claim 2, characterized in that The replacing processing of the data shards of the to-be-updated data nodes and the data shards of the normal data nodes based on the same identification information to obtain an intermediate database cluster further includes: In the case where the data shard of the data node to be updated is a backup data shard, the backup data shard of the data node to be updated is deleted.
4. The method according to claim 2, characterized in that: The normal data node distribution structure includes a plurality of the normal data nodes, and the preset distribution condition indicates that the normal data node distribution structure does not include the data node to be updated.
5. The method according to claim 2, characterized in that: The replacing processing of the data shards of the to-be-updated data nodes and the data shards of the normal data nodes based on the same identification information to obtain an intermediate database cluster further includes: When there is no normal data node distribution structure corresponding to the normal data nodes in the database cluster to be updated, or when the normal data node distribution structure does not meet the preset distribution conditions, the normal data node distribution structure is constructed according to the normal data nodes of the database cluster to be updated.
6. The method according to claim 2, characterized in that The method further comprises: In the case where there are multiple data nodes to be updated in the database cluster to be updated, traverse the primary data shard and the backup data shard of each data node to be updated; In the case that there are the primary data shard and the backup data shard with the same identification information among the multiple data nodes to be updated, selecting a target data node to be updated from the data nodes to be updated corresponding to the primary data shard and the data nodes to be updated corresponding to the backup data shard; The replacing process of the data shards of the to-be-updated data nodes and the data shards of the normal data nodes based on the same identification information to obtain an intermediate database cluster includes: Based on the same identification information, the data slices of the target data node to be updated and the data slices of the normal data node are replaced to obtain the processed normal data node; Based on the same identification information, data shards of a plurality of the to-be-updated data nodes except the target to-be-updated data node and the processed data shards of the normal data nodes are replaced to obtain the intermediate database cluster.
7. The method according to claim 1, characterized in that The step of determining the database cluster to be updated in response to the database cluster update instruction includes: In response to the database cluster update instruction, determine configuration parameter information of the database cluster, wherein the configuration parameter information includes attribute information and user information corresponding to the database cluster; When the configuration parameter information satisfies a preset update condition, the database cluster is determined as the database cluster to be updated.
8. The method according to claim 1, characterized in that The step of inserting the target update data node into the intermediate database cluster to obtain a target database cluster includes: When the target update data node meets a preset condition, inserting the target update data node into the intermediate database cluster to obtain the target database cluster; Based on the same identification information, the data storage information on the data shard of the normal data node after processing is input into the data shard of the target update data node in the target database cluster.
9. The method according to claim 8, characterized in that When the target update data node meets a preset condition, inserting the target update data node into the intermediate database cluster to obtain the target database cluster includes: Acquire the first data stored in the data slice of the target update data node within a preset time period; Based on the same identification information, determining, in the processed normal data node, a target data shard corresponding to the data shard of the target update data node; Acquire the second data stored in the target data slice within a preset time period; Comparing the first data with the second data to obtain a comparison result; When the comparison result indicates that the first data is consistent with the second data, the target update data node is inserted into the intermediate database cluster to obtain the target database cluster.
10. A database cluster updating device, characterized in that: The device comprises: A determination module, configured to determine a database cluster to be updated in response to a database cluster update instruction, wherein the database cluster to be updated includes a plurality of data nodes, the data nodes include data nodes to be updated and normal data nodes, each of the data nodes includes a data shard, and two data shards having the same identification information are respectively set on different data nodes; A replacement module, configured to replace the data shards of the data node to be updated and the data shards of the normal data node based on the same identification information, to obtain an intermediate database cluster, wherein the intermediate database cluster includes the processed normal data node; An updating module, used to update the data node to be updated to obtain a target updated data node; and The inserting module is used to insert the target update data node into the intermediate database cluster to obtain a target database cluster.
Citation Information
Patent Citations
Node downtime recovery method and device, electronic equipment and storage medium
CN109815049A
Method and device for updating nodes in distributed cluster
CN113596172A
Fault processing method and device, electronic equipment and storage medium
CN113852506A
Database node upgrading method and device and computer equipment
CN116680256A
Cloud database cluster management method and system, electronic equipment and storage medium
CN117874142A
