Detailed Description
The embodiment of the invention provides a distributed storage method, and also provides a corresponding distributed storage device and a distributed storage system. The following are detailed below.
Referring to fig. 1, an embodiment of the present invention provides a distributed storage method, which specifically includes:
101. cutting the physical storage space of all storage nodes into at least two physical blocks, and mapping the set of all the physical blocks into a logical storage resource pool;
at present, the process of allocating physical storage space for logical volumes by a storage system is static, when a logical volume is created, physical storage space is allocated for each logical volume, and if the physical storage space can be allocated as required by adopting a dynamic method, the utilization rate of the physical storage space will be greatly improved, so that the capacity of the storage system is increased without increasing the cost. The storage system must be virtualized to use a dynamic, on-demand allocation approach.
The first step of the storage virtualization performed by the embodiment of the present invention is: the physical storage space of all the storage nodes is cut into at least two physical blocks, and the set of all the physical blocks is mapped into a logical storage resource pool, so that the difference between the storage nodes is shielded, and a uniform storage resource pool is constructed.
It should be noted that the aforementioned "physical storage space of all storage nodes" refers to a total physical storage space formed by the physical storage space of each storage node in a unified manner.
The specific process of constructing the storage resource pool may be as follows: the physical storage space of all storage nodes is divided into at least two physical blocks, the physical blocks are mapped into logical blocks, and the logical blocks are organized by a data structure, so that a logical storage resource pool can be constructed. The storage system divides the physical storage space of all the storage nodes into at least two physical blocks, which may specifically be: dividing physical storage spaces of all storage nodes into at least two physical blocks with different sizes; or in order to increase the processing speed of building the storage resource pool, the physical storage space of all the storage nodes is divided into at least two equal-sized physical blocks, for example, the physical storage space of 1TB is divided into 1000 physical blocks of 1GB, 1000 logical blocks are in the built storage resource pool, and when resources need to be used, the logical blocks are selected from the storage resource pool to be used.
102. Establishing a virtual volume on a storage resource pool, and establishing a mapping relation between each virtual block in the virtual volume and a logic block in the storage resource pool;
the second step of the storage virtualization performed by the embodiment of the present invention is: virtual volumes of the storage system are established on the storage resource pool, and each virtual block in the virtual volume has a mapping relation with the logic block in the storage resource pool.
A mapping table between a virtual volume and a logical volume is established, the mapping table represents the mapping relation from virtual blocks to logical blocks (blocks in a storage pool), but physical storage space is not allocated, the virtual volume is established so that the storage system does not provide physical storage space for each client in advance when the storage system is not stored, and the physical storage space provided by the storage system seen by each client is actually a virtual disk established on the virtual volume.
103. Storing each object into a storage resource pool, creating a mapping relation between each object and a logical block of the storage resource pool, and distributing a physical block to each logical block having the mapping relation with the object according to the capacity of each object;
when one client of a plurality of clients stores data on a virtual volume, the data is divided into at least two objects, each object is stored in a storage resource pool, a mapping relation between each object and a logical block of the storage resource pool is established, and a physical block is distributed to each logical block which has the mapping relation with the object according to the capacity of each object.
The mode of allocating the physical blocks to the logical blocks enables the physical storage space to be allocated only when the physical storage space is used, the storage system can dynamically and flexibly allocate the physical storage space according to the physical storage space required by a user, the allocated physical storage space is not fixed and constant, the utilization rate of the physical storage space is improved, and the mode of allocating the physical blocks to the logical blocks also enables the user to avoid purchasing temporarily-unnecessary storage equipment, so that the budget expenditure spent by the user for purchasing the temporarily-unnecessary space and the management expenditure for managing the temporarily-unnecessary space are greatly saved; meanwhile, the reduction of the number of the storage devices also enables the storage system to be more environment-friendly.
In this step, creating a mapping relationship between each object and a logical block of the storage resource pool may specifically be: dividing the object into equal granularity, such as 8KB, establishing a mapping table, wherein each 8KB corresponds to an entry of the mapping table, and recording the mapping of the 8KB to a certain 8KB of data on a certain logical block of the storage resource pool, for example, data of the object 1 from 8K to 16KB is stored on the 3 rd 8KB of the logical block 2 of the storage resource pool.
104. The mapping relationship created for each object to the logical blocks of the storage resource pool is stored.
The storage system stores the mapping relationship with the logical blocks of the storage resource pool created for each object in step 103, and each operation on data needs to acquire the mapping relationship with the logical blocks of the storage resource pool created for each object.
Alternatively, the storage system may store the mapping created for each object with the logical blocks of the storage resource pool in the storage resource pool, that is, store the mapping created for each object with the logical blocks of the storage resource pool with each object.
Or, optionally, the storage system may further store the mapping relationship created for each object with the logical blocks of the storage resource pool, where the storing independently refers to storing the mapping relationship created for each object with the logical blocks of the storage resource pool and the data in different physical storage spaces, so as to cause the logical view and the physical view of the data to be separated, and when the storage system stores the mapping relationship created for each object with the logical blocks of the storage resource pool and each object together, each operation on the data needs to obtain the mapping relationship created for each object with the logical blocks of the storage resource pool. When the operation frequently occurs, the operation becomes a bottleneck of the whole storage system, the expansibility of the storage system is limited, the storage system independently stores the mapping relationship with the logical blocks of the storage resource pool created for each object, and the expandability of the storage system can be solved by increasing the storage space for independently storing the mapping relationship with the logical blocks of the storage resource pool created for each object, and the specific implementation mode can be as follows: and storing the mapping relation with the logical blocks of the storage resource pool created for each object in another storage system or a logical volume of the same storage system independent from the storage resource pool.
In this embodiment, the object is stored in the resource storage pool, and the physical storage space is allocated to the resource storage pool only when the object is stored, so that the physical storage space can be dynamically and flexibly allocated according to the physical storage space required by the user, and the utilization rate of the physical storage space is improved.
In the above embodiment, when the client accesses data, the operating system in the storage system may obtain, according to the mapping relationship created for each object of the data and the logical block of the storage resource pool, that each object of the data is located at a specific position of the storage resource pool, so as to read the data.
In the above embodiment, the Storage node may be a Storage Device in a Storage Area Network (SAN) array, where the Storage Device in the SAN array is an intelligent Device, and may also be referred to as an Object-based Storage Device (OSD), each OSD has its own Storage medium, processor, memory, and network system, and provides an OSD Object interface, so that in a process of reading and writing data, the Storage node may directly communicate with a client through the OSD Object interface, and independently store a mapping relationship created for each Object and a logical block of a Storage resource pool in a Metadata Server (MDS). The mapping relation between each object and the logical block of the storage resource pool is metadata, and the metadata server provides a logical view of data for the client, including directory composition, OSD corresponding to each data, and the like. In a conventional SAN array, metadata is maintained by a file server in the SAN array, and each operation on the data acquires the metadata. When operations occur frequently, metadata operations become a bottleneck in the overall storage system, limiting performance expansion. However, when the storage device in the SAN array is OSD and an OSD object interface is provided for the outside, since each operation only has one access to the metadata, and the specific data transmission is performed by the direct connection between the OSD and the client, the operation of the metadata is greatly reduced, the burden of the metadata server is reduced, and the problem of the extensibility of the SAN array is solved by adding the metadata server.
It should be noted that the storage node may also be a Network Attached Storage (NAS).
Referring to fig. 2, an embodiment of a distributed storage apparatus is further provided, and the distributed storage apparatus 20 in this embodiment can be applied to the above embodiment, and executes the method in the above embodiment.
The distributed storage apparatus 20 in the present embodiment includes:
a storage resource pool unit 201 is constructed, configured to cut the physical storage space of all the storage nodes into at least two physical blocks, and map a set of all the physical blocks into a logical storage resource pool;
a virtual volume establishing unit 202, configured to establish a virtual volume on a storage resource pool;
a physical storage space allocation unit 203, configured to, when a client stores data on a virtual volume, divide the data into at least two objects, write each object into a storage resource pool, create a mapping relationship with a logical block of the storage resource pool for each object, and allocate a physical block to the logical block having a mapping relationship with each object according to a capacity of each object;
a storage mapping unit 204, configured to store the mapping relationship created for each object with the logical blocks of the storage resource pool.
Optionally, the storage mapping relationship unit 204 is specifically configured to store mapping relationships created for each object and logical blocks of the storage resource pool independently.
Optionally, the storage mapping relationship unit 204 is specifically configured to store the mapping relationship created for each object with the logical block of the storage resource pool in another storage system or a logical volume of the storage system that is independent from the storage resource pool.
Optionally, the storage resource pool building unit 201 is specifically configured to cut the physical storage space of all the storage nodes into at least two physical blocks with equal size, map each physical block into a logical block, and organize all the logical blocks by using a data structure to build a logical storage resource pool.
In this embodiment, the storage node may be a storage device in a storage area network SAN array, and the storage device in the SAN array is an Object-based storage device (OSD) and provides an OSD Object interface to the outside.
In this embodiment, the unit 203 for allocating physical storage space stores the object in the resource storage pool, and the physical storage space is allocated to the resource storage pool only when the object is stored, so that the physical storage space can be dynamically and flexibly allocated according to the physical storage space required by the user, thereby improving the utilization rate of the physical storage space.
Referring to fig. 3, an embodiment of a distributed storage system is further provided, and the distributed storage system in this embodiment may be applied to the above embodiment, and execute the method in the above embodiment.
The distributed storage system in the present embodiment includes: at least one client 301, at least one storage node 302, and distributed storage 303;
the distributed storage apparatus 303 in the present embodiment is the same as the distributed storage apparatus 20 in the above-described embodiment.
Optionally, the distributed storage system further includes a metadata server 304, and the metadata server 304 is configured to independently store the mapping relationship, created by the distributed storage apparatus 304 for each object, with the logical blocks of the storage resource pool.
In the distributed storage system provided in this embodiment, the number of the metadata servers 304 may be at least one, so that the problem of scalability of the distributed storage system can be solved. The metadata server 304 and the storage nodes in the distributed storage 303 are independent of each other.
Optionally, the storage node 302 is specifically a storage device in a storage area network SAN array, and the storage device in the SAN array is an object-based storage device OSD and provides an OSD object interface to the outside, in this application scenario, the metadata server 304 provides a logical view of data for the client, including a directory structure, an OSD corresponding to each data, and the like, when the client 301 accesses an object, first sends a request to the metadata server 304, and the metadata server 304 sends information, such as a specific position where the object is located in the storage resource pool, to the client 301 according to metadata reflecting a mapping relationship between the object and a logical block; thereafter, according to the specific location of the object in the storage resource pool, the client 301 directly sends a request for reading and writing data to the storage node 302 storing the object without interaction with the metadata server 304.
Network connections are an important component of storage systems. It connects client 301, metadata server 304, and storage node 302. The continuous progress of network technology has made more choices for the way network connections are made. The gigabit Ethernet has the advantages of high performance, high cost performance, easy management and the like, thereby being the first choice for constructing the storage system. With the maturity of the fiber channel technology and the reduction of the cost, the application is more and more extensive. In addition, various new network technologies are continuously emerging, such as Myrinet, Infiniband, etc., which have high performance. In particular, Infiniband, has been increasingly competitive due to its extended capabilities.
In this embodiment, the distributed storage apparatus 303 may store the object in the resource storage pool, and the physical storage space is allocated to the resource storage pool only when the object is stored, so that the physical storage space can be dynamically and flexibly allocated according to the physical storage space required by the user, thereby improving the utilization rate of the physical storage space.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by associated hardware instructed by a program, which may be stored in a computer-readable storage medium, and the storage medium may include: ROM, RAM, magnetic or optical disks, and the like.
The distributed storage method, the distributed storage apparatus, and the distributed storage system provided in the embodiments of the present invention are described in detail above, and a specific example is applied in this document to explain the principle and the implementation of the present invention, and the description of the above embodiments is only used to help understanding the method and the core idea of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.