Method, device, equipment and storage medium for determining data distribution
Through the two-layer hash ring architecture and consistent hashing algorithm, balanced distribution of data in hyper-converged storage is achieved, solving the problems of storage pressure and high operation and maintenance costs, and providing high-performance data reading and writing.
Patent Information
- Application Number
- CN202210461346.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-28
- Publication Date
- 2025-09-26
- Estimated Expiration
- 2042-04-28
AI Technical Summary
In existing hyper-converged storage technology, the software-defined storage function causes storage to be under great pressure, with high read and write performance requirements and high costs. When hardware disks are damaged and replaced, data distribution is uneven, resulting in increased operation and maintenance costs.
It adopts a two-layer hash ring architecture, calculates the hash value of the data block through the consistent hashing algorithm, determines its virtual node in the upper node and the lower disk, achieves balanced distribution of data blocks, and automatically adapts to changes in storage devices.
It effectively solves the problem of uneven data distribution, reduces storage pressure and operation and maintenance costs, provides high-performance data reading and writing, and automatically adapts to changes in cluster storage devices.
Smart Images

Figure CN114879907B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of hyper-convergence technology, and in particular to a data distribution determination method, device, equipment and storage medium. Background Art
[0002] Currently, with the emergence of more and more large-scale Internet companies, more and more users are choosing hyper-converged infrastructure. Hyper-converged technology not only includes server virtualization functions, but its most important feature is software-defined storage, which provides persistent shared storage services for virtual machines and can bring huge value to users. However, as the core and foundation of hyper-converged technology, software-defined storage is simpler to operate and maintain and has lower costs than traditional storage architectures. However, the use of software-based storage still puts a lot of pressure on storage. Therefore, software-defined storage has high requirements for storage read and write performance. High-performance storage comes with high costs. As the amount of user business data gradually increases, problems such as hardware disk damage and replacement arise, making hyper-converged storage data distribution processing a problem. Summary of the Invention
[0003] In view of this, the purpose of the present invention is to provide a data distribution determination method, apparatus, device, and storage medium that can evenly distribute data, reduce storage pressure, reduce the deployment and operation and maintenance costs of hyper-converged storage, provide high-performance data reading and writing, and effectively solve the data distribution imbalance problem caused by changes in hyper-converged cluster storage devices. The specific solution is as follows:
[0004] In a first aspect, the present application discloses a method for determining data distribution, comprising:
[0005] Obtaining a data access request for a target data block, and determining a corresponding target hash value based on a data block identification number corresponding to the target data block;
[0006] Determine the target virtual node of the target data block in the upper node hash ring based on the target hash value, and determine the target disk virtual node of the target data block in the lower disk hash ring corresponding to the target virtual node based on the target hash value; the upper node hash ring is a pre-built hash ring corresponding to the upper node in the hyper-converged cluster, and the lower disk hash ring is a pre-built hash ring corresponding to the lower disk of the upper node;
[0007] A target distribution position of the target data block is determined according to the target virtual node and the target disk virtual node.
[0008] Optionally, the determining, based on the target hash value, that the target data block is located before the target virtual node in the upper-level node hash ring further includes:
[0009] Obtaining node information corresponding to upper-level nodes in a hyper-converged cluster and disk information corresponding to lower-level disks of each upper-level node;
[0010] An upper-level node hash ring corresponding to the upper-level node in the hyper-converged cluster is generated based on the node information and the disk information, and a lower-level disk hash ring corresponding to the lower-level disk of the upper-level node is generated based on the disk information.
[0011] Optionally, generating an upper-level node hash ring corresponding to the upper-level node in the hyper-converged cluster based on the node information and the disk information includes:
[0012] An upper-level node hash ring corresponding to the upper-level node in the hyper-converged cluster is generated based on the IP address corresponding to the upper-level node of the hyper-converged cluster and the cluster disk capacity corresponding to the hyper-converged cluster.
[0013] Optionally, generating a lower disk hash ring corresponding to the lower disk of the upper node based on the disk information includes:
[0014] A lower disk hash ring corresponding to the lower disk of the upper node is generated based on the disk identification number in the upper node and the node disk capacity corresponding to the upper node.
[0015] Optionally, determining a corresponding target hash value based on a data block identification number corresponding to the target data block includes:
[0016] The target hash value of the data block identification number corresponding to the target data block is calculated using the consistent hashing algorithm.
[0017] Optionally, determining a target virtual node of the target data block in an upper-level node hash ring based on the target hash value includes:
[0018] Along the clockwise direction of the upper node hash ring, the target hash value is compared with the node hash value corresponding to the virtual node in the upper node hash ring, and the virtual node corresponding to the first node hash value in the upper node hash ring that is greater than the target hash value is determined as the target virtual node corresponding to the target data block.
[0019] Optionally, determining the target disk virtual node of the target data block in the lower disk hash ring corresponding to the target virtual node based on the target hash value includes:
[0020] Along the clockwise direction of the lower disk hash ring corresponding to the target virtual node, the target hash value is compared with the disk hash value corresponding to the disk virtual node in the lower disk hash ring, and the disk virtual node corresponding to the first disk hash value in the lower disk hash ring that is greater than the target hash value is determined as the target disk virtual node corresponding to the target data block.
[0021] In a second aspect, the present application discloses a data distribution determination device, comprising:
[0022] A data request acquisition module is used to obtain a data access request for a target data block;
[0023] A hash value determination module, configured to determine a corresponding target hash value based on a data block identification number corresponding to the target data block;
[0024] An upper-level node determination module, configured to determine a target virtual node of the target data block in the upper-level node hash ring based on the target hash value;
[0025] A lower disk determination module is configured to determine, based on the target hash value, a target disk virtual node of the target data block in the lower disk hash ring corresponding to the target virtual node; the upper node hash ring is a pre-built hash ring corresponding to the upper node in the hyper-converged cluster, and the lower disk hash ring is a pre-built hash ring corresponding to the lower disk of the upper node;
[0026] The distribution position determination module is used to determine the target distribution position of the target data block according to the target virtual node and the target disk virtual node.
[0027] In a third aspect, the present application discloses an electronic device, comprising:
[0028] Memory, used to store computer programs;
[0029] A processor is used to execute the computer program to implement the steps of the aforementioned disclosed method for determining data distribution.
[0030] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the steps of the aforementioned disclosed method for determining data distribution are implemented.
[0031] It can be seen that the present application provides a method for determining data distribution, including: obtaining a data access request for a target data block, and determining a corresponding target hash value based on a data block identification number corresponding to the target data block; determining a target virtual node of the target data block in the upper node hash ring based on the target hash value, and determining a target disk virtual node of the target data block in the lower disk hash ring corresponding to the target virtual node based on the target hash value; the upper node hash ring is a pre-built hash ring corresponding to the upper node in the hyper-converged cluster, and the lower disk hash ring is a pre-built hash ring corresponding to the lower disk of the upper node; determining the target distribution position of the target data block according to the target virtual node and the target disk virtual node. It can be seen that the present application is based on a two-layer hash ring architecture, and determines which node in the hyper-converged cluster the target data block is distributed to according to the upper node hash ring, and then determines which disk in the node the data is distributed to according to the lower disk hash ring, thereby realizing data distribution management and effectively solving the problem of uneven data distribution caused by changes in storage devices in the hyper-converged cluster. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0033] Figure 1 This is a flow chart of a method for determining data distribution disclosed in this application;
[0034] Figure 2 A data partitioning diagram disclosed in this application;
[0035] Figure 3 This is a data distribution diagram of a hyper-converged storage based on two-layer DHT disclosed in this application;
[0036] Figure 4 This is a schematic structural diagram of a data distribution determination device disclosed in this application;
[0037] Figure 5 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION
[0038] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0039] Currently, in the existing technology, software-defined storage functions are the core and basic part of hyper-convergence technology. Although it is simpler to operate and maintain and has lower costs than traditional storage architectures, it still causes storage to be under great pressure in the process of using software to locate storage functions. Therefore, software-defined storage functions also have relatively high requirements for storage read and write performance. High-performance storage is accompanied by high costs, and as the amount of user business data gradually increases, problems such as damage and replacement of hardware disks arise, which makes hyper-convergence storage data distribution processing a difficult problem. To this end, the present application provides a data distribution determination solution that can evenly distribute data, effectively solve the problem of uneven data distribution caused by changes in hyper-convergence cluster storage devices, reduce storage pressure, reduce the deployment and operation and maintenance costs of hyper-convergence storage, and provide high-performance data reading and writing.
[0040] The embodiment of the present invention discloses a method for determining data distribution, see Figure 1 As shown, the method includes:
[0041] Step S11: obtaining a data access request for a target data block, and determining a corresponding target hash value based on a data block identification number corresponding to the target data block.
[0042] It should be noted that the Lun (i.e., upper-layer storage data) is divided into data blocks of the same size. For example, each data block is 4M in size, that is, the minimum Lun size is 4M, and the capacity is a multiple of 4M. Each data block is a storage object and has an ID (i.e., data block identification number) corresponding to it, and the ID is unique. Figure 2 As shown, the upper storage data Lun is divided into data blocks of equal size, obtaining data block 0, data block 1, data block 2, and data block 3, wherein the IDs corresponding to the above data block 0, the above data block 1, and the above data block 3 are unique.
[0043] In this embodiment, when a data access request for a target data block is obtained, that is, when a data read or write request for a target data block is received, a corresponding target hash value is determined based on the data block identification number corresponding to the target data block. Specifically, a target hash value for the data block identification number corresponding to the target data block is calculated using a consistent hashing algorithm. It can be understood that the hash value (i.e., hash value) is calculated based on the ID corresponding to the target data block as the target storage object. Since the ID is unique, the calculated hash value is also unique.
[0044] Step S12: Determine the target virtual node of the target data block in the upper node hash ring based on the target hash value, and determine the target disk virtual node of the target data block in the lower disk hash ring corresponding to the target virtual node based on the target hash value; the upper node hash ring is a pre-built hash ring corresponding to the upper node in the hyper-converged cluster, and the lower disk hash ring is a pre-built hash ring corresponding to the lower disk of the upper node.
[0045] It should be pointed out that the above-mentioned pre-constructed upper-level node hash ring corresponding to the upper-level node in the hyper-converged cluster and the above-mentioned pre-constructed lower-level disk hash ring corresponding to the lower-level disk of the upper-level node may include: obtaining node information corresponding to the upper-level node in the hyper-converged cluster and disk information corresponding to the lower-level disk of each upper-level node; generating an upper-level node hash ring corresponding to the upper-level node in the hyper-converged cluster based on the node information and the disk information, and generating a lower-level disk hash ring corresponding to the lower-level disk of the upper-level node based on the disk information, wherein the specific implementation method of constructing the above-mentioned upper-level node hash ring and the above-mentioned lower-level disk hash ring may include: generating an upper-level node hash ring corresponding to the upper-level node in the hyper-converged cluster based on the IP (Internet Protocol) address corresponding to the upper-level node of the hyper-converged cluster and the cluster disk capacity corresponding to the hyper-converged cluster, and generating a lower-level disk hash ring corresponding to the lower-level disk of the upper node based on the disk identification number in the upper node and the node disk capacity corresponding to the upper node. It can be understood that the cluster management service is used to query and obtain the node information of the upper-level nodes corresponding to the hyper-converged cluster and the disk information of the lower-level disks of each upper-level node, wherein the above-mentioned node information may include the IP address of the node, etc., and the above-mentioned disk information may include the disk capacity corresponding to each upper-level node, the factory unique identification of the disk corresponding to each upper-level node, that is, the disk identification number, etc., and then the IP address corresponding to the upper-level node in the hyper-converged cluster is combined with the cluster disk capacity corresponding to the hyper-converged cluster as the input parameters of the hash algorithm corresponding to the upper-level node hash ring, thereby generating multiple hash values corresponding to the IP address, wherein the above-mentioned cluster disk capacity is the sum of the disk capacity of all upper-level nodes, and the number of hash values is determined according to the size of the above-mentioned cluster disk capacity, that is, the number of virtual nodes of the upper-level node hash ring is determined according to the size of the above-mentioned cluster disk capacity, thereby obtaining an upper-level node hash ring containing multiple virtual nodes according to the multiple upper-level node hash values corresponding to all upper-level nodes. The SCSI (Small Computer System Interface) ID corresponding to the disk in the upper node is combined with the node disk capacity corresponding to the above upper node as the input parameters of the hash algorithm corresponding to the upper disk hash ring, thereby generating multiple hash values corresponding to the SCSI ID, wherein the SCSI ID is the unique factory identifier of the disk, and the above node disk capacity is the sum of the capacities of all disks in the upper node, and the number of hash values is determined according to the size of the node disk capacity, that is, the number of virtual nodes in the lower disk hash ring is determined by the size of the node disk capacity, thereby obtaining the lower disk hash ring containing multiple virtual nodes corresponding to each upper node according to the multiple lower disk hash values corresponding to each upper node.Among them, the hash algorithm for generating the upper node hash ring and the lower disk hash ring may include but is not limited to DHT (Distributed Hash Table), that is, a consistent hash algorithm, etc., and when calculating the corresponding target hash value based on the data block identification number corresponding to the target data block, the same consistent hash algorithm as that used to generate the hash ring is also used. This embodiment is based on the consistent hash algorithm, so that metadata does not need to save the location of data objects and copies, providing high-performance data reading and writing, and can effectively solve the problem of uneven data distribution caused by changes in cluster storage devices such as adding or removing nodes or disks during operation and maintenance.
[0046] In this embodiment, after obtaining a data access request for a target data block and calculating a target hash value corresponding to the data block identification number of the target data block, first, the target virtual node of the target data block in the upper-level node hash ring is determined, and then the target disk virtual node of the target data block in the lower-level disk hash ring corresponding to the target virtual node is determined, that is, determine on which virtual node in the upper-level node hash ring the target data block is distributed, and then determine on which virtual node in the lower-level disk hash ring corresponding to the target virtual node the target data block is distributed. Specifically, along the clockwise direction of the upper node hash ring, the target hash value is compared with the node hash value corresponding to the virtual node in the upper node hash ring, and the virtual node corresponding to the first node hash value in the upper node hash ring that is greater than the target hash value is determined as the target virtual node corresponding to the target data block. When determining the target disk virtual node distribution, the same method is adopted, that is, along the clockwise direction of the lower disk hash ring corresponding to the target virtual node, the target hash value is compared with the disk hash value corresponding to the disk virtual node in the lower disk hash ring, and the disk virtual node corresponding to the first disk hash value in the lower disk hash ring that is greater than the target hash value is determined as the target disk virtual node corresponding to the target data block.
[0047] like Figure 3As shown, when a data read IO request for a data block is received, a hash value is calculated based on the id of the data block Object, and the hash value is compared with the hash value corresponding to the virtual node on the upper node DHT (i.e., the upper node hash ring) containing three real nodes, where the above-mentioned real points are node A, node B, and node C respectively. Then, the first virtual node in the upper node DHT in the clockwise direction that is greater than the hash value is determined as the target virtual node, and then the hash value is compared with the hash value corresponding to the virtual node on the lower disk DHT (i.e., the lower disk hash ring) corresponding to the target virtual node. The first virtual node in the clockwise direction of the lower disk DHT corresponding to the target virtual node that is greater than the hash value is determined as the target disk virtual node.
[0048] Step S13: determining a target distribution position of the target data block according to the target virtual node and the target disk virtual node.
[0049] In this embodiment, after determining the target virtual node where the target data block is distributed in the upper-level node hash ring and the target disk virtual node distributed in the lower-level disk hash ring corresponding to the target virtual node, the node corresponding to the above-mentioned target virtual node is the node where the target data block is distributed in the cluster, and the disk corresponding to the above-mentioned target disk virtual machine node is the data disk where the target data block is distributed in the node.
[0050] It can be seen that the embodiment of the present application obtains a data access request for a target data block, and determines the corresponding target hash value based on the data block identification number corresponding to the target data block; determines the target virtual node of the target data block in the upper node hash ring based on the target hash value, and determines the target disk virtual node of the target data block in the lower disk hash ring corresponding to the target virtual node based on the target hash value; the upper node hash ring is a pre-built hash ring corresponding to the upper node in the hyper-converged cluster, and the lower disk hash ring is a pre-built hash ring corresponding to the lower disk of the upper node; determines the target distribution position of the target data block according to the target virtual node and the target disk virtual node. It can be seen that the present application is based on a two-layer hash ring architecture, determines which node in the hyper-converged cluster the target data block is distributed to according to the upper node hash ring, and then determines which disk in the node the data is distributed to according to the lower disk hash ring, thereby realizing data distribution management and effectively solving the problem of uneven data distribution caused by changes in storage devices in the hyper-converged cluster, that is, when the storage device or cluster node changes, the hash ring is updated to automatically balance the data distribution.
[0051] Accordingly, the present application also discloses a data distribution determination device, see Figure 4 As shown, the device includes:
[0052] A data request acquisition module 11 is used to acquire a data access request for a target data block;
[0053] A hash value determination module 12 is configured to determine a corresponding target hash value based on a data block identification number corresponding to the target data block;
[0054] An upper-layer node determination module 13 is configured to determine a target virtual node of the target data block in the upper-layer node hash ring based on the target hash value;
[0055] The lower disk determination module 14 is configured to determine, based on the target hash value, the target disk virtual node of the target data block in the lower disk hash ring corresponding to the target virtual node; the upper node hash ring is a pre-built hash ring corresponding to the upper node in the hyper-converged cluster, and the lower disk hash ring is a pre-built hash ring corresponding to the lower disk of the upper node;
[0056] The distribution position determining module 15 is configured to determine the target distribution position of the target data block according to the target virtual node and the target disk virtual node.
[0057] As can be seen from the above, in this embodiment, by obtaining a data access request for a target data block, and determining the corresponding target hash value based on the data block identification number corresponding to the target data block; determining the target virtual node of the target data block in the upper node hash ring based on the target hash value, and determining the target disk virtual node of the target data block in the lower disk hash ring corresponding to the target virtual node based on the target hash value; the upper node hash ring is a pre-built hash ring corresponding to the upper node in the hyper-converged cluster, and the lower disk hash ring is a pre-built hash ring corresponding to the lower disk of the upper node; the target distribution position of the target data block is determined according to the target virtual node and the target disk virtual node. It can be seen that the present application is based on a two-layer hash ring architecture, which determines which node in the hyper-converged cluster the target data block is distributed on based on the upper node hash ring, and then determines which disk in the node the data is distributed on based on the lower disk hash ring, thereby realizing data distribution management and effectively solving the problem of uneven data distribution caused by changes in storage devices in the hyper-converged cluster, that is, when the storage device or cluster node changes, the hash ring is updated to automatically balance the data distribution.
[0058] In some specific embodiments, determining, based on the target hash value, that the target data block is located before the target virtual node in the upper node hash ring may specifically include:
[0059] An information acquisition module is used to acquire node information corresponding to upper-level nodes in a hyper-converged cluster and disk information corresponding to lower-level disks of each upper-level node;
[0060] An upper-layer hash ring generation module, configured to generate an upper-layer node hash ring corresponding to the upper-layer node in the hyper-converged cluster based on the node information and the disk information;
[0061] A lower-level hash ring generation module is used to generate a lower-level disk hash ring corresponding to the lower-level disk of the upper-level node based on the disk information.
[0062] In some specific embodiments, the upper-layer hash ring generation module may specifically include:
[0063] An upper-layer hash ring generating unit is configured to generate an upper-layer node hash ring corresponding to the upper-layer node in the hyper-converged cluster based on an IP address corresponding to the upper-layer node of the hyper-converged cluster and a cluster disk capacity corresponding to the hyper-converged cluster.
[0064] In some specific embodiments, the lower-layer hash ring generation module may specifically include:
[0065] The lower-level hash ring generating unit is used to generate a lower-level disk hash ring corresponding to the lower-level disk of the upper-level node based on the disk identification number in the upper-level node and the node disk capacity corresponding to the upper-level node.
[0066] In some specific embodiments, the hash value determination module 12 may specifically include:
[0067] The hash value determination unit is used to calculate the target hash value of the data block identification number corresponding to the target data block by using a consistent hash algorithm.
[0068] In some specific embodiments, the upper node determination module 13 may specifically include:
[0069] Along the clockwise direction of the upper node hash ring, the target hash value is compared with the node hash value corresponding to the virtual node in the upper node hash ring, and the virtual node corresponding to the first node hash value in the upper node hash ring that is greater than the target hash value is determined as the target virtual node corresponding to the target data block.
[0070] In some specific embodiments, the lower disk determination module 14 may specifically include:
[0071] Along the clockwise direction of the lower disk hash ring corresponding to the target virtual node, the target hash value is compared with the disk hash value corresponding to the disk virtual node in the lower disk hash ring, and the disk virtual node corresponding to the first disk hash value in the lower disk hash ring that is greater than the target hash value is determined as the target disk virtual node corresponding to the target data block.
[0072] Furthermore, an embodiment of the present application also provides an electronic device. Figure 5 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram should not be considered as any limitation to the scope of application of the present application.
[0073] Figure 5 This is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps of the data distribution determination method disclosed in any of the aforementioned embodiments. Furthermore, the electronic device 20 in this embodiment may specifically be an electronic computer.
[0074] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device. The communication protocol it follows is any communication protocol that can be applied to the technical solution of this application and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world. Its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0075] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or CD, etc. The resources stored thereon can include an operating system 221, a computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0076] The operating system 221 is used to manage and control the hardware devices on the electronic device 20 and the computer program 222, and can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program capable of implementing the data distribution determination method performed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program capable of implementing other specific tasks.
[0077] Furthermore, an embodiment of the present application also discloses a computer-readable storage medium, in which a computer program is stored. When the computer program is loaded and executed by a processor, the steps of the data distribution determination method disclosed in any of the aforementioned embodiments are implemented.
[0078] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from the other embodiments. Reference can be made to the descriptions of the identical or similar parts between the various embodiments. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple, and the relevant parts can be referred to the descriptions of the methods.
[0079] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or device comprising the element.
[0080] The above is a detailed introduction to the data distribution determination method, device, equipment and storage medium provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for general technical personnel in this field, based on the ideas of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A method for determining data distribution, characterized in that: include: Obtaining a data access request for a target data block, and determining a corresponding target hash value based on a data block identification number corresponding to the target data block; Determine a target virtual node of the target data block in the upper node hash ring based on the target hash value, and determine a target disk virtual node of the target data block in the lower disk hash ring corresponding to the target virtual node based on the target hash value; The upper node hash ring is a pre-built hash ring corresponding to the upper node in the hyper-converged cluster, and the lower disk hash ring is a pre-built hash ring corresponding to the lower disk of the upper node; Determine a target distribution position of the target data block according to the target virtual node and the target disk virtual node; The determining of a corresponding target hash value based on a data block identification number corresponding to the target data block includes: Calculate the target hash value of the data block identification number corresponding to the target data block using the consistent hashing algorithm; The step of determining, based on the target hash value, that the target data block is located before the target virtual node in the upper node hash ring further includes: Obtaining node information corresponding to upper-level nodes in a hyper-converged cluster and disk information corresponding to lower-level disks of each upper-level node; Generate an upper-level node hash ring corresponding to the upper-level node in the hyper-converged cluster based on the node information and the disk information, and generate a lower-level disk hash ring corresponding to the lower-level disk of the upper-level node based on the disk information; The generating an upper-level node hash ring corresponding to the upper-level node in the hyper-converged cluster based on the node information and the disk information includes: Generate an upper-level node hash ring corresponding to the upper-level node in the hyper-converged cluster based on the IP address corresponding to the upper-level node of the hyper-converged cluster and the cluster disk capacity corresponding to the hyper-converged cluster; The generating, based on the disk information, a lower disk hash ring corresponding to the lower disk of the upper node includes: A lower disk hash ring corresponding to the lower disk of the upper node is generated based on the disk identification number in the upper node and the node disk capacity corresponding to the upper node.
2. The data distribution determination method according to claim 1, wherein: The determining, based on the target hash value, a target virtual node of the target data block in the upper node hash ring includes: Along the clockwise direction of the upper node hash ring, the target hash value is compared with the node hash value corresponding to the virtual node in the upper node hash ring, and the virtual node corresponding to the first node hash value in the upper node hash ring that is greater than the target hash value is determined as the target virtual node corresponding to the target data block.
3. The data distribution determination method according to claim 1, characterized in that: The determining, based on the target hash value, the target disk virtual node of the target data block in the lower disk hash ring corresponding to the target virtual node includes: Along the clockwise direction of the lower disk hash ring corresponding to the target virtual node, the target hash value is compared with the disk hash value corresponding to the disk virtual node in the lower disk hash ring, and the disk virtual node corresponding to the first disk hash value in the lower disk hash ring that is greater than the target hash value is determined as the target disk virtual node corresponding to the target data block.
4. A data distribution determination device, characterized in that: include: A data request acquisition module is used to obtain a data access request for a target data block; A hash value determination module, configured to determine a corresponding target hash value based on a data block identification number corresponding to the target data block; An upper-level node determination module, configured to determine a target virtual node of the target data block in the upper-level node hash ring based on the target hash value; A lower disk determination module, configured to determine a target disk virtual node of the target data block in the lower disk hash ring corresponding to the target virtual node based on the target hash value; The upper node hash ring is a pre-built hash ring corresponding to the upper node in the hyper-converged cluster, and the lower disk hash ring is a pre-built hash ring corresponding to the lower disk of the upper node; A distribution position determining module, configured to determine a target distribution position of the target data block according to the target virtual node and the target disk virtual node; A hash value determination module, comprising: A hash value determination unit, configured to calculate a target hash value of a data block identification number corresponding to a target data block using a consistent hashing algorithm; The determining, based on the target hash value, that the target data block is located before the target virtual node in the upper node hash ring includes: An information acquisition module is used to acquire node information corresponding to upper-level nodes in a hyper-converged cluster and disk information corresponding to lower-level disks of each upper-level node; An upper-layer hash ring generation module, configured to generate an upper-layer node hash ring corresponding to the upper-layer node in the hyper-converged cluster based on the node information and the disk information; A lower-layer hash ring generation module, configured to generate a lower-layer disk hash ring corresponding to the lower-layer disk of the upper-layer node based on the disk information; The upper-layer hash ring generation module includes: an upper-layer hash ring generating unit, configured to generate an upper-layer node hash ring corresponding to the upper-layer node in the hyper-converged cluster based on an IP address corresponding to the upper-layer node of the hyper-converged cluster and a cluster disk capacity corresponding to the hyper-converged cluster; The lower-layer hash ring generation module includes: The lower-level hash ring generating unit is used to generate a lower-level disk hash ring corresponding to the lower-level disk of the upper-level node based on the disk identification number in the upper-level node and the node disk capacity corresponding to the upper-level node.
5. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the steps of the data distribution determination method according to any one of claims 1 to 3.
6. A computer-readable storage medium, characterized in that Used to store a computer program; wherein, when the computer program is executed by a processor, the steps of the data distribution determination method according to any one of claims 1 to 3 are implemented.
Citation Information
Patent Citations
File processing method based on distributed file system, system, and client
CN102843403A
Data storage method and device, data processing method and device, electronic device and computer readable medium
CN110096227A