Data sharding deployment method, device, equipment and storage medium

By obtaining and analyzing the network protocol addresses and correspondence lists of cluster nodes, and combining the parameters of primary sharding and backup sharding, a data sharding deployment plan is generated, which solves the high availability problem when nodes in the GBase8a cluster are damaged and improves data sharding. Deployment accuracy and efficiency.

CN118426970BActive Publication Date: 2024-10-29TIANJIN NANKAI UNIV GENERAL DATA TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410851289.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-28
Publication Date
2024-10-29
Estimated Expiration
2044-06-28

AI Technical Summary

Technical Problem

In the GBase8a distributed data storage cluster, when a node is damaged, it is difficult to achieve high availability of the cabinet through manual configuration. Especially when the number of data nodes increases sharply, it is difficult to effectively allocate primary shards and backup shards to maintain high availability of the cluster. Available status.

Method used

By obtaining the network protocol address and corresponding relationship list of the cluster nodes, calculate the actual number of cabinets and nodes, combined with the primary sharding and backup sharding parameters, determine whether the allocation conditions are met, and generate a data sharding deployment plan based on these parameters. Make sure primary and backup shards are allocated in different cabinets.

Benefits of technology

It improves the accuracy and efficiency of data sharding deployment, reduces manual errors, and ensures that the cluster maintains high availability and data integrity even when nodes are damaged.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118426970B_ABST
    Figure CN118426970B_ABST
Patent Text Reader

Abstract

The present application is applicable to the field of data processing technology, and provides a data sharding deployment method, device, equipment and storage medium, the method comprising: obtaining the network protocol address of each node in the cluster, the corresponding relationship list between the actual cabinets constituting the cluster and each node, the primary sharding parameters and the backup sharding parameters; based on the network protocol address of each node and the corresponding relationship list between the actual cabinets constituting the cluster and each node, obtaining the actual number of cabinets, the number of nodes in each actual cabinet and the total number of nodes; based on the above parameters, judging whether the cluster meets the allocation conditions; if the allocation conditions are met, obtaining the data sharding deployment plan according to the corresponding relationship list, the primary sharding parameters and the backup sharding parameters. The present application can greatly improve the accuracy and efficiency of cluster data sharding deployment, and ensure that the primary shards and backup shards are distributed in different cabinets.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of data processing technology, and in particular, relates to a data sharding deployment method, device, equipment and storage medium. Background Art

[0002] Currently, the GBase8a distributed data storage cluster supports maintaining high availability of the cluster when individual nodes are damaged. In particular, when a data node is damaged, the data shard of the damaged node cannot be used because the primary shard of the data and its backup shard are not stored on the same node, while the other node where its backup shard is located is in normal state, so that the cluster still maintains data integrity and can be used normally.

[0003] In actual applications, the cause of node damage is likely to be hardware failure or power failure, and such failures are likely to directly affect the use of the entire cabinet. Therefore, under the premise that the original master and backup shards are distributed in different nodes, the master and backup shard data are further distributed to different cabinets, so that the high availability function of the cluster is optimized.

[0004] However, this optimization method is difficult to implement through human identification and manual configuration, and users have high requirements for the scale of cluster products in actual applications. They usually build clusters of hundreds of data nodes. After GBase8a 953 version supports dual instances, the number of data nodes increases sharply, making it more difficult to implement a highly available data sharding distribution method for cabinets. Summary of the invention

[0005] The embodiments of the present application provide a data sharding deployment method, apparatus, device and storage medium to significantly improve the accuracy and efficiency of cluster data sharding deployment and ensure that the primary shards and backup shards are distributed in different cabinets.

[0006] This application is implemented through the following technical solutions:

[0007] In a first aspect, an embodiment of the present application provides a data sharding deployment method, including:

[0008] Get the network protocol address of each node in the cluster, the corresponding list of the actual cabinets that make up the cluster and each node, the primary shard parameters, and the backup shard parameters; the primary shard parameters are the target number of primary shards allocated to each node, and the backup shard parameters are the target number of backup shards allocated to each node.

[0009] Based on the network protocol address of each node and the corresponding relationship list between the actual cabinets constituting the cluster and each node, the actual number of cabinets, the number of nodes in each actual cabinet and the total number of nodes are obtained.

[0010] Based on the actual number of cabinets, the number of nodes in each actual cabinet, the total number of nodes, the primary shard parameters, and the backup shard parameters, determine whether the cluster meets the allocation conditions.

[0011] If the allocation conditions are met, the data sharding deployment plan is obtained based on the corresponding relationship list, primary sharding parameters, and backup sharding parameters.

[0012] In combination with the first aspect, in some possible implementations, judging whether the cluster meets the allocation conditions based on the actual number of cabinets, the number of nodes in each actual cabinet, the total number of nodes, the primary shard parameters, and the backup shard parameters includes:

[0013] The sum of the backup shard parameter and a preset value is calculated to obtain the number of virtual cabinets; wherein the preset value is a positive integer.

[0014] If the number of virtual cabinets is less than or equal to the number of actual cabinets, the cluster is judged to meet the allocation conditions based on the number of virtual cabinets, the number of actual cabinets, the number of nodes in each actual cabinet, the total number of nodes, the primary shard parameters, and the backup shard parameters.

[0015] If the number of virtual cabinets is greater than the actual number of cabinets, it is determined that the allocation conditions are not met, an error is reported, and the data sharding deployment method is exited.

[0016] In combination with the first aspect, in some possible implementations, judging whether the cluster meets the allocation conditions based on the number of virtual cabinets, the number of actual cabinets, the number of nodes in each actual cabinet, the total number of nodes, the primary shard parameters, and the backup shard parameters includes:

[0017] Determine whether the primary shard parameter, the backup shard parameter, and the number of nodes in each actual cabinet meet the first preset condition; the primary shard parameter is 1, the backup shard parameter is 1, and the number of nodes in each actual cabinet is 1.

[0018] If the first preset condition is met, it is determined that the allocation condition is met.

[0019] If the first preset condition is not met, it is determined whether the cluster meets the allocation conditions based on the number of virtual cabinets, primary shard parameters, the total number of nodes, the number of actual cabinets, and the number of nodes in each actual cabinet.

[0020] In combination with the first aspect, in some possible implementations, judging whether the cluster meets the allocation conditions based on the number of virtual cabinets, primary shard parameters, the total number of nodes, the number of actual cabinets, and the number of nodes in each actual cabinet includes:

[0021] Determine whether the total number of nodes is divisible by the number of virtual cabinets.

[0022] If it is divisible, the number of nodes in each virtual cabinet is calculated based on the total number of nodes and the number of virtual cabinets. Based on the number of nodes in each virtual cabinet, the primary shard parameters, the number of virtual cabinets, the actual number of cabinets, and the number of nodes in each actual cabinet, it is determined whether the cluster meets the allocation conditions.

[0023] If it cannot be divided evenly, it is determined that the allocation condition is not met, an error is reported, and the data sharding deployment method is exited.

[0024] In combination with the first aspect, in some possible implementations, judging whether the cluster meets the allocation conditions based on the number of nodes in each virtual cabinet, primary shard parameters, the number of virtual cabinets, the actual number of cabinets, and the number of nodes in each actual cabinet includes:

[0025] Determine whether the number of nodes in each virtual cabinet is greater than the primary shard parameter.

[0026] If it is greater than the primary shard parameter, the cluster is judged to meet the allocation conditions based on the number of virtual cabinets, the number of actual cabinets, the number of nodes in each actual cabinet, and the number of nodes in each virtual cabinet.

[0027] If it is less than or equal to the primary shard parameter, it is determined that the allocation condition is not met, an error is reported, and the data shard deployment method is exited.

[0028] In combination with the first aspect, in some possible implementations, judging whether the cluster meets the allocation condition based on the number of virtual cabinets, the number of actual cabinets, the number of nodes in each actual cabinet, and the number of nodes in each virtual cabinet includes:

[0029] Determine whether the number of virtual cabinets, the actual number of cabinets, the number of nodes in each actual cabinet, and the number of nodes in each virtual cabinet meet the second preset condition; wherein the second preset condition is that the number of virtual cabinets is equal to the actual number of cabinets, and the number of nodes in each actual cabinet is equal to the number of nodes in each virtual cabinet.

[0030] If the second preset condition is met, it is determined that the allocation condition is met.

[0031] If the second preset condition is not met, determine whether the number of nodes in each actual cabinet is less than or equal to the number of nodes in each virtual cabinet. If the number of nodes in each actual cabinet is less than or equal to the number of nodes in each virtual cabinet, determine that the allocation conditions are met.

[0032] If the number of nodes in each actual cabinet is greater than the number of nodes in each virtual cabinet, it is determined that the allocation condition is not met, an error is reported, and the data sharding deployment method is exited.

[0033] In combination with the first aspect, in some possible implementations, a data sharding deployment solution is obtained according to the correspondence list, the primary sharding parameters, and the backup sharding parameters, including:

[0034] The primary shards are allocated in the order of the correspondence list, the backup shard parameter is used as the polling number, and the order of the correspondence list is used as the polling order, and the backup shards are polled and allocated to obtain a data shard deployment plan; wherein the primary shards and the corresponding backup shards in the data shard deployment plan are allocated in different actual cabinets, and the number of backup shards allocated to each node in the data shard deployment plan does not exceed the product of the primary shard parameter and the backup shard parameter.

[0035] Based on the network protocol address of each node and the corresponding relationship list between the actual cabinets that make up the cluster and each node, the actual number of cabinets, the number of nodes in each actual cabinet, and the total number of nodes are obtained, including:

[0036] Sum up the number of nodes to get the total number of nodes.

[0037] Through the corresponding relationship list between the actual cabinets constituting the cluster and each node, the actually existing cabinets and the nodes in each actual cabinet can be directly obtained.

[0038] The actual number of cabinets is summed up to obtain the actual number of cabinets.

[0039] The number of nodes in each actual cabinet is summarized to obtain the number of nodes in each actual cabinet.

[0040] In a second aspect, an embodiment of the present application provides a data sharding deployment device, including:

[0041] The data acquisition module is used to obtain the network protocol address of each node in the cluster, the corresponding relationship list between the actual cabinets that make up the cluster and each node, the primary shard parameters, and the backup shard parameters; among which, the primary shard parameters are the target number of primary shards allocated to each node, and the backup shard parameters are the target number of backup shards allocated to each node.

[0042] The data parsing module is used to obtain the actual number of cabinets, the number of nodes in each actual cabinet and the total number of nodes based on the network protocol address of each node and the corresponding relationship list between the actual cabinets constituting the cluster and each node.

[0043] The data judgment module is used to judge whether the cluster meets the allocation conditions based on the actual number of cabinets, the number of nodes in each actual cabinet, the total number of nodes, the primary shard parameters and the backup shard parameters.

[0044] The result output module is used to obtain the data sharding deployment plan according to the corresponding relationship list, the primary sharding parameters and the backup sharding parameters if the allocation conditions are met.

[0045] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a processor and a memory, the memory being used to store a computer program, and when the processor executes the computer program, the data sharding deployment method as described in any one of the first aspects is implemented.

[0046] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the data sharding deployment method as described in any one of the first aspects is implemented.

[0047] It can be understood that the beneficial effects of the second to fourth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here.

[0048] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:

[0049] The present application determines the actual number of cabinets, the number of nodes in each actual cabinet and the total number of nodes through the network protocol address and the correspondence list of each node. According to the above parameters, the primary shard parameters and the backup shard parameters, it can preliminarily determine whether the allocation conditions are met. If the allocation conditions are met, the data shard deployment plan can be obtained according to the correspondence list, the primary shard parameters and the backup shard parameters. Compared with manually determining the deployment plan, it is more efficient and can obtain the data shard deployment plan more accurately.

[0050] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present specification. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0052] Figure 1 It is a flowchart of a data sharding deployment method provided by an embodiment of the present application;

[0053] Figure 2 It is a structural diagram of a data sharding deployment device provided in one embodiment of the present application;

[0054] Figure 3It is a schematic diagram of the structure of an electronic device provided in one embodiment of the present application. DETAILED DESCRIPTION

[0055] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0056] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.

[0057] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0058] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.

[0059] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.

[0060] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0061] The present application provides a data sharding deployment method. Figure 1 is a schematic diagram of the process of a data sharding deployment method provided in an embodiment of the present application, with reference to Figure 1 , the data sharding deployment method is described in detail as follows:

[0062] Step 101, obtain the network protocol address of each node in the cluster, the corresponding relationship list between the actual cabinets constituting the cluster and each node, the primary shard parameters and the backup shard parameters; wherein the primary shard parameters are the target number of primary shards allocated to each node, and the backup shard parameters are the target number of backup shards allocated to each node.

[0063] In some specific embodiments, each node of the GBase8a distributed data storage cluster has a network IP address (Internet Protocol Address) and the type of the IP address (mainly divided into ipv4, ipv6 and domain name).

[0064] Step 102 , based on the network protocol address of each node and the corresponding relationship list between the actual cabinets constituting the cluster and each node, obtain the actual number of cabinets, the number of nodes in each actual cabinet and the total number of nodes.

[0065] Exemplarily, step 102 may include:

[0066] Sum up the number of nodes to get the total number of nodes.

[0067] Through the corresponding relationship list between the actual cabinets constituting the cluster and each node, the actually existing cabinets and the nodes in each actual cabinet can be directly obtained.

[0068] The actual number of cabinets is summed up to obtain the actual number of cabinets.

[0069] The number of nodes in each actual cabinet is summarized to obtain the number of nodes in each actual cabinet.

[0070] In some specific embodiments, the parsing tool for parsing is an existing node parsing tool, which can parse out the actual cabinet where each node is located. During the parsing process, it is also checked whether the nodes in the text file (correspondence list) exist and are repeated, whether the rack (actual cabinet) name is repeated, and whether the input primary shard parameters and backup shard parameters exist and the values ​​are reasonable. Exemplarily, the reasonable value of the primary shard parameter can be 1-65535, and the reasonable value of the backup shard parameter can be 1 or 2. The backup shard parameter can also be other positive integers, but considering that it is not very meaningful if it is greater than 2, and it will also increase the data storage burden, so the reasonable value of the backup shard parameter can be set to 1 or 2.

[0071] Step 103 , based on the actual number of cabinets, the number of nodes in each actual cabinet, the total number of nodes, the primary shard parameters, and the backup shard parameters, determine whether the cluster meets the allocation conditions.

[0072] Exemplarily, step 103 may include:

[0073] The sum of the backup shard parameter and a preset value is calculated to obtain the number of virtual cabinets; wherein the preset value is a positive integer.

[0074] If the number of virtual cabinets is less than or equal to the number of actual cabinets, the cluster is judged to meet the allocation conditions based on the number of virtual cabinets, the number of actual cabinets, the number of nodes in each actual cabinet, the total number of nodes, the primary shard parameters, and the backup shard parameters.

[0075] If the number of virtual cabinets is greater than the actual number of cabinets, it is determined that the allocation conditions are not met, an error is reported, and the data sharding deployment method is exited.

[0076] In some specific embodiments, in order to expand the applicable scope of the method as much as possible, the value of the preset value is generally 1.

[0077] Exemplarily, judging whether the cluster meets the allocation conditions based on the number of virtual cabinets, the number of actual cabinets, the number of nodes in each actual cabinet, the total number of nodes, the primary shard parameters, and the backup shard parameters may include:

[0078] Determine whether the primary shard parameter, the backup shard parameter, and the number of nodes in each actual cabinet meet the first preset condition; the first preset condition is that the primary shard parameter is 1, the backup shard parameter is 1, and the number of nodes in each actual cabinet is 1.

[0079] If the first preset condition is met, it is determined that the allocation condition is met.

[0080] If the first preset condition is not met, it is determined whether the cluster meets the allocation conditions based on the number of virtual cabinets, primary shard parameters, the total number of nodes, the number of actual cabinets, and the number of nodes in each actual cabinet.

[0081] Exemplarily, judging whether the cluster meets the allocation conditions based on the number of virtual cabinets, primary shard parameters, the total number of nodes, the number of actual cabinets, and the number of nodes in each actual cabinet may include:

[0082] Determine whether the total number of nodes is divisible by the number of virtual cabinets.

[0083] If it is divisible, the number of nodes in each virtual cabinet is calculated based on the total number of nodes and the number of virtual cabinets. Based on the number of nodes in each virtual cabinet, the primary shard parameters, the number of virtual cabinets, the actual number of cabinets, and the number of nodes in each actual cabinet, it is determined whether the cluster meets the allocation conditions.

[0084] If it cannot be divided evenly, it is determined that the allocation condition is not met, an error is reported, and the data sharding deployment method is exited.

[0085] Exemplarily, judging whether the cluster meets the allocation condition based on the number of nodes in each virtual cabinet, primary shard parameters, the number of virtual cabinets, the number of actual cabinets, and the number of nodes in each actual cabinet may include:

[0086] Determine whether the number of nodes in each virtual cabinet is greater than the primary shard parameter.

[0087] If it is greater than the primary shard parameter, the cluster is judged to meet the allocation conditions based on the number of virtual cabinets, the number of actual cabinets, the number of nodes in each actual cabinet, and the number of nodes in each virtual cabinet.

[0088] If it is less than or equal to the primary shard parameter, it is determined that the allocation condition is not met, an error is reported, and the data shard deployment method is exited.

[0089] Exemplarily, judging whether the cluster meets the allocation condition based on the number of virtual cabinets, the number of actual cabinets, the number of nodes in each actual cabinet, and the number of nodes in each virtual cabinet may include:

[0090] Determine whether the number of virtual cabinets, the actual number of cabinets, the number of nodes in each actual cabinet, and the number of nodes in each virtual cabinet meet the second preset condition; wherein the second preset condition is that the number of virtual cabinets is equal to the actual number of cabinets, and the number of nodes in each actual cabinet is equal to the number of nodes in each virtual cabinet.

[0091] If the second preset condition is met, it is determined that the allocation condition is met.

[0092] If the second preset condition is not met, determine whether the number of nodes in each actual cabinet is less than or equal to the number of nodes in each virtual cabinet. If the number of nodes in each actual cabinet is less than or equal to the number of nodes in each virtual cabinet, determine that the allocation conditions are met.

[0093] If the number of nodes in each actual cabinet is greater than the number of nodes in each virtual cabinet, it is determined that the allocation condition is not met, an error is reported, and the data sharding deployment method is exited.

[0094] Specifically, because of the multi-part condition screening, all the cases that do not meet the allocation conditions have been eliminated. Therefore, no matter how the allocation is performed, the corresponding data sharding deployment plan that can be used for execution can be obtained. The efficiency of allocation is improved, and the possibility of manual allocation errors is reduced. The primary and backup shards of the data are accurately and efficiently allocated to the cabinet.

[0095] For ease of understanding, the following embodiments are shown:

[0096] Cabinet 1: Node 1, Node 2, Node 3;

[0097] Cabinet 2: Node 4, Node 5, Node 6;

[0098] Then the actual number of cabinets rn=2, the number of nodes in each actual cabinet en=3, and the total number of nodes sn=6.

[0099] Assume that the number of primary shards allowed to be allocated to each node is p=1, and the number of backup shards allowed to be allocated to each node is d=2, then p*d=2.

[0100] According to d, the number of virtual cabinets to be reallocated is determined to be drn=3.

[0101] drn>rn, indicating that it cannot be guaranteed that the backup shards and the primary shards are allocated to different nodes in different cabinets.

[0102] Assuming that the number of primary shards allowed to be allocated to each node is p=1, and the number of backup shards allowed to be allocated to each node is d=1, then p*d=1,

[0103] According to d, the number of virtual cabinets to be reallocated is determined to be drn=2.

[0104] drn=rn, and then we go down to the next step. At this time, p=1, d=1, but en≠1.

[0105] Then calculate a=sn / drn=3, a>p, and then proceed. If a≤p, report an error and exit.

[0106] Determine whether drn=rn and a=en are satisfied. If so, the data sharding deployment plan is obtained according to the corresponding relationship list, primary sharding parameters, and backup sharding parameters. If not, continue to determine whether en<=a is true. If the condition is satisfied, the data sharding deployment plan is obtained according to the corresponding relationship list, primary sharding parameters, and backup sharding parameters. Otherwise, an error is reported and the program is exited.

[0107] Step 104: If the allocation conditions are met, a data sharding deployment plan is obtained according to the corresponding relationship list, the primary sharding parameters, and the backup sharding parameters.

[0108] Exemplarily, step 104 may include:

[0109] The primary shards are allocated in the order of the correspondence list, the backup shard parameter is used as the polling number, and the order of the correspondence list is used as the polling order, and the backup shards are polled and allocated to obtain a data shard deployment plan; wherein the primary shards and the corresponding backup shards in the data shard deployment plan are allocated in different actual cabinets, and the number of backup shards allocated to each node in the data shard deployment plan does not exceed the product of the primary shard parameter and the backup shard parameter.

[0110] In some specific embodiments, the backup shard parameter is the number of times the backup shard is polled and allocated, for example, when the backup shard parameter is 2, the number of polls when polling and allocating backup shards is 2. In the data shard deployment scheme, each node is allocated the same number of primary shards, and each node is allocated the same number of backup shards.

[0111] Specifically, because the above method only obtains executable data sharding deployment plans, but some of the plans cannot maintain high availability of the cluster when individual nodes are damaged, it is necessary to screen out from the data sharding deployment plans the plan in which the primary shard and the corresponding backup shard are allocated in different actual cabinets, thereby achieving high availability of the cluster, so that the cluster still maintains data integrity and can be used normally, thereby ensuring the stability of cluster operation.

[0112] The above data sharding deployment method determines the actual number of cabinets, the number of nodes in each actual cabinet and the total number of nodes through the network protocol address and the correspondence list of each node. According to the above parameters, the primary sharding parameters and the backup sharding parameters, it can preliminarily determine whether the allocation conditions are met. If the allocation conditions are met, the data sharding deployment plan can be obtained according to the correspondence list, the primary sharding parameters and the backup sharding parameters. Compared with manually determining the deployment plan, it is more efficient and can obtain the data sharding deployment plan more accurately.

[0113] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0114] Corresponding to the data sharding deployment method described in the above embodiment, Figure 2 A structural block diagram of a data sharding deployment device provided in an embodiment of the present application is shown. For ease of explanation, only the parts related to the embodiment of the present application are shown.

[0115] See also Figure 2 , the data sharding deployment device in the embodiment of the present application may include:

[0116] The data acquisition module 201 is used to obtain the network protocol address of each node in the cluster, the corresponding relationship list between the actual cabinets constituting the cluster and each node, the primary shard parameters and the backup shard parameters; wherein the primary shard parameters are the target number of primary shards allocated to each node, and the backup shard parameters are the target number of backup shards allocated to each node.

[0117] The data analysis module 202 is used to obtain the actual number of cabinets, the number of nodes in each actual cabinet and the total number of nodes based on the network protocol address of each node and the corresponding relationship list between the actual cabinets constituting the cluster and each node.

[0118] The data judgment module 203 is used to judge whether the cluster meets the allocation conditions based on the actual number of cabinets, the number of nodes in each actual cabinet, the total number of nodes, the primary shard parameters and the backup shard parameters.

[0119] The result output module 204 is used to obtain a data sharding deployment plan according to the corresponding relationship list, the primary sharding parameters and the backup sharding parameters if the allocation conditions are met.

[0120] Exemplarily, the data determination module 203 may be used to:

[0121] The sum of the backup shard parameter and a preset value is calculated to obtain the number of virtual cabinets; wherein the preset value is a positive integer.

[0122] If the number of virtual cabinets is less than or equal to the number of actual cabinets, the cluster is judged to meet the allocation conditions based on the number of virtual cabinets, the number of actual cabinets, the number of nodes in each actual cabinet, the total number of nodes, the primary shard parameters, and the backup shard parameters.

[0123] If the number of virtual cabinets is greater than the actual number of cabinets, it is determined that the allocation conditions are not met, an error is reported, and the data sharding deployment method is exited.

[0124] Exemplarily, the data determination module 203 may also be used to:

[0125] Determine whether the primary shard parameter, the backup shard parameter, and the number of nodes in each actual cabinet meet the first preset condition; the first preset condition is that the primary shard parameter is 1, the backup shard parameter is 1, and the number of nodes in each actual cabinet is 1.

[0126] If the first preset condition is met, it is determined that the allocation condition is met.

[0127] If the first preset condition is not met, it is determined whether the cluster meets the allocation conditions based on the number of virtual cabinets, primary shard parameters, the total number of nodes, the number of actual cabinets, and the number of nodes in each actual cabinet.

[0128] Exemplarily, the data determination module 203 may also be used to:

[0129] Determine whether the total number of nodes is divisible by the number of virtual cabinets.

[0130] If it is divisible, the number of nodes in each virtual cabinet is calculated based on the total number of nodes and the number of virtual cabinets. Based on the number of nodes in each virtual cabinet, the primary shard parameters, the number of virtual cabinets, the actual number of cabinets, and the number of nodes in each actual cabinet, it is determined whether the cluster meets the allocation conditions.

[0131] If it cannot be divided evenly, it is determined that the allocation condition is not met, an error is reported, and the data sharding deployment method is exited.

[0132] Exemplarily, the data determination module 203 may also be used to:

[0133] Determine whether the number of nodes in each virtual cabinet is greater than the primary shard parameter.

[0134] If it is greater than the primary shard parameter, the cluster is judged to meet the allocation conditions based on the number of virtual cabinets, the number of actual cabinets, the number of nodes in each actual cabinet, and the number of nodes in each virtual cabinet.

[0135] If it is less than or equal to the primary shard parameter, it is determined that the allocation condition is not met, an error is reported, and the data shard deployment method is exited.

[0136] Exemplarily, the data determination module 203 may also be used to:

[0137] Determine whether the number of virtual cabinets, the actual number of cabinets, the number of nodes in each actual cabinet, and the number of nodes in each virtual cabinet meet the second preset condition; wherein the second preset condition is that the number of virtual cabinets is equal to the actual number of cabinets, and the number of nodes in each actual cabinet is equal to the number of nodes in each virtual cabinet.

[0138] If the second preset condition is met, it is determined that the allocation condition is met.

[0139] If the second preset condition is not met, determine whether the number of nodes in each actual cabinet is less than or equal to the number of nodes in each virtual cabinet. If the number of nodes in each actual cabinet is less than or equal to the number of nodes in each virtual cabinet, determine that the allocation conditions are met.

[0140] If the number of nodes in each actual cabinet is greater than the number of nodes in each virtual cabinet, it is determined that the allocation condition is not met, an error is reported, and the data sharding deployment method is exited.

[0141] Exemplarily, the data determination module 203 may also be used to:

[0142] The primary shards are allocated in the order of the correspondence list, the backup shard parameter is used as the polling number, and the order of the correspondence list is used as the polling order, and the backup shards are polled and allocated to obtain a data shard deployment plan; wherein the primary shards and the corresponding backup shards in the data shard deployment plan are allocated in different actual cabinets, and the number of backup shards allocated to each node in the data shard deployment plan does not exceed the product of the primary shard parameter and the backup shard parameter.

[0143] Exemplarily, the data parsing module 202 may be used to:

[0144] Sum up the number of nodes to get the total number of nodes.

[0145] Through the corresponding relationship list between the actual cabinets constituting the cluster and each node, the actually existing cabinets and the nodes in each actual cabinet can be directly obtained.

[0146] The actual number of cabinets is summed up to obtain the actual number of cabinets.

[0147] The number of nodes in each actual cabinet is summarized to obtain the number of nodes in each actual cabinet.

[0148] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.

[0149] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0150] The present application also provides an electronic device, see Figure 3The electronic device 300 may include: at least one processor 310 and a memory 320, wherein the memory 320 is used to store a computer program 321, and the processor 310 is used to call and run the computer program 321 stored in the memory 320 to implement the steps in any of the above-mentioned method embodiments, for example Figure 1 Steps 101 to 104 in the illustrated embodiment. Alternatively, when the processor 310 executes the computer program, the functions of each module / unit in the above-mentioned device embodiments are implemented, for example Figure 2 The functions of each module are shown.

[0151] Exemplarily, the computer program 321 may be divided into one or more modules / units, one or more modules / units are stored in the memory 320, and are executed by the processor 310 to complete the present application. The one or more modules / units may be a series of computer program segments that can complete specific functions, and the program segments are used to describe the execution process of the computer program in the electronic device 300.

[0152] Those skilled in the art will understand that Figure 3 These are merely examples of electronic devices and do not constitute a limitation of the electronic device. The electronic device may include more or fewer components than those shown in the figure, or a combination of certain components, or different components, such as input and output devices, network access devices, buses, etc.

[0153] The processor 310 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0154] The memory 320 may be an internal storage unit of the electronic device, or an external storage device of the electronic device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. The memory 320 is used to store the computer program and other programs and data required by the electronic device. The memory 320 may also be used to temporarily store data that has been output or is to be output.

[0155] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of this application is not limited to only one bus or one type of bus.

[0156] The data sharding deployment method provided in the embodiments of the present application can be applied to electronic devices such as computers, wearable devices, vehicle-mounted devices, tablet computers, laptop computers, netbooks, etc. The embodiments of the present application do not impose any restrictions on the specific types of electronic devices.

[0157] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in each embodiment of the above-mentioned data sharding deployment method can be implemented.

[0158] An embodiment of the present application provides a computer program product. When the computer program product runs on a mobile electronic device, the mobile electronic device can implement the steps in each embodiment of the above-mentioned data sharding deployment method when executing the computer program product.

[0159] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium can at least include: any entity or device that can carry the computer program code to the camera / electronic device, recording medium, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, RandomAccess Memory), electrical carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a disk or an optical disk.

[0160] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0161] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0162] In the embodiments provided in the present application, it should be understood that the disclosed devices / network equipment and methods can be implemented in other ways. For example, the device / network equipment embodiments described above are merely schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0163] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0164] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A data sharding deployment method, characterized in that: include: Obtain the network protocol address of each node in the cluster, the corresponding relationship list between the actual cabinets constituting the cluster and each node, the primary shard parameters, and the backup shard parameters; wherein the primary shard parameters are the target number of primary shards allocated to each node, and the backup shard parameters are the target number of backup shards allocated to each node; Based on the network protocol address of each node and the corresponding relationship list between the actual cabinets constituting the cluster and each node, the actual number of cabinets, the number of nodes in each actual cabinet and the total number of nodes are obtained; Based on the actual number of cabinets, the number of nodes in each actual cabinet, the total number of nodes, the primary shard parameters, and the backup shard parameters, determining whether the cluster meets the allocation conditions; If the allocation conditions are met, a data sharding deployment plan is obtained according to the corresponding relationship list, the primary sharding parameters and the backup sharding parameters; The network protocol address based on each node and the corresponding relationship list between the actual cabinets constituting the cluster and each node are used to obtain the actual number of cabinets, the number of nodes in each actual cabinet, and the total number of nodes, including: Summarize the number of nodes to obtain the total number of nodes; The actual cabinets and nodes in each actual cabinet are directly obtained through the corresponding relationship list between the actual cabinets constituting the cluster and each node; Summarize the number of cabinets that actually exist to obtain the actual number of cabinets; Summarize the number of nodes in each actual cabinet to obtain the number of nodes in each actual cabinet; The determining whether the cluster meets the allocation condition based on the actual number of cabinets, the number of nodes in each actual cabinet, the total number of nodes, the primary shard parameter, and the backup shard parameter includes: Calculate the sum of the backup shard parameter and a preset value to obtain the number of virtual cabinets; wherein the preset value is a positive integer; If the number of virtual cabinets is less than or equal to the number of actual cabinets, then based on the number of virtual cabinets, the number of actual cabinets, the number of nodes in each actual cabinet, the total number of nodes, the primary shard parameters, and the backup shard parameters, determine whether the cluster meets the allocation conditions; If the number of virtual cabinets is greater than the number of actual cabinets, it is determined that the allocation condition is not met, an error is reported, and the data sharding deployment method is exited.

2. The data sharding deployment method according to claim 1, characterized in that: The determining whether the cluster meets the allocation condition based on the number of virtual cabinets, the number of actual cabinets, the number of nodes in each actual cabinet, the total number of nodes, the primary shard parameters, and the backup shard parameters includes: Determine whether the primary shard parameter, the backup shard parameter, and the number of nodes in each actual cabinet meet a first preset condition; the first preset condition is that the primary shard parameter is 1, the backup shard parameter is 1, and the number of nodes in each actual cabinet is 1; If the first preset condition is met, it is determined that the allocation condition is met; If the first preset condition is not met, it is determined whether the cluster meets the allocation condition based on the number of virtual cabinets, the primary shard parameters, the total number of nodes, the actual number of cabinets and the number of nodes in each actual cabinet.

3. The data sharding deployment method according to claim 2, characterized in that: The determining whether the cluster meets the allocation condition based on the number of virtual cabinets, the primary shard parameters, the total number of nodes, the actual number of cabinets, and the number of nodes in each actual cabinet includes: Determine whether the total number of nodes is divisible by the number of virtual cabinets; If it is divisible, the number of nodes in each virtual cabinet is calculated based on the total number of nodes and the number of virtual cabinets, and whether the cluster meets the allocation conditions is determined based on the number of nodes in each virtual cabinet, the primary shard parameter, the number of virtual cabinets, the actual number of cabinets, and the number of nodes in each actual cabinet; If it cannot be divided evenly, it is determined that the allocation condition is not met, an error is reported, and the data sharding deployment method is exited.

4. The data sharding deployment method according to claim 3, characterized in that: The determining whether the cluster meets the allocation condition based on the number of nodes in each virtual cabinet, the primary shard parameter, the number of virtual cabinets, the actual number of cabinets, and the number of nodes in each actual cabinet includes: Determine whether the number of nodes in each virtual cabinet is greater than the primary shard parameter; If it is greater than the primary shard parameter, judging whether the cluster meets the allocation conditions based on the number of virtual cabinets, the actual number of cabinets, the number of nodes in each actual cabinet, and the number of nodes in each virtual cabinet; If it is less than or equal to the primary shard parameter, it is determined that the allocation condition is not met, an error is reported, and the data shard deployment method is exited.

5. The data sharding deployment method according to claim 4, characterized in that: The determining whether the cluster meets the allocation condition based on the number of virtual cabinets, the actual number of cabinets, the number of nodes in each actual cabinet, and the number of nodes in each virtual cabinet includes: Determine whether the number of virtual cabinets, the actual number of cabinets, the number of nodes in each actual cabinet, and the number of nodes in each virtual cabinet meet a second preset condition; wherein the second preset condition is that the number of virtual cabinets is equal to the actual number of cabinets, and the number of nodes in each actual cabinet is equal to the number of nodes in each virtual cabinet; If the second preset condition is met, it is determined that the allocation condition is met; If the second preset condition is not met, determining whether the number of nodes in each actual cabinet is less than or equal to the number of nodes in each virtual cabinet; if the number of nodes in each actual cabinet is less than or equal to the number of nodes in each virtual cabinet, determining that the allocation condition is met; If the number of nodes in each actual cabinet is greater than the number of nodes in each virtual cabinet, it is determined that the allocation condition is not met, an error is reported, and the data sharding deployment method is exited.

6. The data sharding deployment method according to claim 1, characterized in that: The step of obtaining a data sharding deployment scheme according to the corresponding relationship list, the primary sharding parameters, and the backup sharding parameters includes: The primary shards are allocated in the order of the correspondence list, the backup shard parameter is used as the polling number, and the order of the correspondence list is used as the polling order, and the backup shards are polled and allocated to obtain the data shard deployment plan; wherein the primary shards and the corresponding backup shards in the data shard deployment plan are allocated in different actual cabinets, and the number of backup shards allocated to each node in the data shard deployment plan does not exceed the product of the primary shard parameter and the backup shard parameter.

7. A data sharding deployment device, characterized in that: include: A data acquisition module is used to obtain the network protocol address of each node in the cluster, a list of correspondences between the actual cabinets constituting the cluster and each node, primary shard parameters, and backup shard parameters; wherein the primary shard parameters are the target number of primary shards allocated to each node, and the backup shard parameters are the target number of backup shards allocated to each node; A data parsing module, used to obtain the actual number of cabinets, the number of nodes in each actual cabinet and the total number of nodes based on the network protocol address of each node and the corresponding relationship list between the actual cabinets constituting the cluster and each node; A data judgment module, used to judge whether the cluster meets the allocation conditions based on the actual number of cabinets, the number of nodes in each actual cabinet, the total number of nodes, the primary shard parameters and the backup shard parameters; A result output module, used for obtaining a data sharding deployment plan according to the corresponding relationship list and the backup sharding parameters if the allocation conditions are met; The data parsing module is also used for: Summarize the number of nodes to obtain the total number of nodes; The actual cabinets and nodes in each actual cabinet are directly obtained through the corresponding relationship list between the actual cabinets constituting the cluster and each node; Summarize the number of cabinets that actually exist to obtain the actual number of cabinets; Summarize the number of nodes in each actual cabinet to obtain the number of nodes in each actual cabinet; The data judgment module is also used for: Calculate the sum of the backup shard parameter and a preset value to obtain the number of virtual cabinets; wherein the preset value is a positive integer; If the number of virtual cabinets is less than or equal to the number of actual cabinets, then based on the number of virtual cabinets, the number of actual cabinets, the number of nodes in each actual cabinet, the total number of nodes, the primary shard parameters, and the backup shard parameters, determine whether the cluster meets the allocation conditions; If the number of virtual cabinets is greater than the number of actual cabinets, it is determined that the allocation condition is not met, an error is reported, and the data sharding deployment method is exited.

8. An electronic device comprising: A processor and a memory, wherein the memory stores a computer program that can be run on the processor, and wherein the processor implements the data sharding deployment method as described in any one of claims 1 to 6 when executing the computer program.

9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the data sharding deployment method as described in any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Method, apparatus, device, and storage medium for scheduling jobs in cluster

    CN109117265A

  • Data processing method and device, electronic equipment and storage medium

    CN116991562A