A distributed file system
By introducing a metadata service module, a data storage service module, a garbage collection service module, and an access service module into the distributed file system, and combining hash calculation and a heartbeat mechanism, the problem of high metadata management complexity in existing technologies is solved. Random write performance is basically on par with sequential write performance, reducing system complexity and improving write performance.
Patent Information
- Application Number
- CN202210798979.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-08
- Publication Date
- 2026-01-09
- Estimated Expiration
- 2042-07-08
AI Technical Summary
Existing distributed file systems suffer from high complexity and difficulty in metadata management and write performance, especially in the process of converting metadata into a specified disk location for writing, which is complex and inefficient.
A distributed file system is designed, including a metadata service module, a data storage service module, a garbage collection service module, and an access service module. Through hash calculation and heartbeat mechanism, it supports append writes to the underlying layer. Metadata management and IO scheduling are handled by the upper layer, while the underlying layer only supports sequential writes and supports network file system protocols.
It provides random write capability on append-only storage systems, reducing system complexity, reducing IO amplification, improving write performance, and eliminating the need for upper-layer logic to worry about underlying data migration in the event of node failure, thus simplifying maintenance.
Smart Images

Figure CN115391303B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data storage, and more particularly to a distributed file system. BACKGROUND
[0002] With the development of society, people's Internet life becomes more and more rich, which brings great challenges to information storage. Therefore, it is particularly important to design a distributed file system with large capacity, high availability, high reliability, high performance, scalability and easy maintenance. The distributed storage system stores user data on different nodes by providing a unified interface to the user and can maintain metadata. The user only needs to access the distributed file system as accessing the local file system.
[0003] The main management method of the disk data of each node in the existing distributed file system is to directly manage the bare disk, maintain the metadata of the disk itself, find the corresponding metadata according to the content of the IO request when receiving the IO request sent by the upper layer, and finally convert it into a read or write to a specified location of the disk.
[0004] However, the existing distributed system needs to manage the metadata in the file, and the writing performance is poor. In the process of converting the metadata into a write to a specified location of the disk, the distributed file system is complex to implement and difficult to maintain. SUMMARY
[0005] Therefore, the present application discloses a distributed file system to provide random write capability on an append write storage system, thus reducing the complexity and IO amplification. The upper layer is responsible for implementing the metadata management of the user file, the retrieval of the file index and the IO scheduling, providing the user with the random write capability of the file, and supporting the network file system protocol. The upper layer logic does not need to care about the migration of the underlying data, thus reducing the maintenance difficulty.
[0006] A distributed file system comprises a metadata service module, a data storage service module, a garbage collection service module and an access service module. The metadata service module is connected with the data storage service module, the garbage collection service module and the access service module. The access service module is connected with the data storage service module.
[0007] The metadata service module is used to provide metadata services of the entire file system, form a preset fixed number of metadata service clusters through a consistency protocol and ensure consistency, and receive heartbeats sent by the data storage service module, the garbage collection service module and the access service module to represent the working state.
[0008] The data storage service module is configured to provide random read / write capability for data slots with any IO size, wherein each data slot mapped by the data storage service module is uniformly distributed.
[0009] The garbage collection service module is configured to be responsible for garbage collection of index files and data files.
[0010] The access service module is configured to receive a write request sent by a client, find a corresponding first file number according to information carried by the write request, determine each first logical unit corresponding to the offset and length of the write request, obtain a corresponding first data slot through hash calculation based on the first file number and the number of each first logical unit, distribute the write request to a target data storage service module corresponding to the first data slot based on the mapping relationship between the data slot and the data storage service module, and enable the target data storage service module to append metadata and real data of the write request to a latest data file of an underlying storage system responsible by the first data slot, and update the cached file data index in the first data slot after successful writing.
[0011] Optionally, the metadata service module is further configured to:
[0012] allocate a globally unique file number for each business file, maintain the mapping relationship between the data slot and the data storage service module, regenerate the mapping relationship between a failed data storage service module and a normal data storage service module when the data storage service module fails, and update the version of the failed data storage service module, wherein each data storage service module has a plurality of data slots.
[0013] Optionally, each data storage service module can load a plurality of data slots, each data slot independently maintains a file data index and is logically decoupled from each other.
[0014] Optionally, the garbage collection service module is further configured to:
[0015] When performing an overwrite write on a business file, if invalid indexes appearing in the index file reach a first data amount, and invalid data appearing in the data file reach a second data amount, the contents of the index file and the data file are reorganized, and a latest index file and a latest data file are generated.
[0016] Optionally, the access service module is configured to be responsible for parsing a network file system protocol and maintaining state information of the client, including:
[0017] obtaining a request of a network file system protocol sent by the client;
[0018] when the request is an IO request, sending the IO request to the data storage service module for processing to obtain a first processing result, and returning the first processing result to the client in a format specified by the network file system protocol;
[0019] when the request is a metadata request, sending the metadata request to the metadata service module for processing to obtain a second processing result, and returning the second processing result to the client in a format specified by the network file system protocol.
[0020] Optionally, the access service module is further configured to:
[0021] receive a read request sent by the client, find a corresponding second file number according to information carried by the read request, and determine each second logical unit corresponding to an offset and a length of the read request, obtain a corresponding second data slot through hash calculation according to the second file number and the number of each second logical unit, and read required data from a specified position of a corresponding data file according to a file index cached by the second data slot.
[0022] Optionally, the metadata service module is further configured to:
[0023] when detecting that a node where the data storage service module interrupted by the heartbeat fails, marking a state of the failed data storage service module as abnormal;
[0024] redistributing each target data slot mapped to the failed data storage service module to other normal data storage service modules, generating a latest mapping relationship between each target data slot and each normal data storage service module, and updating a mapping relationship version at the same time;
[0025] each normal data storage service module is configured to:
[0026] when a mapping relationship version is changed through the heartbeat, obtaining the latest mapping relationship, and loading a required data slot from each target data slot.
[0027] Optionally, the normal data storage service module is specifically configured to:
[0028] when loading the required data slot, reading an index file of the required data slot to restore a file data index to a cache, wherein, during the file data index restoration, an IO request from the access service module received by the normal data storage service module will be discarded.
[0029] Optionally, the data storage service module is further configured to:
[0030] After the current data file is written for a fixed number of times, the current data file is sealed and the next data file is switched to, and the subsequent write IO requests are written into the next data file.
[0031] Optionally, the index file is used to save the metadata of the business file and is a logical file of the underlying storage system.
[0032] From the above technical solution, the present application discloses a kind of distributed file systems, comprising: metadata service module, data storage service module, garbage collection service module and access service module, metadata service module provides the metadata service of entire file system, and the working state of other module is checked by heartbeat, data storage service module provides the random read-write ability of any IO size to data slot, garbage collection service module is responsible for the garbage collection of index file and data file, to improve disk utilization, access service module finds the first file number and each first logic unit according to the write request sent by client, the first data slot corresponding to the first file number and each first logic unit is obtained by hash calculation, and write request is distributed to the target data storage service module corresponding to the first data slot, so that the target data storage service module is appended to the latest data file of the underlying storage system responsible for the first data slot by the metadata and real data of write request, and updates the file data index cached in the first data slot after writing success.The underlying storage of the distributed file system provided by the present application is established on the distributed storage system that only supports append write, the reliability of data is guaranteed by the underlying storage system, and all upper write requests will be converted into append write to data file of the underlying storage system, random write of business file is supported, and the performance of random write is basically flat with sequential write, so that the ability of random write is provided on the storage system of append write, therefore, the complexity is low, and IO amplification is reduced, the upper layer is responsible for realizing the metadata management of user file, file index retrieval and IO scheduling, provides the random write ability of file to user, and supports network file system protocol, the upper logic does not need to care about the migration of underlying data, so that maintenance difficulty is low. BRIEF DESCRIPTION OF DRAWINGS
[0033] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description only belong to the embodiments of the present application, and for those skilled in the art, other drawings can also be obtained without creative labor based on the disclosed drawings.
[0034] Figure 1 A whole architecture diagram of a distributed file system disclosed by the embodiment of the present application is disclosed;
[0035] Figure 2 A composition diagram of an IO request disclosed by the embodiment of the present application is disclosed;
[0036] Figure 3 A routing diagram of a service file disclosed by the embodiment of the present application is disclosed;
[0037] Figure 4 A format diagram of index data of a data slot cache being persisted to an index file disclosed by the embodiment of the present application is disclosed. DETAILED DESCRIPTION
[0038] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the protection scope of the present application.
[0039] The embodiment of the application discloses a kind of distributed file systems, comprising: metadata service module, data storage service module, garbage collection service module and access service module, metadata service module provides the metadata service of entire file system, and the working state of other module is checked by heartbeat, data storage service module provides the random read-write ability of any IO size to data slot, garbage collection service module is responsible for the garbage collection of index file and data file, to improve disk utilization, access service module finds the first file number and each first logic unit according to the write request sent by client, the first data slot corresponding to the first file number and each first logic unit is obtained by hash calculation, and write request is distributed to the target data storage service module corresponding to the first data slot, so that the target data storage service module will write the metadata and real data of write request to the latest data file of underlying storage system responsible for the first data slot, and update the file data index cached in the first data slot after writing success.The underlying storage of the distributed file system provided by the application is established on the distributed storage system that only supports append write, the reliability of data is guaranteed by underlying storage system, and all upper write requests will be converted into append write to data file of underlying storage system, random write of business file is supported, and the performance of random write is basically flat with sequential write, so that the ability of random write is provided on the storage system of append write, so complexity is low, and IO amplification is reduced, upper layer is responsible for realizing the metadata management of user file, file index retrieval and IO scheduling, random write ability of file is provided to user, and network file system protocol is supported, upper layer logic does not need to care about the migration of underlying data, so maintenance difficulty is low.
[0040] Referring to Figure 1 The embodiment of the application discloses a kind of distributed file system's overall architecture diagram, distributed file system includes: metadata service module (Metaserver) 11, data storage service module (Segmentserver) 12, garbage collection service module (Gc) 13 and access service module (Parashu) 14.
[0041] Metadata service module 11 is connected with data storage service module 12, garbage collection service module 13 and access service module 14 respectively, and access service module 14 is connected with data storage service module 12.
[0042] It needs to be specially pointed out that, in actual application, the number of metadata service module 11, data storage service module 12, garbage collection service module 13 and access service module 14 is at least one respectively, Figure 1The three metadata service modules 11 and the five data storage service modules 12 shown in the figure are only an example, and the number of each of the metadata service modules 11, the data storage service modules 12, the garbage collection service module 13 and the access service module 14 depends on actual needs, including but not limited to Figure 1 The case shown in the figure.
[0043] The metadata service module 11 is configured to provide metadata services of the entire file system, form a preset fixed number of metadata service clusters by a consistency protocol and ensure consistency, and is further configured to receive heartbeats sent by the data storage service module 12, the garbage collection service module 13 and the access service module 14 to represent working states.
[0044] Specifically, taking Figure 1 as an example, the metadata service cluster includes three metadata service modules 11. In actual application, one of the three metadata service modules 11 is a master metadata service module, and the other two are backup metadata service modules. Normally, only the master metadata service module works, and when the master metadata service module fails, the backup metadata service modules are enabled.
[0045] The data storage service module 12, the garbage collection service module 13 and the access service module 14 periodically report their working states to the metadata service module 11 through heartbeats.
[0046] The data storage service module 12 is configured to provide random read and write capabilities for data slots of any IO size to the outside, wherein each data slot mapped by the data storage service module 12 is uniformly distributed.
[0047] It should be noted that the data slot in the data storage service module 12 is a logical concept of a fixed number of each distributed storage system cluster at initialization, and there are 10000 slots. It can be simply understood as the slot concept in the consistent hash ring. Each data slot can be loaded by one data storage service module 12 at the same time, and each data slot contains data files and index files, corresponding to the logical files of the underlying append write storage system. The data slots are uniformly distributed on all data storage service modules 12.
[0048] The garbage collection service module 13 is configured to be responsible for garbage collection of index files and data files.
[0049] The data file is configured to save real file data, which is a logical file in the underlying storage system. Each IO will append a content to the latest data file of the data slot, and the content is composed of metadata and real data requested by the IO. For details, see Figure 2The composition of the IO request is shown, wherein the metadata includes: file number, offset, length and IO type.
[0050] The access service module 14 is configured to receive the write request sent by the client 10, find the corresponding first file number according to the information carried by the write request, determine the first logical unit corresponding to the offset and length of the write request, obtain the first data slot corresponding to the first file number and the number of the first logical unit through hash calculation, distribute the write request to the target data storage service module corresponding to the first data slot based on the mapping relationship between the data slot and the data storage service module, and make the target data storage service module append the metadata and real data of the write request to the latest data file of the underlying storage system 15 responsible for the first data slot, and update the cached file data index in the first data slot after successful writing.
[0051] For details, see Figure 1 The underlying storage system 15 is configured to be directly responsible for the management of the bare disk, and can store business files on different storage media of multiple nodes through erasure correction or redundancy measurement of multiple copies, and only supports sequential writing, that is, the underlying storage system 15 does not support random writing, but only supports sequential writing.
[0052] It should be noted that the write request sent by the client 10 in the embodiment belongs to an IO request.
[0053] In the embodiment, one or more first logical units corresponding to the write request are determined according to the offset and length of the write request.
[0054] In conclusion, the application discloses a kind of distributed file system, comprising: metadata service module 11, data storage service module 12, garbage collection service module 13 and access service module 14, metadata service module 11 provides the metadata service of entire file system, and the working state of other module is checked by heartbeat, data storage service module 12 provides the random read-write ability of any IO size to data slot, garbage collection service module 13 is responsible for the garbage collection of index file and data file, to improve disk utilization, access service module 14 finds the first file number and corresponding each first logic unit according to the write request sent by client 10, the first data slot corresponding to the first file number and each first logic unit is obtained by hash calculation, and write request is distributed to the target data storage service module corresponding to the first data slot, so that the target data storage service module will write the metadata and real data of write request to the latest data file of underlying storage system 15 responsible for the first data slot, and update the file data index cached in the first data slot after successful writing.The underlying storage of the distributed file system provided by the application is established on the distributed storage system supporting only append write, the reliability of data is guaranteed by underlying storage system, and all upper write requests will be converted into append write to data file of underlying storage system, supporting random write of business file, and the performance of random write is basically flat with sequential write, so that the ability of random write is provided on the storage system of append write, so the complexity is low, and IO amplification is reduced, the upper layer is responsible for realizing the metadata management of user file, file index retrieval and IO scheduling, provides the random write ability of file to user, and supports network file system protocol, and the upper logic does not need to care about the migration of underlying data, so maintenance difficulty is low.
[0055] To further optimize the above embodiment, metadata service module 11 can also be used for:
[0056] A global unique file number is allocated to each business file, the mapping relationship between data slot and data storage service module 12 is maintained, when there is a fault data storage service module 12, the mapping relationship between fault data storage service module and normal data storage service module is regenerated, and the version of the fault data storage service module is updated, wherein each data storage service module 12 has a plurality of data slots.
[0057] In the application, the mapping relationship between data slot and data storage service module 12 has the concept of version, when a data storage service module 12 fails and a new mapping relationship between data slot and data storage service module 12 needs to be regenerated, the version is updated, in actual application, the version of new mapping relationship can be increased by 1 based on the version of original mapping relationship.
[0058] It should be noted that the metadata service module 11 in the application assigns a globally unique file number (FileID) to each service file, divides it into logical units (Blob) according to a fixed length (1GB), and each logical unit has a logical unit number (BlobID). For example, a service file with a size of 2.5GB is divided into 3 logical units, and the logical unit numbers are 0, 1 and 2 respectively. Each logical unit is hashed to a fixed data slot (Segment) through the file number + logical unit number.
[0059] In practical application, the routing schematic diagram of the service file is as shown in Figure 3 The service file 1 and the service file 2 are assumed, the service file 1 and the service file 2 each have a unique corresponding file number, the service file 1 and the service file 2 are each divided into a plurality of logical units according to a fixed length, each logical unit has a logical unit number, different logical units have different logical unit numbers, and each logical unit is hashed to a fixed data slot through the file number + logical unit number, and each data slot has a mapping relationship with the data storage service module 12.
[0060] The logical unit, the data slot N (N is a positive integer) and the data storage service module N are explained as follows:
[0061] Logical unit, each service file is divided into a plurality of logical units, the size is fixed, and is mapped to a fixed data slot through inhibitory hashing.
[0062] Data slot N, logical concept, fixed number, containing index file, data file, can be recorded to a certain data storage service, and only exists on one data storage service module at the same time.
[0063] Data storage service module N, each cluster has a plurality of data storage service modules, which are distributed on the nodes of the cluster, the number is not fixed, the data slots are evenly distributed on the data storage services, and the cluster maintains a mapping relationship table of the data slots to the data storage service modules.
[0064] In the application, the data storage service module 12 provides random read-write capability for data slots with any IO size to the outside, each data storage service module 12 can load a plurality of data slots, each data slot independently maintains file data index and is logically decoupled from each other.
[0065] In order to further optimize the above embodiment, the garbage collection service module 13 can also be used for:
[0066] When the business file is overwritten, if invalid indexes appearing in the index file reach a first data amount, and invalid data appearing in the data file reach a second data amount, the contents of the index file and the contents of the data file are reorganized, and a latest index file and a latest data file are generated.
[0067] In actual application, when the business file is overwritten, invalid indexes appear in the index file, and invalid data appears in the data file, when the invalid data reaches a certain amount, the garbage collection service module reorganizes the contents of the index file and the data file, and generates a new index file and a new data file, avoiding the situation that the volumes of the index file and the data file increase infinitely under the condition of overwriting, and continuously reducing the available capacity of the cluster.
[0068] In the application, the garbage collection service module 13 regularly arranges invalid contents in the data file and the index file, compresses the usage of the cluster, and supports saving the arranged data file and index file through the way of erasure coding, thereby improving the disk utilization.
[0069] To further optimize the above embodiment, the access service module 14 is configured to be responsible for parsing a network file system protocol and maintaining state information of the client 10, and the process specifically comprises:
[0070] obtaining a request of the network file system protocol sent by the client 10;
[0071] when the request is an IO request, sending the IO request to the data storage service module 12 for processing to obtain a first processing result, and returning the first processing result to the client 10 in a format specified by the network file system protocol;
[0072] when the request is a metadata request, sending the metadata request to the metadata service module 11 for processing to obtain a second processing result, and returning the second processing result to the client 10 in a format specified by the network file system protocol.
[0073] In actual application, the access service module 14 is responsible for parsing a network file system (NFS) protocol and maintaining state information of the client, including a file lock state, receiving a request of the network file system protocol sent by the client, and sending the request to a corresponding module for processing according to whether the request is an IO request or a metadata request.
[0074] In the application, the access service module 14 can process a read request from the client 10 in addition to processing a write request from the client 10.
[0075] Therefore, to further optimize the above embodiment, the access service module 14 can be further configured to:
[0076] receiving the read request sent by the client, finding the corresponding second file number according to the information carried by the read request, and determining the respective second logical units corresponding to the offset and length of the read request, obtaining the corresponding second data slot through hash calculation of the second file number and the number of the respective second logical units, and reading the required data from the specified position of the corresponding data file according to the file index cached by the second data slot.
[0077] It should be particularly pointed out that, in order to distinguish the processing procedures of the write request and the read request by the access service module 14, the present application distinguishes the file number, the logical unit and the data slot by using "first" and "second".
[0078] In order to further optimize the above embodiment, the data storage service module 12 can also be used for:
[0079] After the current data file is appended with fixed number of IO requests, the current data file will be sealed and the next data file will be switched to, and the subsequent appended IO requests will be written into the next data file.
[0080] It should be pointed out that the index file in the present application is used for saving the metadata of the business file, which is the logical file of the underlying storage system. The data storage service module 12 caches the data index of the file contained by each data slot, which records the offset and length of each segment written into the file corresponding to the data file, and when switching to the new data file (i.e. the next data file of the current data file), the index data cached by the data slot will be persisted into the index file.
[0081] The persistent format is shown in Figure 4 The format of the index data cached by the data slot and persisted into the index file is shown in the figure, which includes the number of the covered data file, the number of the contained files, a plurality of file index metadata and a plurality of file indexes.
[0082] Each file index metadata includes the file number, the offset (the starting offset of the index information of the file in the current index file) and the length (the length of the index information of the file in the current index file). The file index includes the logical offset of the file, the offset in the data file corresponding to the logical offset, the length of the index and the data file number (corresponding to which data file).
[0083] It should be pointed out that, after the node where the data storage service module 12 is located fails or restarts, the data slot mapped to the data storage service module 12 will be immediately transferred to other data storage service module 12, at this time, the upper IO will be recovered after a short interruption.
[0084] Therefore, to further optimize the above embodiment, the metadata service module 11 can also be used to:
[0085] When detecting that the node where the data storage service module 12 is located fails, the state of the failed data storage service module is marked as abnormal;
[0086] Reallocate each target data slot mapped to the failed data storage service module to other normal data storage service modules, generate the latest mapping relationship between each target data slot and each normal data storage service module, and update the mapping relationship version.
[0087] Specifically, when the node where a certain data storage service module 12 is located fails, the heartbeat of the failed data storage service module 12 and the metadata service module 11 is interrupted. At this time, the metadata service module 11 marks the state of the failed data storage service module as abnormal. The data slot previously mapped to the failed data storage service module is recorded as a target data slot. The metadata service module 11 reallocates each target data slot mapped to the failed data storage service module to other normal data storage service modules, generates the latest mapping relationship between each target data slot and each normal data storage service module, and updates the mapping relationship version. When updating the mapping relationship version, the mapping relationship version can be incremented by 1.
[0088] Each normal data storage service module is configured to:
[0089] When the mapping relationship version is changed through the heartbeat, the latest mapping relationship is obtained, and the required data slot is loaded from each target data slot.
[0090] Other normal data storage service modules and access service modules 14 can perceive that the mapping relationship version has changed through the heartbeat, and can obtain the version of the latest mapping relationship, and load the required data slot from each target data slot.
[0091] The normal data storage service module is specifically configured to:
[0092] When loading the required data slot, the index file of the required data slot is read to restore the file data index to the cache. During the file data index restoration, the normal data storage service module receives the IO request from the access service module 14 and the IO request will be discarded.
[0093] Specifically, when loading a required data slot, the normal data storage service module first replies file data index to the cache through the index file of the required data slot, and because there is file data index in the cache that has not been persisted to the index file during the previous data storage service failure, it is necessary to continue to recover the index according to the metadata of each IO in the data file from the next data file according to the number of the data file covered by the latest index file in the data slot, and after the index is recovered, the IO issued to the data slot can be normally processed, and the IO request received by the data storage service from the access service during the index recovery period will be discarded, and the access service will automatically retry after the IO timeout, and the upper client has no IO error.
[0094] Based on the above discussion, the distributed file system disclosed by the application has the following advantages:
[0095] 1) All write IOs are converted into append write to the underlying storage system file, and the speed of random write IO can be basically flat with that of sequential write IO, and the capability of random write is provided on the storage system of append write;
[0096] 2) Can tolerate node failure or restart;
[0097] 3) Can freely expand and remove nodes;
[0098] 4) Can be stored in the form of erasure code by garbage collection to save storage and improve disk utilization.
[0099] As can be seen from the above, the underlying storage of the distributed file system of the application is established on a distributed storage system that only supports append write, the reliability of data is guaranteed by the underlying storage system, and a multi-copy or erasure redundancy strategy is provided, and because the storage system only supports append write, the complexity is low, and the IO amplification is reduced, the upper layer is responsible for implementing the metadata management of user files, the retrieval of file index and IO scheduling, and provides the user with the capability of random write to the file, and supports the NFS protocol, these logics and the underlying storage are decoupled, when a node fails, the upper logic does not need to care about the migration of the underlying data, and the maintenance difficulty is low.
[0100] In addition, the write request is mapped to the corresponding data slot through hash calculation of the corresponding file number and logical unit number, and the data slot is uniformly distributed on the data storage service, so that the node pressure balance is guaranteed.
[0101] Finally, it should be noted that the terms "first", "second", and the like, herein do not denote any order, quantity, combination, or importance, but rather are used to distinguish one element from another, and are not intended to denote the presence of any such actual relationship or order. Moreover, the terms "comprises", "comprising", or any other variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can also include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by "comprises... a" does not, without more constraints, exclude the presence of additional identical elements in the process, method, article, or apparatus that comprises the element.
[0102] The various embodiments in the specification are described in progressive order with reference to each embodiment, each embodiment highlighting differences from other embodiments, and the same or similar parts between the various embodiments are referred to each other.
[0103] The above description of disclosed embodiments enables one of ordinary skill in the art to make and use the application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein can be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A distributed file system, characterized by, The application relates to a file system, which comprises a metadata service module, a data storage service module, a garbage collection service module and an access service module, wherein the metadata service module is connected with the data storage service module, the garbage collection service module and the access service module, and the access service module is connected with the data storage service module. The metadata service module is used for providing metadata service of the whole file system, constructing a preset fixed number of metadata service clusters through a consistency protocol and ensuring consistency, and receiving heartbeats sent by the data storage service module, the garbage collection service module and the access service module and representing working states. The data storage service module is used for providing random read-write ability for data slots with any IO size, wherein each data slot mapped by the data storage service module is uniformly distributed, each data storage service module can load a plurality of data slots, each data slot independently maintains file data index and is logically decoupled from each other. The garbage collection service module is used for being responsible for garbage collection of index files and data files. The access service module is used for receiving a write request sent by a client, finding a corresponding first file number according to information carried by the write request, determining each first logical unit corresponding to the offset and length of the write request, calculating a corresponding first data slot through hash calculation according to the first file number and the number of each first logical unit, distributing the write request to a target data storage service module corresponding to the first data slot based on the mapping relationship between the data slot and the data storage service module, making the target data storage service module append metadata and real data of the write request to a latest data file of an underlying storage system responsible by the first data slot, and updating the cached file data index in the first data slot after successful writing, wherein the underlying storage system is used for directly managing a bare disk, can store business files in different storage media of multiple nodes through erasure or multiple-copy redundancy measurement, and only supports sequential writing. The metadata service module is further used for allocating a globally unique file number for each business file, maintaining the mapping relationship between the data slot and the data storage service module, regenerating the mapping relationship between a fault data storage service module and normal data storage service modules when the fault data storage service module appears, and updating the version of the fault data storage service module, wherein each data storage service module has a plurality of data slots.
2. The distributed file system of claim 1, wherein, The garbage collection service module is further used for reorganizing the content of the index file and the content of the data file and generating a latest index file and a latest data file when performing overwrite on a business file, if invalid indexes appearing in the index file reach a first data amount and invalid data appearing in the data file reach a second data amount. The access service module is used for being responsible for analysis of a network file system protocol and maintaining state information of the client, and the state information comprises:
3. The distributed file system of claim 1, wherein, 4. The distributed file system of claim 1, wherein, Obtaining a network file system protocol request sent by the client; When the request is an IO request, sending the IO request to the data storage service module for processing to obtain a first processing result, and returning the first processing result to the client in a format specified by the network file system protocol; When the request is a metadata request, sending the metadata request to the metadata service module for processing to obtain a second processing result, and returning the second processing result to the client in a format specified by the network file system protocol.
5. The distributed file system of claim 1, wherein, The access service module is further configured to: receive a read request sent by the client, find a corresponding second file number according to information carried by the read request, and determine each second logical unit corresponding to the offset and length of the read request, obtain a corresponding second data slot through hash calculation according to the second file number and the number of each second logical unit, and read the required data from the specified position of the corresponding data file according to the file index cached by the second data slot.
6. The distributed file system of claim 1, wherein, The metadata service module is further configured to: when detecting that a node where the data storage service module interrupted by the heartbeat fails, marking the state of the failed data storage service module as abnormal; redistributing each target data slot mapped to the failed data storage service module to other normal data storage service modules, generating a latest mapping relationship between each target data slot and each normal data storage service module, and updating the mapping relationship version at the same time; each normal data storage service module is configured to: when the mapping relationship version is changed through the heartbeat, obtaining the latest mapping relationship, and loading a required data slot from each target data slot.
7. The distributed file system of claim 6, wherein, The normal data storage service module is specifically configured to: when loading the required data slot, reading the index file of the required data slot to restore the file data index to the cache, wherein during the file data index restoration, the normal data storage service module receives the IO request from the access service module and the IO request will be discarded.
8. The distributed file system of claim 1, wherein, The data storage service module is further configured to: after the current data file is appended with IO requests for a fixed number of times, the current data file will be sealed, and the next data file will be switched to, and the subsequent appended IO requests will be written into the next data file.
9. The distributed file system of claim 1, wherein, The index file is used to save the metadata of the business file, and is a logical file of the underlying storage system.
Citation Information
Patent Citations
Data consistency storage method and system for object storage device
CN111124301A