A method for generating a storage volume in a distributed system and related devices

By dividing storage nodes into storage blocks in a distributed system and limiting the number of data blocks carried by each block, the problem of writing stop during the upgrade of the distributed system is solved, and the continuous writing upgrade is achieved, and the system's service reliability and availability are improved.

CN111666047BActive Publication Date: 2025-07-11TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202010501460.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-04
Publication Date
2025-07-11
Estimated Expiration
2040-06-04

AI Technical Summary

Technical Problem

The distributed system needs to stop writing during upgrade, resulting in service interruption, affecting the normal provision of the system, and limiting its promotion and application.

Method used

By dividing the storage node into multiple storage blocks, it is determined that the number of data blocks carried by each storage block is less than or equal to the maximum number of bearers, and upgrades in units of storage blocks to ensure that the write operation of the storage volume does not affect the upgrade process.

Benefits of technology

It realizes that the distributed system keeps writing operations during the upgrade process, improves the system's service reliability and availability, and reduces the impact of the upgrade on business services.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111666047B_ABST
    Figure CN111666047B_ABST
Patent Text Reader

Abstract

The embodiments of the present application disclose a method for generating a storage volume and related devices in a distributed system. In the distributed system, M storage blocks are used to partition and manage storage nodes. For N data blocks of the storage volume to be generated, target storage nodes are determined from the M storage blocks, so as to use the target storage nodes to carry the N data blocks to generate a storage volume. Since the maximum carrying number less than N limits that when a storage node carries the N data blocks included in the storage volume, the number of data blocks carried by the same storage block is less than or equal to the maximum carrying number, the N storage blocks will be allocated to target storage nodes located in different storage blocks. If the storage blocks are upgraded in sequence, at most only a part of the data blocks of the storage volume will be affected by the upgrade of the storage block where they are located, rather than all data blocks being affected by the upgrade as in the related art, so it is possible that the business services provided by the storage volume will not be affected.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing, and in particular, to a method for generating a storage volume in a distributed system and related devices. Background Art

[0002] Distributed systems such as distributed cloud storage systems can provide various services such as data storage and computing for users and companies, and can be composed of a large number of storage nodes. When users and companies need such services, they can generate a storage volume (Volume) composed of storage nodes from the distributed cloud storage system as the basis for data storage and computing to implement the services.

[0003] However, since the distributed system itself often needs to perform service upgrades, once batch upgrades of the storage nodes start, it will directly affect the write operations on the storage volume. Therefore, in the related art, a write suspension operation must be performed during the upgrade of the distributed system.

[0004] The related art causes the distributed system to be unable to provide services normally during the upgrade, which is not conducive to the popularization of the distributed system. Summary of the Invention

[0005] To solve the above technical problems, this application provides a method for generating a storage volume in a distributed system and related devices, making it possible to perform an upgrade without suspending writes.

[0006] Embodiments of this application disclose the following technical solutions:

[0007] On the one hand, an embodiment of this application provides a method for generating a storage volume in a distributed system, where the storage nodes included in the distributed system are divided into M storage blocks, and the method includes:

[0008] Determine N data blocks included in the storage volume to be generated, where M > N;

[0009] Determine target storage nodes for carrying the N data blocks from the M storage blocks. Among the N data blocks, the number of data blocks carried by the same storage block is less than or equal to the maximum carrying number; the maximum carrying number is less than N;

[0010] Generate the storage volume according to the target storage nodes.

[0011] On the other hand, an embodiment of this application provides a device for generating a storage volume in a distributed system, where the storage nodes included in the distributed system are divided into M storage blocks, and the device includes a determination unit and a generation unit:

[0012] The determination unit is configured to determine N data blocks included in the storage volume to be generated, where M > N;

[0013] The determining unit is further configured to determine, from the M storage blocks, a target storage node for carrying the N data blocks, wherein, among the N data blocks, the number of data blocks carried by the same storage block is less than or equal to the maximum carrying number; the maximum carrying number is less than N;

[0014] The generating unit is configured to generate the storage volume according to the target storage node.

[0015] On the other hand, an embodiment of the present application provides a device for generating a storage volume in a distributed system, the device including a processor and a memory:

[0016] The memory is configured to store program code and transmit the program code to the processor;

[0017] The processor is configured to execute the method described in the above aspect according to the instructions in the program code.

[0018] On the other hand, an embodiment of the present application provides a computer-readable storage medium, which is configured to store a computer program for executing the method described in the above aspect.

[0019] It can be seen from the above technical solutions that in a distributed system, M storage blocks are used to manage the storage nodes in the distributed system by partitioning. For the N data blocks of the storage volume to be generated, a target storage node is determined from the M storage blocks, so that the target storage node is used to carry the N data blocks to generate the storage volume. Since the maximum carrying number less than N limits that when the storage node carries the N data blocks included in the storage volume, the number of data blocks carried by the same storage block is less than or equal to the maximum carrying number, the N storage blocks will be allocated to the target storage nodes located in different storage blocks. Thus, when the distributed system is upgraded, if the upgrade is performed in the order of storage blocks, at most only a part of the data blocks of the storage volume will be affected by the upgrade of the storage block where they are located, rather than all the data blocks being affected by the upgrade as in the related art. Therefore, it is possible that the business service provided by the storage volume will not be affected. This way of generating the storage volume makes it possible to keep writing during the upgrade of the distributed system on the premise of partitioning management of the distributed system, laying a foundation for the non-stop writing upgrade and improving the service reliability of the distributed system. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] To more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the accompanying drawings required for use in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.

[0021] Figure 1 Schematic diagram of an application scenario of a method for generating a storage volume in a distributed system provided by an embodiment of the present application;

[0022] Figure 2 Schematic flowchart of a method for generating a storage volume in a distributed system provided by an embodiment of the present application;

[0023] Figure 3 Schematic diagram of another application scenario of a method for generating a storage volume in a distributed system provided by an embodiment of the present application;

[0024] Figure 4 Schematic diagram of the structure of a device for generating a storage volume in a distributed system provided by an embodiment of the present application;

[0025] Figure 5 Schematic diagram of the structure of a server provided by an embodiment of the present application. Detailed implementation manners

[0026] The following describes the embodiments of the present application with reference to the accompanying drawings.

[0027] In the field of distributed storage, there is no related technology for implementing in-place upgrade without stopping writes. For this reason, the present application provides a design for managing storage data based on a management zone (Manager Zone, MZ), that is, in a distributed system, multiple storage nodes are divided into multiple storage blocks as MZs, and the storage space corresponding to the storage nodes is managed through the MZ. When the service is upgraded, the storage nodes managed by it are batch-upgraded in units of storage blocks.

[0028] In the process of implementing distributed storage, services are provided for storage objects through storage volumes. A storage volume is composed of multiple data blocks (Vlets) and is used to manage the data storage space. In the process of generating a storage volume, the storage nodes in different storage blocks can carry the multiple data blocks included in the storage volume. Here, the storage node carrying a data block can be understood as dividing the storage space in the storage node and partitioning a storage space corresponding to the capacity of the data block as the data block of the storage volume.

[0029] Since for the storage block being upgraded, the data blocks it carries will be affected. Therefore, on the premise of service upgrade based on the storage block, in order to ensure that the write operation is not stopped during the upgrade, it is necessary to minimize the number of data blocks belonging to the same storage volume carried in the same storage block. Among them, the non-stop write operation refers to the operation of not stopping writing data. If the storage block stops the write operation, that is, all storage nodes in the storage block perform the stop write operation, which will cause the storage block to be unable to continue providing services or accept new service requests. When it is possible to achieve non-stop write operation during the upgrade, even if there is an upgrade to a certain MZ, it will not affect the normal services provided by the storage volume, and service consumers (such as users, companies) can still write various types of data into the storage volume normally.

[0030] Therefore, the embodiment of the present application provides a method for generating a storage volume in a distributed system. The method for generating the storage volume is applicable to the technical field of distributed cloud storage and is applied to a distributed cloud storage system.

[0031] Among them, cloud storage is a new concept extended and developed on the basis of the concept of cloud computing. A distributed cloud storage system refers to a storage system that combines a large number of various types of storage devices (storage devices are also called storage nodes) in the network through cluster applications, grid technologies, and distributed storage file systems, etc., and collaborates through application software or application interfaces to jointly provide data storage and business access functions to the outside.

[0032] Cloud computing is a computing model that distributes computing tasks on a resource pool composed of a large number of computing devices, enabling various application systems to obtain computing power, storage space, and information services as needed. The network that provides resources is called the "cloud". The resources in the "cloud" seem to be infinitely expandable to users, and can be obtained at any time, used on demand, expanded at any time, and paid according to usage.

[0033] As a basic capability provider of cloud computing, a cloud computing resource pool (abbreviated as a cloud platform, generally called an IaaS (Infrastructure as a Service) platform) will be established, and various types of virtual resources will be deployed in the resource pool for external customers to choose and use. The cloud computing resource pool mainly includes: computing devices (virtualized machines, including operating systems), storage devices, and network devices.

[0034] The method for generating a storage volume in a distributed system provided by an embodiment of the present application is applied to a storage volume generation device with cloud computing capabilities, such as a server. The server can be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. In the embodiment of the present application, the method for generating a storage volume in a distributed system provided by the embodiment of the present application is introduced by taking the server as the storage volume generation device.

[0035] See Figure 1 , Figure 1 which is a schematic diagram of an application scenario of a method for generating a storage volume in a distributed system provided by an embodiment of the present application.

[0036] In Figure 1 the application scenario shown, there is a server 101 for generating a storage volume in the distributed system. In Figure 1 the distributed system shown, there are 10 storage nodes, and these 10 storage nodes are divided into 5 storage blocks, that is, M = 5.

[0037] In a storage task, the server 101 can determine the number N of data blocks included in the storage volume to be generated. In Figure 1 the scenario shown, the number of data blocks included in the storage volume to be generated is 3, that is, N = 3.

[0038] Then, the server 101 can determine target storage nodes from the 5 storage blocks to carry the 3 data blocks, and the number of data blocks carried in the same storage block is less than or equal to the maximum carrying number. The maximum carrying number indicates the maximum number of data blocks belonging to the same storage volume that a storage block can carry. In Figure 1 the scenario shown, if the maximum carrying number is set to 1, then at most one data block belonging to the same storage volume can be carried in a storage block. Therefore, the 3 storage nodes determined by the server 101 are respectively managed by 3 different storage blocks. For example, 1 data block is carried by a storage node in storage block 1.

[0039] Since the N data blocks included in the storage volume are carried in multiple different storage blocks, and the number of data blocks carried in each storage block does not exceed the maximum carrying number, when performing service upgrade in units of storage blocks, the data blocks in the same storage volume affected do not exceed the maximum carrying number, making it possible for the distributed system to be upgraded without stopping writing.

[0040] After the server 101 determines the target storage nodes, it can use the storage space in the target storage nodes to carry the 3 data blocks respectively to generate a storage volume.

[0041] The above method of generating storage volumes makes it possible to keep writing during the upgrade of a distributed system on the premise of partitioning and managing the distributed system, laying a foundation for the upgrade without stopping writing and improving the service reliability of the distributed system.

[0042] Next, in conjunction with the accompanying drawings, a method for generating a storage volume in a distributed system provided by an embodiment of the present application will be introduced.

[0043] See Figure 2 , Figure 2 which is a schematic flowchart of a method for generating a storage volume of a distributed system provided by an embodiment of the present application. As Figure 2 shown, the method includes the following steps:

[0044] S201: Determine N data blocks included in the storage volume to be generated, where M > N.

[0045] In a distributed system, multiple storage nodes are divided into M storage blocks, and the storage blocks can be managed through a physical resource metadata service (Node Manager). Among them, the value range of the number M of storage blocks is 0 to 127, and each cluster can be configured separately.

[0046] In practical applications, the number M of storage blocks can be determined according to the data encoding method corresponding to the distributed system. For example, in some application scenarios, the distributed system uses erasure code (EC) to store data. EC includes two parameters K and N, where K represents the number of business data copies, (N - K) represents the number of stored parity data copies, and N represents the total number of data stored in the system.

[0047] In a distributed system, each cluster can set multiple ECs, and each EC corresponds to a set of K and N values. For example, for a cluster with EC corresponding to K9N18, when the cluster processes a data storage task, a total of 18 data copies need to be stored, among which there are 9 business data copies and 9 parity data copies. The K and N values corresponding to the EC are set according to the application scenario and are not limited here.

[0048] In the embodiment of the present application, it is set that one data block stores one data copy. Then, in a data storage task, for a cluster using EC storage, the number of data blocks of a storage volume is equal to the N value corresponding to the EC. In order to make the data blocks included in a storage volume evenly distributed in each storage block within the cluster, therefore, the number M of storage blocks needs to be at least N. Generally, M is set to 2 * N, leaving one - fold redundancy to improve the reliability of the system. For example, for a cluster using EC corresponding to K15N20, to make each storage block include one data block, at least 20 storage blocks are required, leaving one - fold redundancy, that is, 40 storage blocks need to be set, and M = 40.

[0049] Among them, EC is a forward error correction technology (Forward Error Correction, FEC), which can be applied to network transmission to avoid packet loss. The storage system can use it to improve storage reliability. Compared with multi-copy replication, erasure codes can achieve higher data reliability with a smaller data redundancy. EC can add m pieces of data to n pieces of original data, and can restore the original data through any n pieces of the n + m pieces of data. If any data less than or equal to m pieces fails, the original data can still be restored through the remaining data. The applications of EC technology in distributed storage systems include: array erasure codes (Array Code: RAID5, RAID6, etc.), Reed-Solomon erasure codes (Reed-Solomon, RS), and Low Density Parity Check erasure codes (Low Density Parity Check Code, LDPC).

[0050] In the process of generating a storage volume, the generation work of the storage volume can be initiated by a storage control node (for example, the Center module). After the system obtains the storage object to be stored, it triggers the generation of the storage volume. First, determine the number N of data blocks included in the storage volume to be generated. Among them, the number N of data blocks included in the storage volume is less than the number M of storage blocks. For the above-mentioned cluster using EC, the number of data blocks included in the storage volume to be generated can be determined according to the N value corresponding to EC, which is N.

[0051] Since the number of data blocks included in the storage volume to be generated is determined based on the total number of data to be stored in the storage object to be stored, the generated storage volume meets the data storage requirements corresponding to the storage object and improves the system service performance.

[0052] S202: Determine the target storage nodes for carrying the N data blocks from the M storage blocks. Among the N data blocks, the number of data blocks carried by the same storage block is less than or equal to the maximum carrying number; the maximum carrying number is less than N.

[0053] Since the data blocks carried by the storage blocks in the distributed system will be affected during the upgrade. Therefore, in order to ensure that the storage volume does not affect the normal operation of the service during the upgrade, it is necessary to minimize the number of affected data blocks in the same storage volume, that is, it is necessary to distribute the data blocks in the same storage volume to different storage blocks as much as possible to ensure that the service provided by the storage volume can operate normally during the upgrade.

[0054] In the embodiments of the present application, the maximum number of data blocks belonging to the same storage volume that can be carried by the same storage block in the distributed system can be preset as the maximum carrying number (MaxVletsPerMz). The smaller the maximum carrying number, the greater the degree of dispersion of the data blocks in a storage volume to different storage blocks. Therefore, when creating a storage volume, the control node (Center module) reads MaxVletsPerMz, which sets the maximum number of data blocks among multiple data blocks in a storage volume that are allowed to appear in the same storage block. Generally, the maximum carrying number is set to 1 or 2, that is, at most 1 or 2 data blocks belonging to the same storage volume are carried in the same storage block. When MaxVletsPerMz is 1, the storage blocks are upgraded sequentially, and at most only one data block in a storage volume will be affected. At this time, the availability of the storage volume is the highest.

[0055] After determining the number N of data blocks, under the premise of meeting the maximum carrying number requirement, the target storage nodes are determined from M storage blocks to carry these N data blocks. Among them, the capacity sizes of the data blocks in the same storage volume are the same. The capacity size of the data block identifies the size of the storage space that needs to be divided in the storage node for carrying the data block. In different application scenarios, the capacity size of the data block can be set according to specific application requirements, and no limitation is made here. In the same application scenario, the sizes of the data blocks between different storage volumes can be the same or different.

[0056] Thus, in the distributed system, when the storage blocks are upgraded sequentially, the number of data blocks in the same storage volume affected by the upgrade of the storage block does not exceed the maximum carrying number, reducing the impact of the upgrade process on the data blocks in the storage volume, and thus reducing the impact on the business services provided by the storage volume.

[0057] The storage machine corresponding to the storage node is usually configured with a disk. The disk is a storage medium for providing data storage functions. Therefore, in practical applications, the storage node can use the disk to carry data blocks, that is, the storage space corresponding to the disk is divided, and a storage space with the same capacity size as the data block is divided as the data block of the storage volume. Among them, the disks in the embodiments of the present application can include various types, for example, they can include floppy disks and hard disks. In the case of a hard disk, it can specifically be a mechanical hard disk, a solid-state hard disk, etc.

[0058] If the storage machine corresponding to any storage node in the distributed system is configured with at least one disk (Disk) for carrying the data blocks of the storage volume, then in a possible implementation, the space occupancy rate of each disk in the distributed system can be calculated first.

[0059] Among them, the space occupancy rate refers to the proportion of the storage space corresponding to the data blocks carried by a disk in the total storage space of the disk. In the case where the data block sizes are the same in the application scenario, it is expressed by the mathematical formula: the space occupancy rate f of the disk = (the number n of the carried data blocks * the storage space size corresponding to each data block) / the total storage space of the disk. The space occupancy rate indicates the degree to which the storage space of the disk is occupied. The larger the space occupancy rate, the less available remaining space in the disk. The smaller the space occupancy rate, the more available remaining space in the disk.

[0060] Then, N target disks can be determined from the distributed system according to the space occupancy rate of the disks to carry N data blocks. Among them, a storage node can be configured with one disk or multiple disks. The number of disks configured in the storage node does not affect the ability to perform continuous write operations during service upgrade. In the embodiments of the present application, one data block is carried by one disk to reduce the management cost of the storage space in the distributed system. In practical applications, a data block can also be carried by multiple disks, and continuous write operations can also be achieved during the upgrade process.

[0061] Since the capacity of the data block has a certain size, the capacity size of the data block is usually set to 16G. Therefore, during the process of determining the target disk, it is necessary to consider whether the disk has the ability to carry the data block, that is, whether the disk has enough remaining space to carry the data block.

[0062] In practical applications, the remaining space of the disk can be calculated according to the space occupancy rate of the disk. Then, the disks with the remaining space larger than the data block capacity are traversed. If the currently traversed disk meets the carrying condition, the disk is added to the disk set. When the total number of disks in the disk set reaches N, the traversal stops, and the disks in the disk set are used as the target disks.

[0063] Among them, the carrying condition includes that the number of disks in the same storage block in the disk set is less than or equal to the maximum carrying number, that is, the total number of disks that the currently traversed disk belongs to the same storage block as the disks in the disk set does not exceed the maximum carrying number.

[0064] In the method for determining the target disk provided above, the remaining space of each disk in the disk set is greater than the capacity of the data block. Therefore, the disks added to the disk set have the ability to carry the data block. If the total number of disks in the disk set reaches N before traversing all the disks in the system, it means that the system has sufficient remaining space and a storage volume can be successfully generated based on the N target disks added to the disk set. If the total number of disks in the disk set has not reached N after traversing all the disks in the system, it means that the remaining space of the system is not enough to carry N data blocks, that is, the generation of the storage volume fails, and a generation failure message can be returned for prompting.

[0065] Since the remaining space of each disk in the disk set is greater than the capacity of the data block, when the total number of disks in the disk set reaches N, the N disks in the disk set can be used as target disks to carry the data block and generate a storage volume.

[0066] In a possible implementation, the disks in the distributed system can be sorted in ascending order of space occupancy rate. The result of the disk sorting can be represented by the list DISK_LIST, and DISK_LIST[i] represents the disk with the i-th smallest space occupancy rate, where i starts from 1. Then, the disks are traversed in the sorted order, that is, starting from DISK_LIST[1] and traversing in the order of DISK_LIST. If the currently traversed disk meets the above-mentioned carrying conditions, the disk is added to the disk set. Among them, the disk set can be represented by SELECTED_DISK_LIST, and SELECTED_DISK_LIST[j] represents the j-th disk added to the disk set. The traversal stops when the total number of disks in the disk set reaches N, and the N disks in the disk set are used as N target disks.

[0067] For example, in Figure 1 the scenario shown, if each storage node is configured with one disk, then Figure 1 the distributed system shown is configured with 10 disks, and the number of disks corresponding to each storage block is 2. When the maximum carrying number is set to 1, the carrying condition is that the number of disks in the same storage block in the disk set is 1.

[0068] In the process of determining the target disks, first calculate the space occupancy rate of each of the 10 disks. Then, sort these 10 disks in ascending order of space occupancy rate. The result of the disk sorting, DISK_LIST, is: Disk 1, Disk 2, …, Disk 10. Then, starting from Disk 1, traverse them in the sorted order. Since the disk set SELECTED_DISK_LIST is empty at this moment, Disk 1 meets the hosting condition, so Disk 1 is added to SELECTED_DISK_LIST. Then, for the second disk in DISK_LIST, that is, Disk 2, determine whether Disk 2 meets the hosting condition. If Disk 2 and Disk 1 are in the same storage block, since the maximum hosting number is set to 1, Disk 2 does not meet the hosting condition. Continue with the third disk in DISK_LIST, that is, Disk 3. Determine that Disk 3 meets the hosting condition, then add Disk 3 to SELECTED_DISK_LIST. Similarly, if Disk 4 meets the hosting condition, add Disk 4 to SELECTED_DISK_LIST. At this time, the total number of disks in SELECTED_DISK_LIST is 3. Stop the traversal, and use Disk 1, Disk 3, and Disk 4 as the target disks to host 3 data blocks.

[0069] For the target disks determined by the above traversal method in ascending order of space occupancy rate, compared with other unselected disks in the distributed system, the space occupancy rate of the disks is relatively small. That is to say, through the above method, N disks with relatively small space occupancy rates in the system are selected as target disks to host data blocks, improving the disk space occupancy rate in the distributed system and the utilization rate of storage resources in the distributed system.

[0070] Since the target disks are the disks with relatively small space occupancy rates in the distributed system, therefore, for each generated storage volume, the remaining space of the disks with relatively small space occupancy rates in the system is fully utilized, improving the space occupancy rate of the disks with originally relatively small space occupancy rates and narrowing the difference in space occupancy rates between the disks with relatively small space occupancy rates and the disks with relatively large space occupancy rates in the system. After generating multiple storage volumes in this way, the space occupancy rates among different disks in the system can be kept relatively balanced.

[0071] In addition, since the disks are configured in different storage nodes, based on the above method of generating storage volumes, the utilization rates of the storage spaces corresponding to different storage nodes in the distributed system can reach relative balance. Moreover, the storage spaces corresponding to the storage nodes are managed by storage blocks, so the utilization rates of the storage spaces between different storage blocks can also reach relative balance.

[0072] Based on the above, it is necessary to ensure that the block capacities in different storage blocks are relatively balanced to avoid the situation where the storage space in the storage block with a smaller block capacity is used up while there is still remaining space in the storage block with a larger block capacity, so as to improve the utilization rate of system resources.

[0073] Since the disk set is traversed in ascending order of space occupancy rate, the space occupancy rate of the Nth disk added to the disk set is the largest in the disk set. In the actual application process, the size relationship between the remaining storage space of the Nth disk and the capacity of the data block can be determined according to the space occupancy rate of the Nth disk added to the disk set. If the remaining storage space of the Nth disk is not less than the capacity of the data block, it indicates that the remaining storage spaces of all disks in the disk set are greater than the capacity of the data block, which means that all disks in the disk set can carry the data block. Therefore, the disks in this disk set can be determined as target disks for carrying the data blocks of the storage volume.

[0074] If the remaining storage space of the Nth disk is less than the capacity of the data block, it means that the remaining storage space of the Nth disk is not enough to carry the data block. On the premise of ensuring non-stop write upgrade, the remaining storage space of the disks in the distributed system is not enough to generate a storage volume, that is, the task of generating a storage volume fails, and a prompt message indicating the generation failure is returned.

[0075] Since the order of disk addition to the disk set indicates the ascending order of the space occupancy rates corresponding to the disks in the disk set, when the Nth disk added to the disk set has the ability to carry the data block, the N disks in the disk set can be used as target disks for carrying the data block and generating a storage volume.

[0076] In another implementation manner of determining the target disk, the bearing condition may further include that the number of disks belonging to the same storage node in the disk set is 1. That is to say, it is avoided that two disks of the same storage node are both in the disk set. Based on this, the maximum number of data blocks carried by the same storage node for the storage volume generated according to the disks in the disk set is 1. When a storage node fails, at most 1 data block is affected, thus bringing the single-machine disaster tolerance feature to the storage volume and providing a guarantee for the normal service of the storage volume.

[0077] S203: Generate the storage volume according to the target storage node.

[0078] After determining the target storage node, the target storage node can be used to carry N data blocks, and the N data blocks can be used to generate a storage volume. Among them, the process of a storage node carrying a data block is to divide the storage space in the storage node to divide out a storage space corresponding to the capacity of the data block as the data block of the storage volume.

[0079] Based on the above S202, if N target disks for carrying data blocks are determined, in a possible implementation manner, continuous storage spaces can be respectively allocated from the N target disks as data blocks for generating a storage volume. Among them, the size of the continuous storage space is identified by the data block and corresponds to the capacity size of the data block.

[0080] Since the data blocks of the storage volume require data records and management of the corresponding storage address space, therefore, allocating the continuous storage space as data blocks can reduce the management cost of the storage space in the distributed system.

[0081] Based on the above method for generating a storage volume, when the distributed system needs to be upgraded, the storage block can be used as the upgrade unit, so that at most only the maximum number of data blocks that the storage volume can carry will be affected by the upgrade of the storage block where they are located, rather than all data blocks being affected by the upgrade as in the related art. Therefore, it may not affect the business services provided by the storage volume. This way of generating a storage volume makes it possible to keep writing without interruption when the distributed system is upgraded under the premise of zoning management of the distributed system, laying a foundation for the upgrade without interruption and improving the service reliability of the distributed system.

[0082] In addition, for all storage nodes within the same storage block, they can be upgraded concurrently. As the number of storage nodes connected to the distributed system continues to increase, that is, as the cluster scale continues to expand, the total upgrade time of the cluster will not increase accordingly. Compared with the method of upgrading each single machine one by one, the method of upgrading in units of storage blocks realizes the upgrade without interruption while also reducing the total time consumption for completing the cluster upgrade.

[0083] The above embodiments provide a method for generating a storage volume in a distributed system. In this method, in a distributed system, M storage blocks are used to manage the partitioning of storage nodes in the distributed system. For N data blocks of the storage volume to be generated, target storage nodes are determined from the M storage blocks, and then the target storage nodes are used to carry the N data blocks to generate the storage volume. Since the maximum carrying capacity less than N limits the number of data blocks carried by the same storage block to be less than or equal to the maximum carrying capacity when a storage node carries the N data blocks included in the storage volume, the N storage blocks will be allocated to target storage nodes located in different storage blocks. Thus, when the distributed system is upgraded, if the upgrade is performed in the order of storage blocks, at most only a part of the data blocks of the storage volume will be affected by the upgrade of the storage block where they are located, rather than all data blocks being affected by the upgrade as in the related art. Therefore, it is possible that the business services provided by the storage volume will not be affected. This way of generating a storage volume makes it possible to avoid stopping writing during the upgrade of the distributed system on the premise of partitioning management of the distributed system, laying a foundation for the non-stop writing upgrade and improving the service reliability of the distributed system.

[0084] In a possible application scenario, for the method for generating a storage volume in the distributed system provided by the above embodiments, the distributed system obtains a storage object corresponding to the storage volume and triggers the generation work of the storage volume. After generating the storage volume in the above manner, N copies of data generated by encoding the storage object are respectively stored in the N data blocks of the storage volume. Among them, one data block stores one copy of data. A storage object refers to a file to be stored, and the system can perform read, write, and delete operations in units of storage objects. For example, the storage object can be a Blob.

[0085] In a possible way, for the above process of encoding the storage object, erasure code (EC) calculation can be performed on the storage object to generate N copies of data. Specifically, when the distributed system obtains a Blob, the Blob is sliced into K data slices, and N - K parity data are calculated through the EC algorithm, totaling N copies of data. These N copies of data are respectively stored in the N data blocks of the storage volume. Therefore, among the N data blocks, there are K data blocks for storing business data and N - K data blocks for storing parity data, where the parity data is used for redundant verification of the business data.

[0086] Based on the above S201, the KN value corresponding to the EC determines the number of data blocks N of a storage volume. Among them, K represents the number of business data copies, that is, the number of data blocks used to store business data is K; N represents the total number of encoded data copies, then N - K represents the number of parity data copies, that is, the number of data blocks used to store parity data is N - K. For example, the EC of K15N20 means that 15 data blocks are required to store business data blocks, and 5 data blocks are required to store parity data, that is, 1 storage volume needs to include 20 data blocks.

[0087] There is a certain connection between the KN value of the EC and data security. For example, when the KN value is K15N20, the corresponding replication factor is 1.33, the data storage cost is relatively low, and the data security is also relatively low; when the KN value is K9N18, the corresponding replication factor is 2, the data storage cost is relatively high, and the data security is also relatively high. In the actual application process, the KN value of the EC can be set according to the specific business scenario, and no specific limitation is made here.

[0088] Since multiple data blocks of a storage volume are evenly distributed in different storage blocks, when the system provides storage services for storage objects through the storage volume, multiple copies of data are stored in multiple data blocks of different storage blocks. When a storage node or a storage block fails, at most no more than the maximum number of data blocks carried are affected, that is, the number of lost data copies does not exceed the maximum number of data blocks carried, which provides a guarantee for the normal service of the storage volume and improves the reliability of the system.

[0089] For the sake of easy understanding, the following combines Figure 3 the application scenario shown to introduce the method for generating a storage volume in the distributed system provided in the above embodiment.

[0090] In Figure 3 the application scenario shown, the distributed system includes 400 storage nodes, which are divided into 40 storage blocks. Each storage node is configured with 12 disks, and the maximum number of data blocks carried is 1. If the EC of K9N18 is used to store a Blob, the storage volume to be generated includes 18 data blocks.

[0091] In the process of selecting 18 data blocks, first calculate the space occupancy rate of each disk in the system, and then traverse in ascending order of the space occupancy rate. If the traversed disk does not belong to the same storage block and the same storage node as the disks in the disk set, then add the traversed disk to the disk set until the total number of the disk set reaches 18, and stop traversing.

[0092] Furthermore, if the remaining space of the 18th disk added to the disk set is greater than the capacity of the data block, then the 18 disks in the disk set are used as target disks, and the 18 data blocks are carried by these 18 target disks to generate a storage volume for storing 18 copies of data corresponding to the Blob. Among them, 9 data blocks are used to store service data, and 9 data blocks are used to store check data.

[0093] Since the multiple data blocks for generating the storage volume are evenly distributed in different storage blocks, therefore, the multiple copies of data corresponding to the same storage object are also evenly stored in multiple storage blocks by using this storage volume. Therefore, when upgrading by storage block, the number of affected data blocks does not exceed the maximum carrying capacity, that is, the number of affected data copies does not exceed the maximum carrying capacity, which will not affect the normal operation of the service, achieving the purpose of upgrading without stopping writing.

[0094] For the method provided above, the embodiment of the present application also provides a device for generating a storage volume in a distributed system.

[0095] See Figure 4 , Figure 4 which is a schematic structural diagram of a device for generating a storage volume in a distributed system provided by the embodiment of the present application. As Figure 4 shown, the storage nodes included in the distributed system are divided into M storage blocks, and this generating device 400 includes a determining unit 401 and a generating unit 402:

[0096] The determining unit 401 is used to determine N data blocks included in the storage volume to be generated, where M > N;

[0097] The determining unit 401 is further used to determine target storage nodes for carrying the N data blocks from the M storage blocks. Among the N data blocks, the number of data blocks carried by the same storage block is less than or equal to the maximum carrying capacity; the maximum carrying capacity is less than N;

[0098] The generating unit 402 is used to generate the storage volume according to the target storage nodes.

[0099] Among them, any storage node in the distributed system is configured with at least one disk; the determining unit 401 is used for:

[0100] Determine the space occupancy rate of the disks in the distributed system;

[0101] Determine N target disks for carrying the N data blocks from the distributed system according to the space occupancy rate;

[0102] Determine the storage nodes configured with the N target disks as the target storage nodes.

[0103] Among them, the determining unit 401 is configured to:

[0104] Traverse the disks of the distributed system in ascending order of the space occupancy rate;

[0105] If the traversed disk meets the bearing condition, add it to the disk set, and the bearing condition includes that the number of disks in the same storage block in the disk set is less than or equal to the maximum bearing number;

[0106] Stop the traversal when the total number of disks in the disk set reaches N, and determine the disks in the disk set as the target disks.

[0107] Among them, when the total number of disks in the disk set reaches N, the determining unit 401 is further configured to:

[0108] Determine the capacity size between the remaining space of the Nth disk and the data block according to the space occupancy rate of the Nth disk added to the disk set;

[0109] If the remaining space of the Nth disk is greater than or equal to the capacity of the data block, determine the disks in the disk set as the target disks.

[0110] It is characterized in that the bearing condition further includes that the number of disks belonging to the same storage node in the disk set is 1.

[0111] Among them, the generating unit 402 is configured to respectively allocate continuous storage spaces from the N target disks to generate the storage volume, and the size of the continuous storage space is identified by the data block.

[0112] Among them, the device further includes an upgrading unit:

[0113] The upgrading unit is configured to upgrade in sequence with the storage block as the upgrading unit when the distributed system is upgraded.

[0114] Among them, the device further includes an obtaining unit and a storage unit:

[0115] The obtaining unit is configured to obtain the storage object corresponding to the storage volume;

[0116] The storage unit is configured to respectively store N pieces of data generated by encoding the storage object into the N data blocks, where one data block stores one piece of data.

[0117] Among them, the N data blocks include K data blocks for storing service data and N - K data blocks for storing check data, and the check data is used for redundant check of the service data.

[0118] In the storage volume generation device of the distributed system provided in the above embodiment, in the distributed system, M storage blocks are used to partition and manage the storage nodes in the distributed system. For the N data blocks of the storage volume to be generated, the target storage nodes are determined from the M storage blocks, so that the target storage nodes are used to carry the N data blocks to generate the storage volume. Since the maximum carrying number less than N limits that when the storage node carries the N data blocks included in the storage volume, the number of data blocks carried by the same storage block is less than or equal to the maximum carrying number, the N storage blocks will be allocated to the target storage nodes located in different storage blocks. Thus, when the distributed system is upgraded, if the upgrade is performed in the order of storage blocks, at most only a part of the data blocks of the storage volume will be affected by the upgrade of the storage block where they are located, rather than all the data blocks being affected by the upgrade as in the related art. Therefore, it is possible that the business services provided by the storage volume will not be affected. This way of generating the storage volume makes it possible to keep writing during the upgrade of the distributed system on the premise of partitioning and managing the distributed system, laying a foundation for the non-stop writing upgrade and improving the service reliability of the distributed system.

[0119] The embodiment of the present application also provides a generation server for a storage volume in a distributed system. Next, the generation server for a storage volume in the distributed system provided by the embodiment of the present application will be introduced from the perspective of hardware implementation.

[0120] See Figure 5 , Figure 5 is a schematic structural diagram of a server provided by an embodiment of the present application. The server 1400 may vary greatly due to different configurations or performances, and may include one or more central processing units (CPUs) 1422 (for example, one or more processors) and a memory 1432, and one or more storage media 1430 (for example, one or more mass storage devices) for storing application programs 1442 or data 1444. Among them, the memory 1432 and the storage media 1430 may be transient storage or persistent storage. The program stored in the storage media 1430 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the server. Further, the central processing unit 1422 may be configured to communicate with the storage media 1430 and execute a series of instruction operations in the storage media 1430 on the server 1400.

[0121] Server 1400 may also include one or more power supplies 1426, one or more wired or wireless network interfaces 1450, one or more input / output interfaces 1458, and / or one or more operating systems 1441, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, and so on.

[0122] In the above embodiments, the steps performed by the server may be based on the Figure 5 server structure shown.

[0123] Wherein, if the storage nodes included in the distributed system are divided into M storage blocks, the CPU 1422 is used to perform the following steps:

[0124] Determine N data blocks included in the storage volume to be generated, where M > N;

[0125] Determine target storage nodes for carrying the N data blocks from the M storage blocks. Among the N data blocks, the number of data blocks carried by the same storage block is less than or equal to the maximum carrying number; the maximum carrying number is less than N;

[0126] Generate the storage volume according to the target storage nodes.

[0127] Optionally, the CPU 1422 may also execute the method steps of any specific implementation manner of the method for generating a storage volume in the distributed system in the embodiments of the present application.

[0128] The embodiments of the present application also provide a computer-readable storage medium for storing a computer program, and the computer program is used to execute the method for generating a storage volume in the distributed system provided in the above embodiments.

[0129] Those of ordinary skill in the art can understand that all or part of the steps of implementing the above method embodiments can be completed by hardware related to program instructions. The foregoing program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps including the above method embodiments; and the foregoing storage medium may be at least one of the following media: read-only memory (English: read-only memory, abbreviation: ROM), RAM, magnetic disk, or optical disc, etc., various media that can store program codes.

[0130] It should be noted that the various embodiments in this specification are described in a progressive manner. For the parts that are the same or similar among the embodiments, reference can be made to each other, and the key point of each embodiment is to illustrate the differences from other embodiments. In particular, for the device and system embodiments, since they are basically similar to the method embodiments, they are described relatively simply, and reference can be made to the corresponding parts of the method embodiments for the relevant content. The device and system embodiments described above are only illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art can understand and implement it without creative efforts.

[0131] As described above, this is only a specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by those skilled in the art within the technical scope disclosed by the present application should be covered by the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A method for generating a storage volume in a distributed system, characterized in that The storage nodes included in the distributed system are divided into M storage blocks, and any storage node in the distributed system is configured with at least one disk; the method includes: Determine N data blocks included in the storage volume to be generated, where M > N; Determine the space occupancy rate of the disks in the distributed system; Traverse the disks in the distributed system in ascending order of the space occupancy rate; If the traversed disk meets the bearing condition, add it to the disk set, and the bearing condition includes that the number of disks in the same storage block in the disk set is less than or equal to the maximum bearing number; Stop the traversal when the total number of disks in the disk set reaches N, and determine the N disks in the disk set as the N target disks for bearing the N data blocks; Determine the storage nodes configured with the N target disks as the target storage nodes for bearing the N data blocks. Among the N data blocks, the number of data blocks borne by the same storage block is less than or equal to the maximum bearing number; the maximum bearing number is used to identify the maximum number of data blocks belonging to the same storage volume that a storage block can bear; the maximum bearing number is less than N Generate the storage volume according to the target storage nodes.

2. The method according to claim 1, characterized in that, When the total number of disks in the disk set reaches N, the method further includes: Determine the capacity size between the remaining space of the Nth disk and the data block according to the space occupancy rate of the Nth disk added to the disk set; If the remaining space of the Nth disk is greater than or equal to the capacity of the data block, execute the step of determining the N disks in the disk set as the N target disks for bearing the N data blocks.

3. The method according to claim 1, wherein The bearing condition further includes that the number of disks belonging to the same storage node in the disk set is 1.

4. The method according to claim 1, wherein The generating the storage volume according to the target storage nodes includes: Respectively allocate continuous storage spaces from the N target disks for generating the storage volume, and the size of the continuous storage space is identified by the data block.

5. The method according to any one of claims 1-4, characterized in that, The method further includes: When the distributed system is upgraded, upgrade it in sequence with the storage block as the upgrade unit.

6. The method according to any one of claims 1-4, characterized in that The method further includes: Obtain the storage object corresponding to the storage volume; Store the N pieces of data generated by encoding through the storage object into the N data blocks respectively, where one data block stores one piece of data.

7. The method according to any one of claims 1-4, characterized in that, The N data blocks include K data blocks for storing service data and N - K data blocks for storing check data, and the check data is used for redundant check of the service data.

8. A generating device for a storage volume in a distributed system, characterized in that The storage nodes included in the distributed system are divided into M storage blocks, and any storage node in the distributed system is configured with at least one disk; the apparatus includes a determination unit and a generation unit: The determination unit is configured to determine N data blocks included in the storage volume to be generated, where M > N; The determining unit is further configured to determine the space occupancy rate of the disks in the distributed system; traverse the disks in the distributed system in ascending order of the space occupancy rate; if the traversed disk meets the carrying condition, add it to the disk set, where the carrying condition includes that the number of disks in the same storage block in the disk set is less than or equal to the maximum carrying number; When the total number of disks in the disk set reaches N, stop the traversal, and determine the N disks in the disk set as the N target disks for carrying the N data blocks; Determine the storage node configured with the N target disks as the target storage node for carrying the N data blocks, and in the N data blocks, the number of data blocks carried by the same storage block is less than or equal to the maximum carrying number; The maximum carrying number is used to identify the maximum number of data blocks belonging to the same storage volume that a storage block can carry; The maximum carrying number is less than N; The generating unit is configured to generate the storage volume according to the target storage node.

9. The device according to claim 8, characterized in that, When the total number of disks in the disk set reaches N, the determining unit is further configured to: Determine the capacity size between the remaining space of the Nth disk and the data block according to the space occupancy rate of the Nth disk added to the disk set; If the remaining space of the Nth disk is greater than or equal to the capacity of the data block, perform the step of determining the N disks in the disk set as the N target disks for carrying the N data blocks.

10. The device according to claim 8, characterized in that, The carrying condition further includes that the number of disks belonging to the same storage node in the disk set is 1.

11. The device according to claim 8, characterized in that, The generating unit is configured to respectively allocate continuous storage spaces from the N target disks for generating the storage volume, and the size of the continuous storage space is identified by the data block.

12. The device according to any one of claims 8-11, characterized in that, The apparatus further includes: An upgrading unit, configured to upgrade the distributed system block by block in sequence when the distributed system is upgraded.

13. The device according to any one of claims 8-11, characterized in that, The apparatus further includes: An obtaining unit, configured to obtain the storage object corresponding to the storage volume; A storage unit, configured to respectively store the N pieces of data generated by encoding through the storage object into the N data blocks, where one data block stores one piece of data.

14. The device according to any one of claims 8-11, characterized in that, The N data blocks include K data blocks for storing service data and N - K data blocks for storing check data, and the check data is used for redundant check of the service data.

15. A generating device for a storage volume in a distributed system, characterized in that, The device includes a processor and a memory: The memory is configured to store program codes and transmit the program codes to the processor; The processor is configured to execute the method according to any one of claims 1 - 7 based on the instructions in the program codes.

16. A computer-readable storage medium, characterized in that, The computer-readable storage medium is configured to store a computer program, and the computer program is configured to execute the method according to any one of claims 1 - 7.

Citation Information

Patent Citations

  • Data distribution method, data storage method, and relevant device and system

    CN104932953A