A metadata sharing method and system suitable for distributed file system
Through a consistent hashing algorithm, the metadata management node is determined in the distributed file system and cross-node communication is realized, which solves the problems of metadata read and write performance bottlenecks and communication overhead, and improves the overall performance and efficiency of the system.
Patent Information
- Application Number
- CN202411109908.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-14
- Publication Date
- 2024-11-01
- Estimated Expiration
- 2044-08-14
AI Technical Summary
In distributed file systems, the read and write performance of metadata is limited by the memory capacity and communication overhead of a single MDS node. Especially when a large number of clients request the same file at the same time, some MDS nodes are overloaded and inefficient.
A consistent hashing algorithm is used to determine the management MDS node of the target metadata, and to directly obtain metadata through cross-node communication, reduce memory and communication overhead, realize metadata sharing, and bypass the replication of hotspot metadata and metadata pools.
It significantly reduces the memory pressure and communication overhead of MDS nodes, improves the metadata read and write performance of distributed file systems, avoids the problem of excessive load on a single MDS node, and improves the efficiency of data sharing.
Smart Images

Figure CN118626465B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of file sharing, and in particular to a metadata sharing method and system applicable to a distributed file system. Background Art
[0002] The performance bottleneck of a distributed file system is often limited by the metadata read and write speed. When the amount of metadata is large, the metadata read and write speed is limited by the performance of a single MDS node. Because when reading and writing file data, the MDS node must read the relevant metadata into the memory. When the amount of metadata is large, the memory capacity will also become a performance bottleneck. In order to solve the memory performance bottleneck, a cache elimination algorithm is usually introduced. A certain amount of hot metadata is always retained in the memory, thereby reducing the memory capacity occupation. This results in a single MDS node not only needing to process metadata reading and writing, but also needing to process the cache elimination algorithm, further limiting the metadata read and write performance. In order to solve the metadata read and write performance bottleneck caused by the performance bottleneck of a single MDS node, the prior art usually introduces multiple MDS nodes to share the metadata load pressure of a single MDS node to improve the metadata read and write performance. After introducing multiple MDS nodes, metadata can be distributed to multiple MDS nodes. Each MDS node is responsible for managing different metadata. There are many strategies for allocating metadata to multiple MDS nodes, including directory tree sharding and dynamic subtree partitioning. The scheme of introducing multiple MDS nodes can effectively improve the metadata read and write performance.
[0003] In a distributed file system with multiple MDS nodes, when a large number of clients send requests to read different files at the same time, these requests can be processed evenly by all MDS nodes; however, when a large number of clients send requests to read the same file at the same time, all requests can only be processed by the same MDS node in sequence, which will increase the load pressure of a single MDS node, resulting in extremely low processing efficiency, and some MDS nodes will be very busy and some MDS nodes will be very idle. In order to solve this problem, the prior art proposes a metadata sharing strategy, that is, copying metadata to other MDS nodes to achieve the purpose of sharing, but this approach will bring additional metadata storage overhead and communication overhead between MDS nodes; there are two conventional methods for copying metadata, copying hotspot metadata and using metadata pools, but these two methods cannot avoid copying metadata across nodes when executed, that is, if you want to achieve sharing and avoid single-disk pressure, you must copy metadata to other disks or memory, which increases memory pressure or communication overhead. Summary of the invention
[0004] The purpose of the present invention is to provide a metadata sharing method and system suitable for a distributed file system, and proposes to share metadata only between MDS nodes or directly access the stored metadata, which significantly reduces the memory pressure and communication overhead of the MDS nodes compared to copying hot spot metadata and using a metadata pool.
[0005] To achieve the above object, the present invention proposes the following technical solutions:
[0006] In a first aspect, a metadata sharing method applicable to a distributed file system is proposed, comprising:
[0007] Receive a data read request sent by the client to all MDS nodes in the cluster, and determine for any MDS node whether the target metadata of the requested data is stored in its memory as the current requesting MDS node;
[0008] When the current requesting MDS node does not store the target metadata, a consistent hashing algorithm is used to determine a management MDS node storing the target metadata;
[0009] Sending a communication request to the management MDS node, so that the management MDS node obtains the target metadata from the memory or disk after receiving the communication request and feeds it back to the current requesting MDS node;
[0010] Receive the target metadata fed back by the management MDS node, and store the target metadata in the memory of the current requesting MDS node;
[0011] The request data is fed back according to the data read request.
[0012] Furthermore, it also includes:
[0013] Calculate the theoretical location of the target metadata storage, where the theoretical location is the target disk where the management MDS node stores the target metadata; wherein the target disk includes a disk across servers;
[0014] Access the disk service MDT of the target disk, obtain and store the target metadata to the memory of the current requesting MDS node;
[0015] The request data is fed back according to the data read request.
[0016] Furthermore, the process of calculating the theoretical location of the target metadata storage is:
[0017] Get all metadata of the distributed file system, the total number of disks, the ID of each disk, the total number of MDS nodes, and the ID of each MDS node;
[0018] According to the total number of the MDS nodes and all metadata, a first consistent hash algorithm is used to determine a number of metadata managed by each of the MDS nodes, and an ID of each of the MDS nodes and the metadata managed accordingly are recorded;
[0019] Using the logical subset mapping relationship, divide the logical subsets according to the total number of MDS nodes, and determine the number of disks in the logical subset corresponding to each of the MDS nodes;
[0020] A second consistent hash algorithm is used to map the ID of the disk of each MDS node to the corresponding logical subset, and the metadata managed by each MDS node to each disk in the corresponding logical subset, and the ID of each disk and the metadata stored therein are recorded.
[0021] Furthermore, the process of using the consistent hashing algorithm to determine the management MDS node of the target metadata storage is:
[0022] Get all directory metadata and total number of MDS nodes of the distributed file system;
[0023] All directory metadata are fragmented, and a consistent hashing algorithm is used to modulo the total number of the MDS nodes to determine the directory metadata fragments managed by each of the MDS nodes;
[0024] Storing the directory metadata slice and all file metadata belonging to the directory metadata slice in the memory of the MDS node responsible for management;
[0025] The directory metadata piece corresponding to the target metadata is determined, and the management MDS node is determined according to the directory metadata piece.
[0026] Furthermore, the process of using the consistent hashing algorithm to determine the management MDS node of the target metadata storage is:
[0027] Get all directory metadata, all file metadata and several MDS nodes of the distributed file system;
[0028] All directory metadata are stored in the memory of any of the MDS nodes, and the MDS node is recorded as the first MDS node;
[0029] A consistent hashing algorithm is used to break up all file metadata and evenly distribute and store them in the memory of each second MDS node, where the second MDS node is all MDS nodes that do not store the directory metadata, and the first MDS node is in communication connection with each second MDS node;
[0030] Determine the data type of the target metadata, the data type including directory metadata and file metadata;
[0031] When the target metadata is the directory metadata, the first MDS node is determined to be the management MDS node; when the target metadata is the file metadata, the second MDS node containing the file metadata is determined through communication between MDS nodes based on the directory metadata to which the file metadata belongs, and the second MDS node is the management MDS node.
[0032] In a second aspect, a metadata sharing system applicable to a distributed file system is proposed, comprising:
[0033] A receiving and judging module is used to receive a data reading request sent by a client to all MDS nodes in the cluster, and to judge whether the target metadata of the requested data is stored in the memory of any MDS node as the current requesting MDS node;
[0034] A determination module, configured to determine a management MDS node storing the target metadata using a consistent hashing algorithm when the current requesting MDS node does not store the target metadata;
[0035] A sending module, used for sending a communication request to the management MDS node, so that the management MDS node obtains the target metadata from the memory or disk after receiving the communication request and feeds it back to the current requesting MDS node;
[0036] A receiving storage module, configured to receive the target metadata fed back by the management MDS node, and store the target metadata in the memory of the current requesting MDS node;
[0037] The first feedback module is configured to feedback request data according to the data reading request.
[0038] Furthermore, it also includes:
[0039] A calculation module, used for calculating a theoretical location for storing the target metadata, wherein the theoretical location is a target disk for storing the target metadata at the management MDS node; wherein the target disk includes a disk across servers;
[0040] An access acquisition module, used for accessing the disk service MDT of the target disk, acquiring and storing the target metadata to the memory of the current requesting MDS node;
[0041] The second feedback module is used to feedback request data according to the data reading request.
[0042] Furthermore, the calculation module calculates the execution unit of the theoretical location of the target metadata storage, including:
[0043] A first acquisition unit is used to acquire all metadata of the distributed file system, the total number of disks, the ID of each disk, the total number of MDS nodes, and the ID of each MDS node;
[0044] A first determining unit, configured to determine, according to the total number of the MDS nodes and all metadata, a number of metadata managed by each of the MDS nodes using a first consistent hashing algorithm, and record an ID of each of the MDS nodes and the metadata managed accordingly;
[0045] A partitioning unit is used to partition the logical subsets according to the total number of MDS nodes by using a logical subset mapping relationship, and determine the number of disks in the logical subsets corresponding to each of the MDS nodes;
[0046] A mapping unit is used to map the ID of the disk of each MDS node to the corresponding logical subset, the metadata managed by each MDS node to each disk in the corresponding logical subset, and record the ID of each disk and the metadata stored therein by using a second consistent hash algorithm.
[0047] Further, the determination module uses a consistent hashing algorithm to determine the execution unit of the management MDS node of the target metadata storage, including:
[0048] The second acquisition unit is used to acquire all directory metadata, all file metadata and several MDS nodes of the distributed file system;
[0049] A first storage unit, used to store all directory metadata in a memory of any of the MDS nodes, where the MDS node is referred to as a first MDS node;
[0050] A second storage unit is used to use a consistent hashing algorithm to evenly disperse and store all file metadata in the memory of each second MDS node, where the second MDS nodes are all MDS nodes that do not store the directory metadata, and the first MDS node is in communication connection with each second MDS node;
[0051] A determination unit, configured to determine a data type of the target metadata, wherein the data type includes directory metadata and file metadata;
[0052] The second determination unit is used to determine that the first MDS node is the management MDS node when the target metadata is the directory metadata; when the target metadata is the file metadata, the second MDS node containing the file metadata is determined based on the directory metadata to which the file metadata belongs through communication between MDS nodes, and the second MDS node is the management MDS node.
[0053] In a third aspect, an electronic device is proposed, comprising at least one processor; the processor is coupled to a memory, the memory being used to store one or more computing instructions, wherein the one or more computer instructions are executed by the processor at runtime to implement the steps of the above-mentioned metadata sharing method applicable to a distributed file system.
[0054] It can be seen from the above technical solutions that the technical solutions of the present invention have the following beneficial effects:
[0055] The metadata sharing method and system applicable to a distributed file system disclosed in the present invention include: receiving a data reading request sent by a client to all MDS nodes in a cluster, judging whether the target metadata of the requested data is stored in the memory of any MDS node as the current requesting MDS node; when the current requesting MDS node does not store the target metadata, using a consistent hashing algorithm to determine the management MDS node where the target metadata is stored; sending a communication request to the management MDS node, so that the management MDS node obtains the target metadata from the memory or disk after receiving the communication request and feeds it back to the current requesting MDS node; receiving the target metadata fed back by the management MDS node, storing the target metadata in the memory of the current requesting MDS node; and feeding back the requested data according to the data reading request. Compared with copying hotspot metadata or using a metadata pool, the above method flow can directly realize metadata sharing between the management MDS node and the current requesting MDS node, which only occurs between two MDS nodes; the whole process can be realized by hash calculation, and metadata can be obtained through cross-node communication without the participation of a table, so that the metadata storage overhead and the communication overhead between MDS nodes can be significantly reduced, and the performance of the distributed file system can be improved.
[0056] The present invention also directly determines the target disk for storing target metadata, including disks across servers, so that the disk service MDT of the current requesting MDS node directly accesses the target disk to obtain and store the target metadata, and then feeds back the requested data according to the data reading request; by directly sharing the access to the target disk, it is possible to bypass the MDS node and directly access and locate different target disks on different machines across nodes, further reducing storage overhead and communication overhead, and improving the application scope and efficiency of the data sharing method.
[0057] It should be appreciated that all combinations of the foregoing concepts, as well as additional concepts described in greater detail below, may be considered to be part of the inventive subject matter of the present disclosure, provided such concepts are not mutually inconsistent.
[0058] The foregoing and other aspects, embodiments and features of the present invention can be more fully understood from the following description in conjunction with the accompanying drawings. Other additional aspects of the present invention, such as the features and / or beneficial effects of the exemplary embodiments, will be apparent from the following description or learned from the practice of the specific embodiments according to the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] The accompanying drawings are not drawn to scale according to actual reference objects. In the accompanying drawings, each identical or nearly identical component shown in various figures may be represented by the same reference numeral. For the sake of clarity, not every component is labeled in each figure. Now, embodiments of various aspects of the present invention will be described by way of example and with reference to the accompanying drawings, in which:
[0060] Figure 1 The metadata sharing method process applicable to the distributed file system disclosed in the embodiment is Figure 1 ;
[0061] Figure 2 The metadata sharing method process applicable to the distributed file system disclosed in the embodiment is Figure 2 ;
[0062] Figure 3 A flowchart of calculating the theoretical location of the target metadata storage disclosed in the embodiment;
[0063] Figure 4 The process of determining the management MDS node of the target metadata storage disclosed in the embodiment Figure 1 ;
[0064] Figure 5 The process of determining the management MDS node of the target metadata storage disclosed in the embodiment Figure 2 ;
[0065] Figure 6 A block diagram of a metadata sharing system applicable to a distributed file system disclosed in an embodiment;
[0066] Figure 7 A schematic diagram of an electronic device disclosed in an embodiment;
[0067] Figure 8 The mapping process of the theoretical location of the calculation target metadata storage disclosed in the embodiment. DETAILED DESCRIPTION
[0068] In order to make the purpose, technical solution and advantages of the embodiment of the present invention clearer, the technical solution of the embodiment of the present invention will be clearly and completely described below in conjunction with the drawings of the embodiment of the present invention. Obviously, the described embodiment is a part of the embodiment of the present invention, not all of the embodiments. Based on the described embodiment of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention. Unless otherwise defined, the technical terms or scientific terms used herein should be the common meaning understood by people with general skills in the field to which the present invention belongs.
[0069] The words "first", "second" and similar words used in the patent application specification and claims of the present invention do not indicate any order, quantity or importance, but are only used to distinguish different components. Similarly, unless the context clearly indicates otherwise, the singular form of "a", "an" or "the" and other similar words do not indicate a quantitative limitation, but indicate the existence of at least one. "Include" or "comprise" and other similar words mean that the elements or objects appearing before "include" or "comprise" cover the features, wholes, steps, operations, elements and / or components listed after "include" or "comprise", and do not exclude the existence or addition of one or more other features, wholes, steps, operations, elements, components and / or their collections. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0070] When a distributed file system based on multiple MDS nodes uses two sharing strategies, namely, copying hotspot metadata and using a metadata pool, to share metadata, there is a problem of increasing memory overhead and communication overhead; when a large number of data read requests are initiated, the increase in memory overhead and communication overhead for each request will greatly affect the performance of the distributed file system. Therefore, the present invention aims to propose a metadata sharing method and system suitable for a distributed file system, which reduces the memory overhead and communication overhead during metadata sharing by proposing a method of communicating across MDS nodes or bypassing MDS nodes, thereby ensuring the stable performance of the distributed file system.
[0071] The following is a further detailed introduction to the metadata sharing method and system applicable to a distributed file system disclosed in an embodiment of the present invention in conjunction with the accompanying drawings.
[0072] Combination Figure 1 As shown, the metadata sharing method applicable to a distributed file system disclosed in the embodiment includes the following steps:
[0073] Step S102, receiving a data read request sent by the client to all MDS nodes in the cluster, and determining for any MDS node whether the memory of the MDS node as the current requesting MDS node stores target metadata of the requested data;
[0074] When the currently requested MDS node stores the target metadata, the requested data is directly fed back according to the data read request; the client's data read request is sent to all MDS nodes in the cluster, and any MDS node can process the data read request, reducing the processing pressure of requesting a single MDS node.
[0075] Step S104, when the current requesting MDS node does not store the target metadata, a consistent hashing algorithm is used to determine a management MDS node storing the target metadata;
[0076] Step S106, sending a communication request to the management MDS node, so that the management MDS node obtains the target metadata from the memory or disk after receiving the communication request and feeds it back to the current requesting MDS node;
[0077] Step S108, receiving the target metadata fed back by the management MDS node, and storing the target metadata in the memory of the current requesting MDS node; that is, adopting the consistent hashing algorithm, the current requesting MDS node is managed by the management MDS node by calculating the target metadata, and the current requesting MDS node wants to obtain this metadata, and needs to send a request to the management MDS node. After receiving the request, the management MDS node returns the metadata to the current requesting MDS node from the memory or from the disk, and the current requesting MDS node directly stores the metadata in the memory after receiving it; the whole process can communicate across nodes through data calculation, and there is no need to use the metadata pool to complete the cross-node communication to obtain the metadata according to the participation of the MDS node storage data table.
[0078] Step S110: Feedback request data according to the data read request.
[0079] The above method process realizes cross-node communication to obtain metadata. Compared with copying hot spot metadata or using metadata pool, it can directly realize metadata sharing between management MDS node and current request MDS node, reducing metadata storage overhead and communication overhead between MDS nodes; when multiple requests are interleaved on multiple MDS nodes, MDS nodes can quickly process data requests through cross-node communication, significantly improving data request efficiency.
[0080] The scheme of obtaining metadata based on cross-node communication can reduce storage overhead and communication overhead, but it still needs to obtain metadata through communication between MDSs, such as the communication process between the management MDS node and the current requesting MDS node, and the management MDS node and the target disk; therefore, as an optional implementation method, it is proposed to bypass the management MDS node by directly sharing the access to the target disk storing the target metadata, directly cross-node access to locate different target disks on different machines, that is, the management MDS node directly communicates with the disk service on the machine where the current requesting MDS node is located, which can further reduce storage overhead and communication overhead compared with the above-mentioned cross-node MDS node communication method; the specific scheme is as follows Figure 2 As shown, it also includes: step S202, calculating the theoretical location of the target metadata storage, the theoretical location is the target disk where the management MDS node stores the target metadata; wherein the target disk includes a disk across servers; step S204, accessing the disk service MDT of the target disk, obtaining and storing the target metadata to the memory of the current requesting MDS node; step S206, feeding back the requested data according to the data read request.
[0081] In specific implementation, the process of calculating the theoretical location of the target metadata storage is as follows: Figure 3 As shown, it includes: step S2021, obtaining all metadata of the distributed file system, the total number of disks, the ID of each disk, the total number of MDS nodes, and the ID of each MDS node; step S2022, according to the total number of MDS nodes and all metadata, using a first consistent hash algorithm to determine a number of metadata managed by each of the MDS nodes, and recording the ID of each of the MDS nodes and the metadata managed accordingly; step S2023, using a logical subset mapping relationship, dividing the logical subsets according to the total number of MDS nodes, and determining the number of disks in the logical subset corresponding to each of the MDS nodes; step S2024, using a second consistent hash algorithm to map the ID of the disk of each of the MDS nodes to the corresponding logical subset, the metadata managed by each of the MDS nodes to each disk in the corresponding logical subset, and recording the ID of each disk and the metadata stored therein.
[0082] For example Figure 8In the consistent hashing algorithm mapping process shown, it is assumed that the total number of MDS nodes is 3 and the total number of disks is 9, and the chord algorithm is adopted; the chord ring is divided into the same number of logical subsets according to the total number of MDS nodes, that is, it is divided into 3 subsets: [1,4,7], [2,5,8], [3,6,9]; all disks of each MDS node will be mapped to the corresponding logical subset area, among which MDS0 is the current requesting MDS node, and the disks it is responsible for will be mapped to the [1,4,7] logical subset area, MDS1 is the management MDS node, and the disks it is responsible for will be mapped to the [2,5,8] logical subset area, and MDS2 is the management MDS node, and the disks it is responsible for will be mapped to the [3,6,9] logical subset area; when storing metadata, after determining the metadata stored by each MDS node through the first consistent hashing algorithm, the MDS factor is brought in to directly map the metadata to the logical subset area that the MDS is responsible for.
[0083] As another optional implementation, the above-mentioned solution for implementing metadata sharing across nodes discloses the process of using a consistent hashing algorithm to determine the management MDS node for storing the target metadata, which can often use a directory slicing method; the directory slicing method includes Figure 4 The process shown is as follows: Step S1041, obtaining all directory metadata and the total number of MDS nodes of the distributed file system; Step S1042, sharding all directory metadata, and using a consistent hashing algorithm to take the modulus of the total number of MDS nodes to determine the directory metadata slices managed by each MDS node; Step S1043, storing the directory metadata slices and all file metadata belonging to the directory metadata slices into the memory of the MDS node responsible for management; Step S1044, determining the directory metadata slice corresponding to the target metadata, and determining the management MDS node based on the directory metadata slices.
[0084] The above steps disclose that the solution for determining the management MDS node for the target metadata storage is to divide the shards into directories. This has the advantage of facilitating the local management of MDS nodes, but it will cause an imbalance in the amount of metadata managed by multiple MDS nodes. Figure 5As shown, an embodiment of the present invention further provides a solution for determining the management MDS node for storing the target metadata, storing the directory metadata and the file metadata separately, and adopting a balanced data management method for the file metadata; specifically comprising: step S1041', obtaining all directory metadata, all file metadata and a number of MDS nodes of the distributed file system; step S1042', storing all directory metadata in the memory of any of the MDS nodes, the MDS node being recorded as the first MDS node; step S1043', using a consistent hashing algorithm to break up all file metadata and evenly distribute them in the memory of each second MDS node, the second MDS node being all MDS nodes that do not store the directory metadata, and the first MDS node being in communication connection with each second MDS node; wherein all file metadata are evenly distributed after being broken up The process of scattering storage to the memory of each second MDS node can be obtained by dynamic subtree partitioning, that is, by periodically performing heartbeat detection on all MDS nodes to determine the load situation of each MDS node, dynamically adjusting the distribution of file metadata according to the load situation, and sharding the heavily loaded file metadata and migrating it to the lightly loaded MDS node; step S1044', judging the data type of the target metadata, the data type includes directory metadata and file metadata; step S1045', when the target metadata is the directory metadata, determining that the first MDS node is the management MDS node; when the target metadata is the file metadata, determining the second MDS node containing the file metadata based on the directory metadata to which the file metadata belongs through communication between MDS nodes, the second MDS node is the management MDS node.
[0085] This embodiment adopts a strategy for directory metadata distribution that is different from the file metadata distribution. All directory metadata are uniformly managed by a single MDS node, while file metadata is evenly distributed. When data is read, all requests involving directory metadata and file metadata under it will be sent by the first MDS node to other second MDS nodes. Except for the first MDS node needing to communicate with other second MDS nodes, no communication is required between other second MDS nodes, which can greatly reduce network communication overhead.
[0086] In an embodiment of the present application, an electronic device is also provided, including a computer program, the computer program being stored in a computer-readable storage medium; when a processor of the electronic device reads the computer program from the computer-readable storage medium, the processor executes the computer program, so that the electronic device performs the steps of the above-mentioned metadata sharing method applicable to a distributed file system. Taking an electronic device running on a computer as an example, Figure 7As shown, the electronic device may include one or more (only one is shown in the figure) processors (the processor may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory for storing data, and a transmission device for communication functions. A person skilled in the art can understand that Figure 7 The structure shown is for illustration only and does not limit the structure of the above-mentioned electronic device.
[0087] The above program can be run in the processor, or it can be stored in the memory, that is, in the computer-readable medium, which includes permanent and non-permanent, removable and non-removable media. Information storage can be achieved by any method or technology. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined in this article, computer-readable media does not include temporary computer-readable media, such as modulated data signals and carrier waves. These computer programs can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps of the functions specified in a block or multiple blocks may be implemented by different modules corresponding to different method steps.
[0088] In this embodiment, such a device or system is provided. The system can be called a metadata sharing system suitable for a distributed file system. Figure 6As shown, it includes: a receiving and judging module, which is used to receive a data reading request sent by a client to all MDS nodes in a cluster, and judge whether the target metadata of the requested data is stored in the memory of any MDS node as the current requesting MDS node; a determining module, which is used to determine the management MDS node storing the target metadata by using a consistent hashing algorithm when the current requesting MDS node does not store the target metadata; a sending module, which is used to send a communication request to the management MDS node, so that the management MDS node obtains the target metadata from the memory or disk after receiving the communication request and feeds it back to the current requesting MDS node; a receiving and storing module, which is used to receive the target metadata fed back by the management MDS node, and store the target metadata in the memory of the current requesting MDS node; a first feedback module, which is used to feed back the request data according to the data reading request.
[0089] The system is used to implement the steps of the metadata sharing method applicable to a distributed file system disclosed in the above embodiment, which have been described and will not be repeated here.
[0090] For example, the metadata sharing system suitable for a distributed file system also includes: a calculation module, used to calculate the theoretical location of the target metadata storage, the theoretical location is the target disk where the management MDS node stores the target metadata; wherein the target disk includes a disk across servers; an access acquisition module, used to access the disk service MDT of the target disk, acquire and store the target metadata to the memory of the current requesting MDS node; and a second feedback module, used to feedback the request data according to the data read request.
[0091] For another example, the computing module of the metadata sharing system applicable to the distributed file system calculates the execution unit of the theoretical location of the target metadata storage, including: a first acquisition unit, used to acquire all metadata, the total number of disks, the ID of each disk, the total number of MDS nodes, and the ID of each MDS node of the distributed file system; a first determination unit, used to determine a number of metadata managed by each of the MDS nodes based on the total number of MDS nodes and all metadata using a first consistent hashing algorithm, and record the ID of each of the MDS nodes and the metadata managed accordingly; a division unit, used to divide the logical subsets according to the total number of MDS nodes using a logical subset mapping relationship, and determine the number of disks in the logical subset corresponding to each of the MDS nodes; a mapping unit, used to map the ID of the disk of each of the MDS nodes to the corresponding logical subset, the metadata managed by each of the MDS nodes to each disk in the corresponding logical subset using a second consistent hashing algorithm, and record the ID of each disk and the metadata stored therein.
[0092] For another example, the determination module of the metadata sharing system applicable to the distributed file system adopts a consistent hashing algorithm to determine the execution unit of the management MDS node storing the target metadata, including: a second acquisition unit, used to acquire all directory metadata, all file metadata and several MDS nodes of the distributed file system; a first storage unit, used to store all directory metadata in the memory of any of the MDS nodes, and the MDS node is recorded as the first MDS node; a second storage unit, used to use a consistent hashing algorithm to break up all file metadata and evenly store them in the memory of each second MDS node, the second MDS node is all MDS nodes that do not store the directory metadata, and the first MDS node is connected to each second MDS node in communication; a judgment unit, used to judge the data type of the target metadata, the data type includes directory metadata and file metadata; a second determination unit, used to determine that the first MDS node is the management MDS node when the target metadata is the directory metadata; when the target metadata is the file metadata, the second MDS node containing the file metadata is determined through communication between MDS nodes based on the directory metadata to which the file metadata belongs, and the second MDS node is the management MDS node.
[0093] In an optional embodiment, the process of determining that the module uses a consistent hashing algorithm to determine the management MDS node for storing the target metadata can also be as follows: obtaining all directory metadata and the total number of MDS nodes of the distributed file system; sharding all directory metadata, and using a consistent hashing algorithm to take the modulus of the total number of MDS nodes to determine the directory metadata slices corresponding to the management of each MDS node; storing the directory metadata slices and all file metadata belonging to the directory metadata slices in the memory of the MDS node responsible for management; determining the directory metadata slice corresponding to the target metadata, and determining the management MDS node based on the directory metadata slices.
[0094] The metadata sharing method and system applicable to a distributed file system disclosed in the present invention can be implemented through consistent hashing algorithm calculation, and metadata can be obtained through cross-node communication without the participation of a storage table in a metadata pool, thereby directly realizing metadata sharing between a management MDS node and a current requesting MDS node; at the same time, the target disk can be directly shared and accessed after multiple consistent hashing algorithm calculations, thereby realizing direct cross-node access and positioning of different target disks on different machines without the management MDS node; the above two metadata sharing strategies disclosed in the present invention can both significantly reduce the storage overhead of the metadata sharing process and the communication overhead between MDS nodes, and the strategy of cross-node access to the target disk can effectively improve the scope and efficiency of metadata sharing.
[0095] Although the present invention has been disclosed as above with preferred embodiments, it is not intended to limit the present invention. A person with ordinary knowledge in the technical field to which the present invention belongs may make various changes and modifications without departing from the spirit and scope of the present invention. Therefore, the protection scope of the present invention shall be determined by the definition of the claims.
Claims
1. A metadata sharing method applicable to a distributed file system, characterized in that: include: Receive a data read request sent by the client to all MDS nodes in the cluster, and determine for any MDS node whether the target metadata of the requested data is stored in its memory as the current requesting MDS node; When the current requesting MDS node does not store the target metadata, a consistent hashing algorithm is used to determine a management MDS node storing the target metadata; Sending a communication request to the management MDS node, so that the management MDS node obtains the target metadata from the memory or disk after receiving the communication request and feeds it back to the current requesting MDS node; Receive the target metadata fed back by the management MDS node, and store the target metadata in the memory of the current requesting MDS node; The request data is fed back according to the data read request.
2. The metadata sharing method applicable to a distributed file system according to claim 1, characterized in that: Also includes: Calculate the theoretical location of the target metadata storage, where the theoretical location is the target disk where the management MDS node stores the target metadata; wherein the target disk includes a disk across servers; Access the disk service MDT of the target disk, obtain and store the target metadata to the memory of the current requesting MDS node; The request data is fed back according to the data read request.
3. The metadata sharing method applicable to a distributed file system according to claim 2, characterized in that: The process of calculating the theoretical location of the target metadata storage is: Get all metadata of the distributed file system, the total number of disks, the ID of each disk, the total number of MDS nodes, and the ID of each MDS node; According to the total number of the MDS nodes and all metadata, a first consistent hash algorithm is used to determine a number of metadata managed by each of the MDS nodes, and an ID of each of the MDS nodes and the metadata managed accordingly are recorded; Using the logical subset mapping relationship, divide the logical subsets according to the total number of MDS nodes, and determine the number of disks in the logical subset corresponding to each of the MDS nodes; A second consistent hash algorithm is used to map the ID of the disk of each MDS node to the corresponding logical subset, and the metadata managed by each MDS node to each disk in the corresponding logical subset, and the ID of each disk and the metadata stored therein are recorded.
4. The metadata sharing method applicable to a distributed file system according to claim 1, characterized in that: The process of using the consistent hashing algorithm to determine the management MDS node of the target metadata storage is as follows: Get all directory metadata and total number of MDS nodes of the distributed file system; All directory metadata are fragmented, and a consistent hashing algorithm is used to modulo the total number of the MDS nodes to determine the directory metadata fragments managed by each of the MDS nodes; Storing the directory metadata slice and all file metadata belonging to the directory metadata slice in the memory of the MDS node responsible for management; The directory metadata piece corresponding to the target metadata is determined, and the management MDS node is determined according to the directory metadata piece.
5. The metadata sharing method applicable to a distributed file system according to claim 1, characterized in that: The process of using the consistent hashing algorithm to determine the management MDS node of the target metadata storage is as follows: Get all directory metadata, all file metadata and several MDS nodes of the distributed file system; All directory metadata are stored in the memory of any of the MDS nodes, and the MDS node is recorded as the first MDS node; A consistent hashing algorithm is used to break up all file metadata and evenly distribute and store them in the memory of each second MDS node, where the second MDS node is all MDS nodes that do not store the directory metadata, and the first MDS node is in communication connection with each second MDS node; Determine the data type of the target metadata, the data type including directory metadata and file metadata; When the target metadata is the directory metadata, determining the first MDS node as the management MDS node; When the target metadata is the file metadata, the second MDS node containing the file metadata is determined through inter-MDS node communication based on the directory metadata to which the file metadata belongs, and the second MDS node is the management MDS node.
6. A metadata sharing system suitable for a distributed file system, characterized in that: include: A receiving and judging module is used to receive a data reading request sent by a client to all MDS nodes in the cluster, and to judge whether the target metadata of the requested data is stored in the memory of any MDS node as the current requesting MDS node; A determination module, configured to determine a management MDS node storing the target metadata using a consistent hashing algorithm when the current requesting MDS node does not store the target metadata; A sending module, used for sending a communication request to the management MDS node, so that the management MDS node obtains the target metadata from the memory or disk after receiving the communication request and feeds it back to the current requesting MDS node; A receiving storage module, configured to receive the target metadata fed back by the management MDS node, and store the target metadata in the memory of the current requesting MDS node; The first feedback module is configured to feedback request data according to the data reading request.
7. The metadata sharing system applicable to a distributed file system according to claim 6, characterized in that: Also includes: A calculation module, used for calculating a theoretical location for storing the target metadata, wherein the theoretical location is a target disk for storing the target metadata at the management MDS node; wherein the target disk includes a disk across servers; An access acquisition module, used for accessing the disk service MDT of the target disk, acquiring and storing the target metadata to the memory of the current requesting MDS node; The second feedback module is used to feedback request data according to the data reading request.
8. The metadata sharing system applicable to a distributed file system according to claim 7, characterized in that: The calculation module calculates the execution unit of the theoretical location of the target metadata storage, including: A first acquisition unit is used to acquire all metadata of the distributed file system, the total number of disks, the ID of each disk, the total number of MDS nodes, and the ID of each MDS node; A first determining unit, configured to determine, according to the total number of the MDS nodes and all metadata, a number of metadata managed by each of the MDS nodes using a first consistent hashing algorithm, and record an ID of each of the MDS nodes and the metadata managed accordingly; A partitioning unit is used to partition the logical subsets according to the total number of MDS nodes by using a logical subset mapping relationship, and determine the number of disks in the logical subsets corresponding to each of the MDS nodes; A mapping unit is used to map the ID of the disk of each MDS node to the corresponding logical subset, the metadata managed by each MDS node to each disk in the corresponding logical subset, and record the ID of each disk and the metadata stored therein by using a second consistent hash algorithm.
9. The metadata sharing system applicable to a distributed file system according to claim 6, characterized in that: The determination module uses a consistent hashing algorithm to determine the execution unit of the management MDS node of the target metadata storage, including: The second acquisition unit is used to acquire all directory metadata, all file metadata and several MDS nodes of the distributed file system; A first storage unit, used to store all directory metadata in a memory of any of the MDS nodes, where the MDS node is referred to as a first MDS node; A second storage unit is used to use a consistent hashing algorithm to evenly disperse and store all file metadata in the memory of each second MDS node, where the second MDS nodes are all MDS nodes that do not store the directory metadata, and the first MDS node is in communication connection with each second MDS node; A determination unit, configured to determine a data type of the target metadata, wherein the data type includes directory metadata and file metadata; The second determination unit is used to determine that the first MDS node is the management MDS node when the target metadata is the directory metadata; when the target metadata is the file metadata, the second MDS node containing the file metadata is determined based on the directory metadata to which the file metadata belongs through communication between MDS nodes, and the second MDS node is the management MDS node.
10. An electronic device, characterized in that: The method comprises at least one processor; the processor is coupled to a memory, the memory is used to store one or more computing instructions, wherein the one or more computer instructions are executed by the processor at runtime to implement the steps of the metadata sharing method applicable to a distributed file system as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Management method for metadata in distributed file system
CN103761275A
Metadata retrieval method and system, terminal and storage medium
CN114490527A
Metadata server and method for distributing metadata in units of directories using the same
US20180322142A1
