Search engine database management method and apparatus, and search engine database
By comprehensively considering the data storage amount and storage usage of computer equipment nodes, the target node is determined to allocate new shards, which solves the data imbalance problem and improves resource utilization and search efficiency.
Patent Information
- Application Number
- PCT/CN2023/132695
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-04-24
- Filing Date
- 2023-11-20
- Publication Date
- 2024-10-31
AI Technical Summary
When the existing technology allocates newly created shards, it causes an imbalance in data storage of computer device nodes, reducing resource utilization and search efficiency.
By obtaining the current data storage amount and storage usage of each computer equipment node, the target node is determined to ensure that the data storage between nodes tends to be balanced after the new shards are allocated, and the balance evaluation index and iterative allocation strategy are used to avoid the accumulation of new shards on a single node.
It improves resource utilization and search efficiency of ES database, ensures balanced allocation of data storage, and avoids hot spot risks in extreme situations.
Smart Images

Figure CN2023132695_31102024_PF_FP_ABST
Abstract
Description
Search engine database management method, device and search engine database
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application claims priority to the Chinese patent application filed with the China Patent Office on April 24, 2023, with application number 202310445218.7 and application name “A Search Engine Database Management Method, Device and Search Engine Database”, the entire contents of which are incorporated herein by reference. Technical Field
[0003] The present application relates to the field of database technology, and in particular to a search engine database management method, device, and search engine database. Background Art
[0004] The Elasticsearch (ES) database is a widely used and powerful distributed full-text search engine. Its index data can be distributed across multiple computing nodes. These distributed data blocks are called shards. The distribution mechanism of shards across multiple computing devices determines the balance of ES database storage. Therefore, when creating a new shard, how to assign it to the corresponding computing node has become a key research topic.
[0005] In the prior art, the computer device node list is usually sorted in ascending order according to the number of existing shards, the computer device node with the least number of shards is found, and then the newly created shard is allocated to the computer device node with the least number of shards.
[0006] However, in an actual production environment, with the alternating opening and closing of ES indexes, the online and offline operation of computer device nodes, and the deletion of some data, allocating newly created shards based on existing technologies will lead to serious imbalance in data storage among various computer device nodes, which not only reduces resource utilization but also is not conducive to ensuring the search efficiency of the ES database.
[0007] Summary of the Invention
[0008] The present application provides a search engine database management method, device and search engine database to solve the problem of serious data storage imbalance among various computer device nodes caused by the existing technology.
[0009] The present application provides a search engine database management method in one or more aspects, including:
[0010] Obtaining the current data storage capacity of each computer device node corresponding to the search engine database, the current storage usage rate of each computer device node, and the number of new shards;
[0011] Determining a target computer device node based on a current data storage capacity of each computer device node, a current storage usage rate of each computer device node, and the number of new shards; and
[0012] Allocate new shards of the search engine database to target computer device nodes.
[0013] In one or more embodiments, determining the target computer device node based on the current data storage capacity of each computer device node, the current storage usage rate of each computer device node, and the number of new shards includes:
[0014] Determine a current balance evaluation index between each computer device node based on the current storage usage rate of each computer device node;
[0015] Determining node selection constraints based on current balance evaluation indicators among the computer device nodes; and
[0016] According to the node selection constraint conditions, the target computer device node is determined based on the current data storage capacity of each computer device node, the current storage utilization rate of each computer device node and the number of new shards.
[0017] In one or more embodiments, determining a current balance evaluation index between the computer device nodes based on the current storage usage of each computer device node includes:
[0018] Determining a standard deviation of current storage usage among the computer device nodes based on the current storage usage of the computer device nodes; and
[0019] The current storage usage standard deviation is used as the current balance evaluation indicator between each computer device node.
[0020] In one or more embodiments, determining the target computer device node according to the node selection constraint, based on the current data storage capacity of each computer device node, the current storage usage rate of each computer device node, and the number of new shards, includes:
[0021] Determine the computer device nodes to be selected based on the current data storage capacity of each computer device node, the current storage utilization rate of each computer device node, and the number of new shards;
[0022] Predicting the latest balance evaluation index between the computer device nodes after allocating the new shard of the search engine database to the selected computer device nodes; and
[0023] In response to determining that the latest balance evaluation index is less than the current balance evaluation index, the to-be-selected computer device node is determined as the target computing device node.
[0024] In one or more embodiments, determining the computer device node to be selected based on the current data storage capacity of each computer device node, the current storage usage rate of each computer device node, and the number of new shards includes:
[0025] Predicting the data storage capacity of the new shard based on the current data storage capacity of each computer device node; and
[0026] The computer device nodes to be selected are determined based on the current storage usage rate of each computer device node, the number of new shards, and the data storage capacity of the new shards.
[0027] In one or more embodiments, predicting the data storage capacity of the new shard based on the current data storage capacity of each computer device node includes:
[0028] The data storage capacity of the new shard is predicted based on the current data storage capacity of each computer device node and the current number of shards of each computer device node.
[0029] In one or more embodiments, predicting the data storage capacity of the new shard based on the current data storage capacity of each computer device node and the current number of shards of each computer device node includes:
[0030] Determining an average data storage capacity of a single shard of the search engine database based on the current data storage capacity of each computer device node and the current number of shards of each computer device node; and
[0031] The average data storage capacity of a single shard is used as the data storage capacity of the new shard.
[0032] In one or more embodiments, predicting the data storage capacity of the new shard based on the current data storage capacity of each computer device node and the current number of shards of each computer device node includes:
[0033] Determining a geometric average data storage capacity of a single shard of the search engine database based on the current data storage capacity of each computer device node and the current number of shards of each computer device node; and
[0034] The geometric mean data storage capacity of a single shard is used as the data storage capacity of the new shard.
[0035] In one or more embodiments, determining the candidate computer device nodes based on the current storage usage of each computer device node, the number of new shards, and the data storage capacity of the new shards includes:
[0036] Construct a storage utilization summary table based on the current storage utilization of each computer device node;
[0037] Determine whether the number of new shards is greater than the total number of computer device nodes;
[0038] In response to determining that the number of new shards is greater than the total number of computer device nodes, screening candidate computer device nodes corresponding to the first number of new shards according to the storage usage summary table;
[0039] updating the storage usage rate of each candidate computer device node according to the current data storage capacity of each candidate computer device node and the data storage capacity of the new shard, while keeping the storage usage rates of other computer device nodes other than the candidate computer device node unchanged, so as to iteratively update the storage usage rate summary table, and using the updated storage usage rate summary table as the new storage usage rate summary table; and
[0040] The number of new shards is updated to reduce the first number to iteratively update the number of new shards, and the process returns to the step of determining whether the number of new shards is greater than the total number of computer device nodes.
[0041] In one or more embodiments, in response to determining that the number of new shards is greater than the total number of computer device nodes, screening the candidate computer device nodes corresponding to the first number of new shards according to the storage usage summary table includes:
[0042] In response to determining that the number of the new shards is greater than the total number of the computer device nodes, sorting the computing device nodes in ascending order according to the current storage usage of each of the computer device nodes represented by the storage usage summary table; and
[0043] According to the ascending sorting results of the computing device nodes, a first number of computer device nodes to be selected are screened from small to large.
[0044] In one or more embodiments, the method further comprises:
[0045] The first quantity is determined according to the total number of computer device nodes and a preset first allocation ratio.
[0046] In one or more embodiments, the method further comprises:
[0047] In response to determining that the number of new shards is not greater than the total number of computer device nodes, determining whether the number of new shards is equal to 1; and
[0048] In response to determining that the number of the new shards is equal to 1, the computer device node with the lowest current storage usage rate represented by the storage usage rate summary table is determined as the computer device node to be selected corresponding to the new shard.
[0049] In one or more embodiments, the method further comprises:
[0050] In response to determining that the number of new shards is not greater than the total number of computer device nodes, and the number of new shards is greater than 1, selecting computer device nodes to be selected corresponding to the second number of new shards according to the storage usage summary table;
[0051] updating the storage usage rate of each candidate computer device node according to the current data storage capacity of each candidate computer device node and the data storage capacity of the new shard, while keeping the storage usage rates of other computer device nodes other than the candidate computer device node unchanged, so as to iteratively update the storage usage rate summary table, and using the updated storage usage rate summary table as the new storage usage rate summary table; and
[0052] The number of new shards is updated to decrease by a second number, so as to iteratively update the number of new shards, and the process returns to the step of determining whether the number of new shards is equal to 1.
[0053] In one or more embodiments, in response to determining that the number of new shards is not greater than the total number of computer device nodes and the number of new shards is greater than 1, screening the candidate computer device nodes corresponding to the second number of new shards according to the storage usage summary table includes:
[0054] In response to determining that the number of new shards is not greater than the total number of computer device nodes, and the number of new shards is greater than 1, sorting the computing device nodes in ascending order according to the current storage usage of each computer device node represented by the storage usage summary table; and
[0055] According to the ascending sorting results of the computing device nodes, a second number of computer device nodes to be selected are screened from small to large.
[0056] In one or more embodiments, further comprising:
[0057] The second quantity is determined based on the total number of computer device nodes and a preset second allocation ratio.
[0058] In one or more embodiments, obtaining the current storage usage of each computer device node corresponding to the search engine database includes:
[0059] Obtaining data storage space of each computer device node; and
[0060] For any computer device node, the current storage usage rate of the computer device node is determined according to the current data storage amount and data storage space of the computer device node.
[0061] One or more aspects of the present application provide a search engine database management device, including:
[0062] An acquisition module, configured to acquire the current data storage capacity of each computer device node corresponding to the search engine database, the current storage usage rate of each computer device node, and the number of new shards;
[0063] a determination module, configured to determine a target computer device node based on a current data storage capacity of each computer device node, a current storage usage rate of each computer device node, and a number of new shards; and
[0064] The management module is used to allocate new shards of the search engine database to target computer device nodes.
[0065] In one or more embodiments, the determination module is configured to:
[0066] Determine a current balance evaluation index between each computer device node based on the current storage usage rate of each computer device node;
[0067] Determining node selection constraints based on current balance evaluation indicators among the computer device nodes; and
[0068] According to the node selection constraint conditions, the target computer device node is determined based on the current data storage capacity of each computer device node, the current storage utilization rate of each computer device node and the number of new shards.
[0069] In one or more embodiments, the determination module is configured to:
[0070] Determining a standard deviation of current storage usage among the computer device nodes based on the current storage usage of the computer device nodes; and
[0071] The current storage usage standard deviation is used as the current balance evaluation indicator between each computer device node.
[0072] In one or more embodiments, the determination module is configured to:
[0073] Determine the computer device nodes to be selected based on the current data storage capacity of each computer device node, the current storage utilization rate of each computer device node, and the number of new shards;
[0074] Predicting the latest balance evaluation index between the computer device nodes after allocating the new shard of the search engine database to the selected computer device nodes; and
[0075] In response to determining that the latest balance evaluation index is less than the current balance evaluation index, the to-be-selected computer device node is determined as the target computing device node.
[0076] In one or more embodiments, the determination module is configured to:
[0077] Predicting the data storage capacity of the new shard based on the current data storage capacity of each computer device node; and
[0078] The computer device nodes to be selected are determined based on the current storage usage rate of each computer device node, the number of new shards, and the data storage capacity of the new shards.
[0079] In one or more embodiments, the determination module is configured to:
[0080] The data storage capacity of the new shard is predicted based on the current data storage capacity of each computer device node and the current number of shards of each computer device node.
[0081] In one or more embodiments, the determination module is configured to:
[0082] Determining an average data storage capacity of a single shard of the search engine database based on the current data storage capacity of each computer device node and the current number of shards of each computer device node; and
[0083] The average data storage capacity of a single shard is used as the data storage capacity of the new shard.
[0084] In one or more embodiments, the determination module is configured to:
[0085] Determining a geometric average data storage capacity of a single shard of the search engine database based on the current data storage capacity of each computer device node and the current number of shards of each computer device node; and
[0086] The geometric mean data storage capacity of a single shard is used as the data storage capacity of the new shard.
[0087] In one or more embodiments, the determination module is configured to:
[0088] Construct a storage utilization summary table based on the current storage utilization of each computer device node;
[0089] Determine whether the number of new shards is greater than the total number of computer device nodes;
[0090] In response to determining that the number of new shards is greater than the total number of computer device nodes, screening candidate computer device nodes corresponding to the first number of new shards according to the storage usage summary table;
[0091] updating the storage usage rate of each candidate computer device node according to the current data storage capacity of each candidate computer device node and the data storage capacity of the new shard, while keeping the storage usage rates of other computer device nodes other than the candidate computer device node unchanged, so as to iteratively update the storage usage rate summary table, and using the updated storage usage rate summary table as the new storage usage rate summary table; and
[0092] The number of new shards is updated to reduce the first number to iteratively update the number of new shards, and the process returns to the step of determining whether the number of new shards is greater than the total number of computer device nodes.
[0093] In one or more embodiments, the determination module is configured to:
[0094] In response to determining that the number of new shards is greater than the total number of computer device nodes, sorting the computing device nodes in ascending order according to the current storage usage of each computer device node represented by the storage usage summary table; and
[0095] According to the ascending sorting results of the computing device nodes, a first number of candidate computer device nodes are screened from small to large.
[0096] In one or more embodiments, the determining module is further configured to:
[0097] A first quantity is determined based on the total number of computer device nodes and a preset first allocation ratio.
[0098] In one or more embodiments, the determining module is further configured to:
[0099] In response to determining that the number of new shards is not greater than the total number of computer device nodes, determining whether the number of new shards is equal to 1; and
[0100] In response to determining that the number of new shards is equal to 1, the computer device node with the lowest current storage usage rate represented by the storage usage rate summary table is determined as the computer device node to be selected corresponding to the new shard.
[0101] In one or more embodiments, the determining module is further configured to:
[0102] In response to determining that the number of new shards is not greater than the total number of computer device nodes, and the number of new shards is greater than 1, selecting computer device nodes to be selected corresponding to the second number of new shards according to the storage usage summary table;
[0103] updating the storage usage rate of each candidate computer device node according to the current data storage capacity of each candidate computer device node and the data storage capacity of the new shard, while keeping the storage usage rates of other computer device nodes other than the candidate computer device node unchanged, so as to iteratively update the storage usage rate summary table, and using the updated storage usage rate summary table as the new storage usage rate summary table; and
[0104] The number of new shards is updated to decrease by a second number, so as to iteratively update the number of new shards, and the process returns to the step of determining whether the number of new shards is equal to 1.
[0105] In one or more embodiments, the determination module is configured to:
[0106] In response to determining that the number of new shards is not greater than the total number of computer device nodes, and the number of new shards is greater than 1, sorting the computing device nodes in ascending order according to the current storage usage of each computer device node represented by the storage usage summary table; and
[0107] According to the ascending sorting results of the computing device nodes, a second number of computer device nodes to be selected are screened from small to large.
[0108] In one or more embodiments, the determining module is further configured to:
[0109] The second quantity is determined based on the total number of computer device nodes and a preset second allocation ratio.
[0110] In one or more embodiments, the acquisition module is configured to:
[0111] Obtaining data storage space of each computer device node; and
[0112] For any computer device node, the current storage usage rate of the computer device node is determined according to the current data storage amount and data storage space of the computer device node.
[0113] The present application provides one or more search engine databases, including: a number of computer device nodes;
[0114] Any computer device node executes the above methods with various possible designs.
[0115] One or more aspects of the present application provide an electronic device, including: at least one processor and a memory;
[0116] The memory stores computer-readable instructions; and
[0117] At least one processor executes the computer-readable instructions stored in the memory, so that the at least one processor executes the methods with various possible designs as described above.
[0118] One or more aspects of the present application provide a computer-readable storage medium, in which computer-readable instructions are stored. When a processor executes the computer-readable instructions, various possible design methods as described above are implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0119] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following is a brief introduction to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0120] FIG1 is a schematic diagram of the structure of a search engine database management system based on an embodiment of the present application;
[0121] FIG2 is a flow chart of a search engine database management method according to an embodiment of the present application;
[0122] FIG3 is a flow chart of an exemplary search engine database management method provided in an embodiment of the present application;
[0123] FIG4 is a flow chart of another exemplary search engine database management method provided in an embodiment of the present application;
[0124] FIG5 is a schematic diagram of the structure of a search engine database management device provided in an embodiment of the present application;
[0125] FIG6 is a schematic diagram of the structure of a search engine database provided in an embodiment of the present application;
[0126] FIG7 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0127] The above drawings illustrate specific embodiments of the present application, which will be described in more detail below. These drawings and the textual description are not intended to limit the scope of the present disclosure in any way, but rather to illustrate the concepts of the present application to those skilled in the art by reference to specific embodiments. DETAILED DESCRIPTION
[0128] To make the purpose, technical solutions, and advantages of the embodiments of this application more clear, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0129] First, let’s explain the terms involved in this application:
[0130] Shard: Shards are the key to distributing data in the ES database cluster. They are the smallest working unit and store a portion of the index data. Shards can be primary shards or replica shards.
[0131] In addition, the terms "first," "second," etc. are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. In the description of the following embodiments, "plurality" means more than two, unless otherwise specifically defined.
[0132] In the existing technology, the list of computer device nodes is usually sorted in ascending order by the number of existing shards, and the computer device node with the fewest shards is found. Then, the newly created shard is assigned to the computer device node with the fewest shards. However, in actual production environments, with the alternating opening and closing of ES indexes, the online and offline operation of computer device nodes, and the deletion of data, if the newly created shards are assigned based on the existing technology, it will lead to a serious imbalance in data storage among the computer device nodes. This will not only reduce resource utilization, but also lead to consequences such as reduced online service quality or business interruption, and it is not conducive to ensuring the search efficiency of the ES database.
[0133] In response to the above problems, the embodiments of the present application provide a search engine database management method, device, and search engine database, the method comprising: obtaining the current data storage capacity of each computer device node corresponding to the search engine database, the current storage usage rate of each computer device node, and the number of new shards; determining the target computer device node based on the current data storage capacity of each computer device node, the current storage usage rate of each computer device node, and the number of new shards; and allocating the new shards of the search engine database to the target computer device node. The method provided by the above scheme selects the target computer device node corresponding to the new shard by comprehensively considering the current data storage capacity, current storage usage rate, and number of new shards of each computer device node, ensuring that after the new shard is allocated to the corresponding target computer device node, the data storage of each computer device node can be balanced, thereby improving resource utilization and laying the foundation for improving the search efficiency of the ES database.
[0134] The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. The following describes the embodiments of the present application in conjunction with the accompanying drawings.
[0135] First, the structure of the search engine database management system on which this application is based is described:
[0136] The search engine database management method, device, and search engine database provided in the embodiment of the present application are suitable for allocating new shards to target computer device nodes when adding new shards to the search engine database, so as to achieve balanced distribution of the shards of the search engine database. As shown in Figure 1, it is a structural diagram of the search engine database management system based on the embodiment of the present application, which mainly includes a data collection device and a search engine database. The search engine database includes a number of computer device nodes, each of which is equipped with a search engine database management device. The data collection device is used to collect the current data storage capacity of each computer device node corresponding to the search engine database, the current storage usage rate of each computer device node, and the number of new shards, and send the collected information to the search engine database management device in any computer device node, so as to determine the target computer device node of the new shard based on the information obtained by the search engine database management device.
[0137] The present invention provides a search engine database management method for allocating new shards to target computer nodes when adding new shards to the search engine database, thereby achieving a balanced distribution of shards in the search engine database. The embodiments of the present invention are performed by electronic devices, such as servers, desktop computers, laptops, tablet computers, and other electronic devices that can be used to manage search engine databases.
[0138] FIG2 is a flow chart of a search engine database management method according to an embodiment of the present application, which includes:
[0139] Step 201: Obtain the current data storage capacity, current storage usage rate, and number of new shards of each computer device node corresponding to the search engine database.
[0140] The current data storage capacity represents the total amount of data currently stored in the computer device node, and the current storage usage rate represents the storage space occupancy rate of the computer device node.
[0141] In one or more embodiments, the data storage space of each computer device node may be obtained; for any computer device node, the current storage usage rate of the computer device node may be determined based on the current data storage capacity and data storage space of the computer device node.
[0142] In one or more embodiments, the ratio between the current data storage amount and the data storage space may be used as the current storage usage rate of the computer device node.
[0143] Step 202 : Determine the target computer device node based on the current data storage capacity of each computer device node, the current storage usage rate of each computer device node, and the number of new shards.
[0144] In one or more embodiments, the storage space usage of each computer device node can be analyzed based on the current storage usage rate of each computer device node, and then the target computer device node corresponding to each new shard can be determined in combination with the current data storage capacity of each computer device node and the number of new shards to be allocated, so that after the new shards are allocated to the corresponding target computer device nodes, the various computer device nodes involved in the search engine database can maintain data storage balance.
[0145] Step 203: Allocate the new shard of the search engine database to the target computer device node.
[0146] In one or more embodiments, after determining the target computer device node corresponding to each new shard, each new shard is sequentially allocated to the corresponding target computer device node. The specific allocation method is not limited in the embodiments of this application.
[0147] Based on the above embodiments, in order to further ensure the reliability of the selected target computer device node, as an implementable approach, in one or more embodiments, the target computer device node is determined based on the current data storage capacity of each computer device node, the current storage usage rate of each computer device node, and the number of new shards, including:
[0148] Step 2021, determining a current balance evaluation index between each computer device node based on the current storage usage rate of each computer device node;
[0149] Step 2022: determining node selection constraints based on current balance evaluation indicators among the computer device nodes;
[0150] Step 2023: Determine the target computer device node according to the node selection constraint, the current data storage capacity of each computer device node, the current storage usage rate of each computer device node, and the number of new shards.
[0151] It should be noted that the balance evaluation index represents the degree of difference in data storage between various computer device nodes.
[0152] In one or more embodiments, the node selection constraint may be determined with the goal of reducing the degree of disparity in data storage between computer device nodes.
[0153] In one or more embodiments, in order to further ensure the objectivity of the balance evaluation index, the current storage utilization standard deviation between each computer device node can be determined based on the current storage utilization of each computer device node; the current storage utilization standard deviation is used as the current balance evaluation index between each computer device node.
[0154] Among them, the specific calculation method of the current storage usage standard deviation can refer to the standard deviation calculation formula, which is not limited in the embodiment of this application.
[0155] In one or more embodiments, the computer device node to be selected can be determined based on the current data storage capacity of each computer device node, the current storage usage rate of each computer device node, and the number of new shards; the latest balance evaluation index between each computer device node after the new shards of the search engine database are allocated to the computer device node to be selected is predicted; it is determined whether the latest balance evaluation index is less than the current balance evaluation index, and based on the determination that the latest balance evaluation index is less than the current balance evaluation index, the computer device node to be selected is determined as the target computing device node.
[0156] In one or more embodiments, when the data storage capacity of the new shard is known, for any target computer device node, the storage usage rate of the target computer device node after being allocated to the new shard can be predicted based on the data storage capacity of the new shard and the current data storage capacity of the target computer device node, and then the balance evaluation index between each computer device node is recalculated, that is, the latest balance evaluation index between each computer device node after the new shard of the search engine database is allocated to the selected computer device node is predicted. Since the embodiment of the present application uses the current storage usage standard deviation as the current balance evaluation index between each computer device node, when the latest balance evaluation index is less than the current balance evaluation index, it indicates that the degree of difference in data storage between each computer device node has been reduced, and therefore the selected computer device node is determined as the target computing device node.
[0157] In one or more embodiments, when the data storage capacity of the new shard is unknown, the data storage capacity of the new shard can be predicted based on the current data storage capacity of each computer device node; the computer device nodes to be selected are determined based on the current storage usage rate of each computer device node, the number of new shards and the data storage capacity of the new shard.
[0158] In one or more embodiments, the data storage capacity of the new shard may be predicted based on the current data storage capacity of each computer device node and the current number of shards of each computer device node.
[0159] In one or more embodiments, when the data storage capacity of each shard in each computer device node can be directly obtained, the data storage capacity of each shard included in the search engine database and the total number of shards can be obtained, and then the total data storage capacity of the search engine database can be determined based on the data storage capacity of each shard, and then the data storage capacity of the new shard can be predicted based on the total data storage capacity of the search engine database and the total number of shards.
[0160] In one or more embodiments, the data storage capacity of the new shard can be predicted based on the current data storage capacity of each computer device node and the current number of shards of each computer device node, and then the computer device node to be selected can be determined in combination with the current storage usage rate of each computer device node, the number of new shards and the data storage capacity of the new shards.
[0161] In one or more embodiments, the average data storage capacity of a single shard of the search engine database can be determined based on the current data storage capacity of each computer device node and the current number of shards of each computer device node; the average data storage capacity of a single shard is used as the data storage capacity of the new shard.
[0162] Similarly, in one or more embodiments, the geometric mean data storage capacity of a single shard of the search engine database can be determined based on the current data storage capacity of each computer device node and the current number of shards of each computer device node; and the geometric mean data storage capacity of a single shard is used as the data storage capacity of the new shard.
[0163] Among them, using the geometric mean data storage capacity as the data storage capacity of the new shard can reduce the impact of extreme values and improve the accuracy of the data storage capacity prediction results of the new shard.
[0164] Based on the above embodiments, in order to avoid the extreme situation where all new shards are accumulated on a single node, which may lead to a decrease in search efficiency and the risk of hot spots, as an practicable approach, in one or more embodiments, the computer device node to be selected is determined based on the current storage usage rate of each computer device node, the number of new shards, and the data storage capacity of the new shards, including:
[0165] Step 301, constructing a storage usage summary table based on the current storage usage of each computer device node;
[0166] Step 302: determine whether the number of new shards is greater than the total number of computer device nodes;
[0167] Step 303: In response to determining that the number of new shards is greater than the total number of computer device nodes, selecting computer device nodes to be selected corresponding to the first number of new shards based on the current storage usage of each computer device node;
[0168] Step 304: updating the storage usage rate of each candidate computer device node based on the current data storage capacity of each candidate computer device node and the data storage capacity of the new shard, while keeping the storage usage rates of other computer device nodes unchanged, thereby iteratively updating the storage usage rate summary table, and using the updated storage usage rate summary table as the new storage usage rate summary table;
[0169] Step 305 , updating the number of new shards to reduce the first number, so as to iteratively update the number of new shards, and returning to the step of determining whether the number of new shards is greater than the total number of computer device nodes.
[0170] In one or more embodiments, a determination is made as to whether the number of new shards is greater than the total number of computer device nodes; based on the determination that the number of new shards is greater than the total number of computer device nodes, each computing device node is sorted in ascending order according to the current storage usage of each computer device node represented by a storage usage summary table; and based on the results of the ascending sorting of each computing device node, a first number of candidate computer device nodes are screened from small to large.
[0171] In one or more embodiments, first, based on the current storage usage of each computer device node, the storage usage statistics of the physical nodes of the search engine database are performed to obtain a storage usage summary table. The storage usage summary table includes at least the unique identifier of each computer device node and its corresponding current storage usage. In response to determining that the number of new shards is greater than the total number of computer device nodes, the new shards can be iteratively allocated in rounds. In each round, the candidate computer device nodes corresponding to the first number of new shards are determined according to the storage usage summary table, and computer device nodes with smaller storage usage are preferentially selected as candidate computer device nodes. After each round of selection of candidate computer device nodes is completed, the storage usage summary table is updated so that the storage usage of each computer device node recorded in the storage usage summary table is its latest storage usage. In order to avoid the extreme situation where all new shards are accumulated on a single node, the embodiment of the present application adopts a decentralized allocation method, that is, the candidate computer device nodes determined in each round correspond to the new shards one by one.
[0172] In one or more embodiments, the first quantity may be determined based on the total number of computer device nodes and a preset first allocation ratio.
[0173] In one or more embodiments, the product of the total number of computer device nodes and a preset first allocation ratio may be calculated as the first quantity.
[0174] Exemplarily, when the total number of computer device nodes is 5 and the preset first allocation ratio is 2 / 3, the first number is determined to be 3.
[0175] In one or more embodiments, a determination is made as to whether the number of new shards is not greater than the total number of computer device nodes, and based on the determination that the number of new shards is not greater than the total number of computer device nodes, a determination is made as to whether the number of new shards is equal to 1; in response to the determination that the number of new shards is equal to 1, the computer device node with the lowest current storage usage represented by the storage usage summary table is determined as the candidate computer device node corresponding to the new shard.
[0176] In one or more embodiments, when the number of new shards is equal to 1 in the first round of allocation, or after several rounds of iterative allocation, the number of new shards is reduced to 1, the computer device node with the lowest current storage utilization rate can be directly determined as the candidate computer device node corresponding to the new shard.
[0177] In one or more embodiments, it is determined whether the number of new shards is not greater than the total number of computer device nodes, and whether the number of new shards is greater than 1. Based on the determination that the number of new shards is not greater than the total number of computer device nodes, and the number of new shards is greater than 1, the computer device nodes to be selected corresponding to the second number of new shards are screened according to the storage usage summary table; the storage usage of each computer device node to be selected is updated according to the current data storage capacity of each computer device node to be selected and the data storage capacity of the new shards, and the storage usage of other computer device nodes except the computer device node to be selected remains unchanged, so as to iteratively update the storage usage summary table, and use the updated storage usage summary table as the new storage usage summary table; the number of new shards is updated to be reduced by the second number, so as to iteratively update the number of new shards, and return to the step of determining whether the number of new shards is equal to 1.
[0178] In one or more embodiments, in response to determining that the number of new shards is not greater than the total number of computer device nodes, and the number of new shards is greater than 1, each computing device node is sorted in ascending order according to the current storage usage of each computer device node represented by the storage usage summary table; and based on the ascending sorting results of each computing device node, a second number of candidate computer device nodes are screened from small to large.
[0179] In one or more embodiments, when the number of new shards is no greater than the total number of computer device nodes in the first round of allocation and the number of new shards is greater than 1, or after several rounds of allocation, the number of new shards is reduced to no greater than the total number of computer device nodes and the number of new shards is greater than 1, then based on the current storage usage of each computer device node represented by the current storage usage summary, candidate computer device nodes corresponding to the second number of new shards are screened, and computer device nodes with lower storage usage are preferentially selected as candidate computer device nodes. The second number is less than the first number.
[0180] In one or more embodiments, the second quantity may be determined based on the total number of computer device nodes and a preset second allocation ratio.
[0181] The product of the total number of computer device nodes and the preset second allocation ratio can be calculated as the second quantity.
[0182] The preset second allocation ratio is smaller than the preset first allocation ratio. When the total number of computer device nodes is 5 and the preset first allocation ratio is 1 / 3, the first number is determined to be 2.
[0183] For example, as shown in Figure 3, a flowchart of an exemplary search engine database management method provided by an embodiment of the present application is provided. In actual application, in response to determining that the number of new shards after the update is negative, it can be directly reset to zero. In response to determining that the number of new shards is equal to 0, the process ends.
[0184] As shown in Figure 4, it is a flow chart of another exemplary search engine database management method provided in an embodiment of the present application. The search engine database management method provided in an embodiment of the present application involves the operation of algorithms such as an expected standard deviation calculation module, a node selector and an iterative allocator, wherein the expected standard deviation is a balance evaluation indicator, the single shard size is the data storage capacity of the new shard, the storage rate is the storage utilization rate of the computer device node, the node selector is used to select the target computer device node based on the method provided in the above embodiment, the iterative allocator is used to determine the target computer device node to be selected corresponding to each new shard based on the method provided in the above embodiment, and the update node range refers to the number of computer device nodes to be selected (the first number or the second number).
[0185] To help those skilled in the art more clearly understand the search engine database management method provided in the embodiments of the present application, the embodiments of the present application provide the following examples:
[0186] Example 1
[0187] Suppose there is an ElasticSearch cluster containing 5 storage nodes (computer device nodes). The storage utilization rates of the 5 storage nodes (numbered D1, D2, D3, D4, D5) are 10%, 15%, 20%, 17% and 3% respectively; the storage sizes (current data storage capacity) are 10GB, 15GB, 20GB, 17GB and 3GB respectively; then the current storage utilization standard deviation (current balance evaluation indicator) is 5.20%.
[0188] If the calculated geometric mean of the shards (the data storage capacity of the new shards) is 1.85 GB and the number of new shards required is 3, then the following allocation is performed: if the number of shards 3 is less than the number of nodes 5, then the 1 / 3 nodes with the lowest storage utilization are selected. 5 multiplied by 1 / 3 is approximately rounded to 2, namely D5 and D1. These two nodes are selected for shard allocation.
[0189] Iterate the allocation calculation. Calculate the expected standard deviation (latest balance evaluation indicator) according to the following table:
[0190] First round of allocation:
[0191] The expected storage usage rate indicates the updated storage usage rate.
[0192] As shown in the table above, the expected standard deviation of storage usage after the first round of allocation of the three shards is 4.31%, which is less than the current 5.20%. The data storage balance has improved, so this round of allocation can be accepted. At this time, there is only one shard left.
[0193] Continuing the second round of allocation, the D5 node is directly selected for allocation. The expected allocation result of the second round is calculated as follows:
[0194] At this point, the three shards have been allocated, and the final expected utilization standard deviation is 3.87%, which is lower than the original standard deviation of 5.20%. The allocation is acceptable. The final shard allocation is: D5 adds 2 shards and D1 adds 1 shard.
[0195] Example 2
[0196] Consider an ElasticSearch cluster with five storage nodes. The storage utilization rates of the five storage nodes (numbered D1, D2, D3, D4, and D5) are 10%, 15%, 20%, 17%, and 3%, respectively. The storage sizes are 10GB, 15GB, 20GB, 17GB, and 3GB, respectively. The standard deviation of the current storage utilization is 5.20%.
[0197] To add 12 new shards, the geometric average size of each shard is 3.1GB.
[0198] First, perform the first round of iterative allocation:
[0199] The number of shards (12) is greater than the number of nodes (5). Therefore, the 2 / 3 node range with the lowest storage usage should be selected first. 5 times 2 / 3 is approximately rounded to 3, namely D5, D1, and D2. The expected allocation is calculated as follows:
[0200] The expected standard deviation drops to 4.06%. There are 9 shards left, which is greater than the number of nodes, 5. Continue selecting, and select D5, D1, and D3 for the second round of allocation:
[0201] The expected standard deviation drops to 3.22%. There are 6 shards left, which is greater than the number of nodes, 5. Continue selecting, and now select D5, D1, and D2 for the third round of allocation:
[0202] The expected standard deviation drops to 2.51%. There are 3 shards left, which is less than the number of nodes, 5. 2 nodes should be selected. At this time, D5 and D1 are selected for the fourth round of allocation:
[0203] The expected standard deviation drops to 1.77%, leaving only one shard. D5, which has the lowest storage usage, is directly selected for the final allocation:
[0204] At this point, all 12 shards have been allocated, and the final expected storage utilization standard deviation has been reduced to 1.09%, far lower than the initial value of 5.20%. The expected imbalance between nodes has been reduced by 79%.
[0205] The search engine database management method provided by the embodiment of the present application obtains the current data storage capacity of each computer device node corresponding to the search engine database, the current storage utilization rate of each computer device node, and the number of new shards; determines the target computer device node based on the current data storage capacity of each computer device node, the current storage utilization rate of each computer device node, and the number of new shards; and allocates the new shards of the search engine database to the target computer device node. The method provided by the above scheme selects the target computer device node corresponding to the new shard by comprehensively considering the current data storage capacity, current storage utilization rate, and the number of new shards of each computer device node, ensuring that after the new shard is allocated to the corresponding target computer device node, the data storage of each computer device node can be balanced, thereby improving resource utilization and laying the foundation for improving the search efficiency of the ES database. In addition, taking into account the degree of node dispersion, secondary selection is performed to perform iterative calculations to achieve decentralized distribution of new shards, avoiding the extreme situation where all new shards are piled up on a single node, and further improving the degree of data storage balance of the computer device node.
[0206] An embodiment of the present application provides a search engine database management device, which is used to execute the search engine database management method provided in the above embodiment.
[0207] As shown in FIG5 , which is a schematic diagram of the structure of a search engine database management device provided by an embodiment of the present application, the search engine database management device 50 comprises: an acquisition module 501 , a determination module 502 , and a management module 503 .
[0208] Among them, the acquisition module is used to obtain the current data storage capacity, current storage utilization rate and number of new shards of each computer device node corresponding to the search engine database; the determination module is used to determine the target computer device node based on the current data storage capacity, current storage utilization rate and number of new shards of each computer device node; the management module is used to allocate the new shards of the search engine database to the target computer device node.
[0209] In one or more embodiments, the determination module is configured to:
[0210] Determine a current balance evaluation index between each computer device node based on the current storage usage rate of each computer device node;
[0211] Determine node selection constraints based on current balance evaluation indicators between computer device nodes;
[0212] According to the node selection constraint conditions, the target computer device node is determined based on the current data storage capacity of each computer device node, the current storage utilization rate of each computer device node and the number of new shards.
[0213] In one or more embodiments, the determination module is configured to:
[0214] Determining a standard deviation of current storage utilization rates among the computer device nodes based on the current storage utilization rates of the computer device nodes;
[0215] The current storage usage standard deviation is used as the current balance evaluation indicator between each computer device node.
[0216] In one or more embodiments, the determination module is configured to:
[0217] Determine the computer device nodes to be selected based on the current data storage capacity of each computer device node, the current storage utilization rate of each computer device node, and the number of new shards;
[0218] Predicting the latest balance evaluation index between the computer device nodes after allocating the new shard of the search engine database to the selected computer device nodes;
[0219] In response to determining that the latest balance evaluation index is less than the current balance evaluation index, the to-be-selected computer device node is determined as the target computing device node.
[0220] In one or more embodiments, the determination module is configured to:
[0221] Predict the data storage capacity of the new shard based on the current data storage capacity of each computer device node;
[0222] The computer device nodes to be selected are determined based on the current storage usage rate of each computer device node, the number of new shards, and the data storage capacity of the new shards.
[0223] In one or more embodiments, the determination module is configured to:
[0224] The data storage capacity of the new shard is predicted based on the current data storage capacity of each computer device node and the current number of shards of each computer device node.
[0225] In one or more embodiments, the determination module is configured to:
[0226] Determine the average data storage capacity of a single shard of the search engine database based on the current data storage capacity of each computer device node and the current number of shards of each computer device node;
[0227] The average data storage capacity of a single shard is used as the data storage capacity of the new shard.
[0228] In one or more embodiments, the determination module is configured to:
[0229] Determine the geometric average data storage capacity of a single shard of the search engine database based on the current data storage capacity of each computer device node and the current number of shards of each computer device node;
[0230] The geometric mean data storage capacity of a single shard is used as the data storage capacity of the new shard.
[0231] In one or more embodiments, the determination module is configured to:
[0232] Construct a storage utilization summary table based on the current storage utilization of each computer device node;
[0233] Determine whether the number of new shards is greater than the total number of computer device nodes;
[0234] In response to determining that the number of new shards is greater than the total number of computer device nodes, screening candidate computer device nodes corresponding to the first number of new shards according to the storage usage summary table;
[0235] updating the storage utilization rate of each candidate computer device node according to the current data storage capacity of each candidate computer device node and the data storage capacity of the new shard, while keeping the storage utilization rates of other computer device nodes other than the candidate computer device node unchanged, so as to iteratively update the storage utilization rate summary table, and using the updated storage utilization rate summary table as the new storage utilization rate summary table;
[0236] The number of new shards is updated to reduce the first number to iteratively update the number of new shards, and the process returns to the step of determining whether the number of new shards is greater than the total number of computer device nodes.
[0237] In one or more embodiments, the determination module is configured to:
[0238] In response to determining that the number of new shards is greater than the total number of computer device nodes, sorting the computing device nodes in ascending order according to the current storage usage of each computer device node represented by the storage usage summary table;
[0239] According to the ascending sorting results of the computing device nodes, a first number of candidate computer device nodes are screened from small to large.
[0240] In one or more embodiments, the determining module is further configured to:
[0241] A first quantity is determined based on the total number of computer device nodes and a preset first allocation ratio.
[0242] In one or more embodiments, the determining module is further configured to:
[0243] In response to determining that the number of new shards is not greater than the total number of computer device nodes, determining whether the number of new shards is equal to 1;
[0244] In response to determining that the number of new shards is equal to 1, the computer device node with the lowest current storage usage rate represented by the storage usage rate summary table is determined as the computer device node to be selected corresponding to the new shard.
[0245] In one or more embodiments, the determining module is further configured to:
[0246] In response to determining that the number of new shards is not greater than the total number of computer device nodes, and the number of new shards is greater than 1, selecting computer device nodes to be selected corresponding to the second number of new shards according to the storage usage summary table;
[0247] updating the storage utilization rate of each candidate computer device node according to the current data storage capacity of each candidate computer device node and the data storage capacity of the new shard, while keeping the storage utilization rates of other computer device nodes other than the candidate computer device node unchanged, so as to iteratively update the storage utilization rate summary table, and using the updated storage utilization rate summary table as the new storage utilization rate summary table;
[0248] The number of new shards is updated to decrease by a second number, so as to iteratively update the number of new shards, and the process returns to the step of determining whether the number of new shards is equal to 1.
[0249] In one or more embodiments, the determination module is configured to:
[0250] In response to determining that the number of new shards is not greater than the total number of computer device nodes, and the number of new shards is greater than 1, sorting the computing device nodes in ascending order according to the current storage usage of each computer device node represented by the storage usage summary table;
[0251] According to the ascending sorting results of the computing device nodes, a second number of computer device nodes to be selected are screened from small to large.
[0252] In one or more embodiments, the determining module is further configured to:
[0253] The second quantity is determined based on the total number of computer device nodes and a preset second allocation ratio.
[0254] In one or more embodiments, the acquisition module is configured to:
[0255] Obtain data storage space of each computer device node;
[0256] For any computer device node, the current storage usage rate of the computer device node is determined according to the current data storage amount and data storage space of the computer device node.
[0257] Regarding the search engine database management device in this embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated on here.
[0258] The search engine database management device provided in the embodiment of the present application is used to execute the search engine database management method provided in the above embodiment. Its implementation method and principle are the same and will not be repeated here.
[0259] The embodiment of the present application provides a search engine database, which is used to execute the search engine database management method provided in the above embodiment.
[0260] As shown in FIG6 , it is a schematic diagram of the structure of a search engine database provided in an embodiment of the present application. The search engine database 60 includes: a plurality of computer device nodes 601 .
[0261] Any computer device node executes the search engine database management method provided in the above embodiment.
[0262] The embodiment of the present application provides a search engine database, which is used to execute the search engine database management method provided in the above embodiment. The implementation method and principle are the same and will not be described in detail.
[0263] An embodiment of the present application provides an electronic device for executing the search engine database management method provided in the above embodiment.
[0264] As shown in FIG7 , which is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application, the electronic device 70 includes at least one processor 71 and a memory 72 .
[0265] The memory stores computer-readable instructions; and at least one processor executes the computer-readable instructions stored in the memory, so that the at least one processor executes the search engine database management method provided in the above embodiment.
[0266] An electronic device provided in an embodiment of the present application is used to execute the search engine database management method provided in the above embodiment. Its implementation method and principle are the same and will not be repeated here.
[0267] An embodiment of the present application provides a computer-readable storage medium having computer-readable instructions stored therein. When a processor executes the computer-readable instructions, the search engine database management method provided in any of the above embodiments is implemented.
[0268] The storage medium containing computer-readable instructions in the embodiment of the present application can be used to store computer-readable instructions of the search engine database management method provided in the aforementioned embodiment. Its implementation method and principle are the same and will not be repeated here.
[0269] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of units is only a logical function division. In actual implementation, there may be other division methods, 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.
[0270] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0271] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0272] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) or a processor to perform some steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program code.
[0273] Those skilled in the art will clearly understand that for the sake of convenience and brevity, the division of the above-mentioned functional modules is only used as an example for illustration. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. The specific working process of the device described above can refer to the corresponding process in the aforementioned method embodiment and will not be repeated here.
[0274] Finally, it should be noted that the above embodiments 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, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some or all of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A search engine database management method, characterized in that: include: Obtaining the current data storage capacity of each computer device node corresponding to the search engine database, the current storage usage rate of each computer device node, and the number of new shards; Determine the target computer device node according to the current data storage capacity of each computer device node, the current storage utilization rate of each computer device node and the number of new shards; as well as Allocate new shards of the search engine database to the target computer device node.
2. The method according to claim 1, characterized in that The step of determining the target computer device node according to the current data storage capacity of each computer device node, the current storage utilization rate of each computer device node, and the number of new shards includes: Determining a current balance evaluation index between each of the computer device nodes according to a current storage usage rate of each of the computer device nodes; Determining node selection constraints according to current balance evaluation indicators between the computer device nodes; and According to the node selection constraint conditions, the target computer device node is determined based on the current data storage capacity of each computer device node, the current storage utilization rate of each computer device node, and the number of new shards.
3. The method according to claim 2, characterized in that Determining the current balance evaluation index between the computer device nodes according to the current storage usage rate of each of the computer device nodes includes: Determining a standard deviation of current storage usage rates between the computer device nodes according to the current storage usage rates of the computer device nodes; and The current storage usage rate standard deviation is used as a current balance evaluation indicator between the computer device nodes.
4. The method according to claim 3, characterized in that: The step of determining the target computer device node according to the node selection constraint condition, based on the current data storage capacity of each computer device node, the current storage utilization rate of each computer device node, and the number of new shards, includes: Determine the computer device nodes to be selected according to the current data storage capacity of each computer device node, the current storage utilization rate of each computer device node and the number of new shards; Predicting the latest balance evaluation index between the computer device nodes after allocating the new shard of the search engine database to the selected computer device node; and In response to determining that the latest balance evaluation index is smaller than the current balance evaluation index, the to-be-selected computer device node is determined as the target computing device node.
5. The method according to claim 4, characterized in that The method of determining the computer device nodes to be selected according to the current data storage capacity of each computer device node, the current storage utilization rate of each computer device node and the number of new shards includes: Predicting the data storage capacity of the new shard based on the current data storage capacity of each of the computer device nodes; and The computer device node to be selected is determined according to the current storage usage rate of each of the computer device nodes, the number of new shards and the data storage capacity of the new shards.
6. The method according to claim 5, characterized in that The predicting the data storage capacity of the new shard according to the current data storage capacity of each of the computer device nodes includes: The data storage capacity of the new shard is predicted based on the current data storage capacity of each of the computer device nodes and the current number of shards of each of the computer device nodes.
7. The method according to claim 6, characterized in that The predicting the data storage capacity of the new shard according to the current data storage capacity of each of the computer device nodes and the current number of shards of each of the computer device nodes includes: According to the current data storage capacity of each of the computer device nodes and the current number of shards of each of the computer device nodes, Determine the average data storage capacity of a single shard of the search engine database; and The average data storage capacity of the single shard is used as the data storage capacity of the new shard.
8. The method according to claim 6, characterized in that The predicting the data storage capacity of the new shard according to the current data storage capacity of each of the computer device nodes and the current number of shards of each of the computer device nodes includes: Determining the geometric average data storage capacity of a single shard of the search engine database according to the current data storage capacity of each of the computer device nodes and the current number of shards of each of the computer device nodes; and The geometric mean data storage capacity of the single shard is used as the data storage capacity of the new shard.
9. The method according to claim 5, characterized in that The step of determining the computer device node to be selected according to the current storage usage rate of each of the computer device nodes, the number of new shards, and the data storage capacity of the new shards comprises: Constructing a storage utilization rate summary table according to the current storage utilization rate of each of the computer device nodes; Determining whether the number of the new shards is greater than the total number of computer device nodes; In response to determining that the number of the new shards is greater than the total number of the computer device nodes, screening the candidate computer device nodes corresponding to the first number of new shards according to the storage usage summary table; According to the current data storage capacity of each of the to-be-selected computer device nodes and the data storage capacity of the new shard, the storage usage rate of each of the to-be-selected computer device nodes is updated, and the storage usage rates of other computer device nodes except the to-be-selected computer device nodes remain unchanged, so as to iteratively update the storage usage rate summary table, and use the updated storage usage rate summary table as a new storage usage rate summary table; and Update the number of new shards to reduce the first number to iteratively update the number of new shards, and return to the step of determining whether the number of new shards is greater than the total number of computer device nodes.
10. The method according to claim 9, characterized in that In response to determining that the number of the new shards is greater than the total number of the computer device nodes, screening the candidate computer device nodes corresponding to the first number of new shards according to the storage usage summary table includes: In response to determining that the number of the new shards is greater than the total number of the computer device nodes, sorting the computing device nodes in ascending order according to the current storage usage of each of the computer device nodes represented by the storage usage summary table; and According to the ascending sorting results of the computing device nodes, a first number of to-be-selected computer device nodes are screened from small to large.
11. The method according to claim 9, characterized in that The method further comprises: The first quantity is determined according to the total number of computer device nodes and a preset first allocation ratio.
12. The method according to claim 9, characterized in that The method further comprises: In response to determining that the number of new shards is not greater than the total number of computer device nodes, determining whether the number of new shards is equal to 1; and In response to determining that the number of the new shards is equal to 1, the computer device node with the lowest current storage usage rate represented by the storage usage rate summary table is determined as the computer device node to be selected corresponding to the new shard.
13. The method according to claim 12, characterized in that The method further comprises: In response to determining that the number of the new shards is not greater than the total number of the computer device nodes, and the number of the new shards is greater than 1, screening the computer device nodes to be selected corresponding to the second number of new shards according to the storage usage summary table; According to the current data storage capacity of each of the to-be-selected computer device nodes and the data storage capacity of the new shard, the storage usage rate of each of the to-be-selected computer device nodes is updated, and the storage usage rates of other computer device nodes except the to-be-selected computer device nodes remain unchanged, so as to iteratively update the storage usage rate summary table, and use the updated storage usage rate summary table as a new storage usage rate summary table; and The number of new shards is updated to be reduced by a second number, so as to iteratively update the number of new shards, and return to the step of determining whether the number of new shards is equal to 1.
14. The method according to claim 13, characterized in that In response to determining that the number of the new shards is not greater than the total number of the computer device nodes, and the number of the new shards is greater than 1, screening the candidate computer device nodes corresponding to the second number of new shards according to the storage usage summary table includes: In response to determining that the number of the new shards is not greater than the total number of the computer device nodes, and the number of the new shards is greater than 1, sorting the computing device nodes in ascending order according to the current storage usage of each of the computer device nodes represented by the storage usage summary table; and According to the ascending sorting result of each of the computing device nodes, a second number of to-be-selected computer device nodes are screened from small to large.
15. The method according to claim 13, characterized in that Also includes: The second quantity is determined according to the total number of computer device nodes and a preset second allocation ratio.
16. The method according to claim 1, characterized in that The obtaining of the current storage usage rate of each computer device node corresponding to the search engine database includes: Acquiring data storage space of each of the computer device nodes; and For any of the computer device nodes, the current storage usage rate of the computer device node is determined according to the current data storage capacity and data storage space of the computer device node.
17. A search engine database management device, characterized in that: include: An acquisition module, used to acquire the current data storage capacity of each computer device node corresponding to the search engine database, the current storage utilization rate of each computer device node, and the number of new shards; A determination module, for determining a target computer device node according to a current data storage capacity of each computer device node, a current storage utilization rate of each computer device node, and a number of new shards; as well as The management module is used to allocate the new shard of the search engine database to the target computer device node.
18. A search engine database, characterized in that: include: Several computer device nodes; Any of the computer device nodes executes the method according to any of claims 1 to 16.
19. An electronic device, characterized in that: include: at least one processor and memory; The memory stores computer readable instructions; and The at least one processor executes the computer-readable instructions stored in the memory, so that the at least one processor performs the method according to any one of claims 1 to 16.
20. A non-volatile computer-readable storage medium, characterized in that: The non-volatile computer-readable storage medium stores computer-readable instructions. When the processor executes the computer-readable instructions, the method according to any one of claims 1 to 16 is implemented.
Citation Information
Patent Citations
Fragmented file verification method and terminal device
CN109831487A
File storage method and terminal device
CN109857710A
Distributed storage method, computer equipment and computer readable storage medium
CN111475108A
Data storage method and device, storage medium and electronic device
CN112434039A
Data balancing method and device, query system and storage medium
CN113177050A
