Metadata expansion method and device under distributed file system, equipment and storage medium
By using a directory or file-based hashing algorithm and metadata manager in distributed file systems, the hot spots and scaling performance bottlenecks in metadata expansion are solved, and load balancing and efficient metadata migration is achieved. , improves the stability and scalability of the system.
Patent Information
- Application Number
- CN202411313887.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-19
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2044-09-19
AI Technical Summary
The existing distributed file systems have hot issues in metadata scaling and performance bottlenecks during scaling, resulting in system performance and availability being affected.
Using a hashing algorithm based on directories or files, migrate metadata from one metadata server to another through hash mapping relationship, implement incremental migration, and continue to process client requests during the migration process, dynamically adjust hashing Map relationships to achieve load balancing, and introduce metadata managers for cluster monitoring and scaling management.
Implement directory-level load balancing without reducing directory operation performance, reduce metadata hotspots, improve system stability and efficiency, realize fast cost-free migration of metadata servers, and reduce business impact.
Smart Images

Figure CN119127825A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of distributed storage, and in particular to a metadata expansion method, device, equipment and storage medium under a distributed file system. Background Art
[0002] Traditional file systems are limited by the performance bottleneck of a single machine and cannot meet the rapidly growing data processing needs of businesses. Distributed file systems can integrate the storage resources of multiple servers, so that businesses do not need to know the actual physical location of data when accessing data. In addition, distributed file systems naturally support the expansion of any node, which can meet the rapidly growing data processing needs of businesses.
[0003] Efficient management of metadata is a key challenge for distributed file systems. Current metadata extension methods mainly include static subtree partitioning, dynamic subtree partitioning, and hash-based metadata partitioning, but these methods can have a serious impact on user services under different conditions, including directory hot spots, capacity expansion, etc. There is no reasonable and effective metadata extension method in the relevant technology. Summary of the invention
[0004] In view of this, the present disclosure proposes a metadata extension method, apparatus, device and storage medium in a distributed file system.
[0005] According to one aspect of the present disclosure, a metadata extension method in a distributed file system is provided, wherein the distributed file system includes a plurality of metadata servers (MDS), and the method includes:
[0006] Receive a cluster expansion request from the client;
[0007] Determine a target process to be migrated according to the cluster expansion request, where the target process is used to manage metadata, and a hash mapping relationship exists between an identifier of a file or directory where the metadata is located and the target process;
[0008] The metadata of the target process is copied from a first metadata server to a second metadata server, and the hash mapping relationship is adjusted, wherein the second metadata server is different from the first metadata server.
[0009] In a possible implementation, copying the metadata of the target process from the first metadata server to the second metadata server and adjusting the hash mapping relationship includes:
[0010] Incrementally copying the metadata of the target process from the first metadata server to the second metadata server, and continuing to process client requests during the data migration process;
[0011] When a preset condition is met, stop running the target process, copy the remaining data of the target process to the second metadata server, and adjust the hash mapping relationship;
[0012] After the migration is completed, the redundant data of the first metadata server is cleaned up.
[0013] In another possible implementation, the method further includes:
[0014] A directory creation request is received from a client, wherein the directory creation request includes a directory identifier of a target directory to be created;
[0015] According to the directory identifier of the target directory, a corresponding hash value is determined by a preset hash function;
[0016] According to the hash value, the target directory is allocated to a target metadata server so that the target metadata server creates the target directory.
[0017] In another possible implementation, determining the corresponding hash value by using a preset hash function according to the directory identifier of the target directory includes:
[0018] Determine the corresponding hash value by using the preset hash function according to the directory identifier of the parent directory of the target directory and the directory identifier of the target directory;
[0019] The directory identifier of the parent directory is used to uniquely identify the parent directory among multiple directories, and the directory identifier of the target directory is used to uniquely identify the target directory among multiple directories.
[0020] In another possible implementation, the method further includes:
[0021] Binding the directory identifier or file identifier of the target directory to the process of the target metadata server, and separating the directory entry of the target directory from the index node;
[0022] The file identifier is used to uniquely identify the target file in the target directory among multiple files.
[0023] In another possible implementation, the method further includes:
[0024] When any one of the multiple metadata servers fails, the directory identifier or file identifier bound to the failed metadata server is reallocated to a process of another metadata server.
[0025] In another possible implementation, the distributed file system further includes a metadata manager, and the method further includes:
[0026] The metadata manager monitors key indicators of each of the plurality of metadata servers to obtain monitoring data, wherein the key indicators include at least one of load condition, response time, and storage utilization rate;
[0027] The metadata manager dynamically adjusts the process distribution of the plurality of metadata servers according to the monitoring data, and each of the metadata servers carries one or more processes.
[0028] According to another aspect of the present disclosure, a metadata expansion device in a distributed file system is provided, wherein the distributed file system includes a plurality of metadata servers, and the device includes:
[0029] A receiving module, used to receive a cluster expansion request sent by a client;
[0030] A determination module, used to determine a target process to be migrated according to the cluster expansion request, wherein the target process is used to manage metadata, and an identifier of a file or directory where the metadata is located has a hash mapping relationship with the target process;
[0031] An extension module is used to copy the metadata of the target process from a first metadata server to a second metadata server and adjust the hash mapping relationship, wherein the second metadata server is different from the first metadata server.
[0032] In a possible implementation, the extension module is further used to: incrementally copy the metadata of the target process from the first metadata server to the second metadata server, and continue to process client requests during the data migration process;
[0033] When a preset condition is met, stop running the target process, copy the remaining data of the target process to the second metadata server, and adjust the hash mapping relationship;
[0034] After the migration is completed, the redundant data of the first metadata server is cleaned up.
[0035] In another possible implementation, the device further includes: an allocation module, configured to:
[0036] A directory creation request is received from a client, wherein the directory creation request includes a directory identifier of a target directory to be created;
[0037] According to the directory identifier of the target directory, a corresponding hash value is determined by a preset hash function;
[0038] According to the hash value, the target directory is allocated to a target metadata server so that the target metadata server creates the target directory.
[0039] In another possible implementation, the allocation module is further configured to:
[0040] Determine the corresponding hash value by using the preset hash function according to the directory identifier of the parent directory of the target directory and the directory identifier of the target directory;
[0041] The directory identifier of the parent directory is used to uniquely identify the parent directory among multiple directories, and the directory identifier of the target directory is used to uniquely identify the target directory among multiple directories.
[0042] In another possible implementation, the device further includes: a binding module, configured to:
[0043] Binding the directory identifier or file identifier of the target directory to the process of the target metadata server, and separating the directory entry of the target directory from the index node;
[0044] The file identifier is used to uniquely identify the target file in the target directory among multiple files.
[0045] In another possible implementation manner, the apparatus further includes: a reallocation module, configured to:
[0046] When any one of the multiple metadata servers fails, the directory identifier or file identifier bound to the failed metadata server is reallocated to a process of another metadata server.
[0047] In another possible implementation, the distributed file system further includes a metadata manager, and the device further includes: an adjustment module, configured to:
[0048] The metadata manager monitors key indicators of each of the plurality of metadata servers to obtain monitoring data, wherein the key indicators include at least one of load condition, response time, and storage utilization rate;
[0049] The metadata manager dynamically adjusts the process distribution of the plurality of metadata servers according to the monitoring data, and each of the metadata servers carries one or more processes.
[0050] According to another aspect of the present disclosure, a computing device is provided, the computing device comprising:
[0051] processor;
[0052] a memory for storing processor-executable instructions;
[0053] The processor is configured to implement the above method when executing the instructions stored in the memory.
[0054] According to another aspect of the present disclosure, a non-volatile computer-readable storage medium is provided, on which computer program instructions are stored, and when the computer program instructions are executed by a processor, the above method is implemented.
[0055] According to another aspect of the present disclosure, a computer program product is provided, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of a computing device, the processor in the computing device executes the above method.
[0056] The disclosed embodiment provides a metadata expansion method under a distributed file system, which can be performed by receiving a cluster expansion request sent by a client; determining a target process to be migrated according to the cluster expansion request, wherein the target process is used to manage metadata, and an identifier of a file or directory where the metadata is located has a hash mapping relationship with the target process; copying the metadata of the target process from a first metadata server to a second metadata server, and adjusting the hash mapping relationship, wherein the second metadata server is different from the first metadata server; on the one hand, by adopting a hash algorithm based on a directory or file, load balancing at the directory level can be achieved without sacrificing directory operation performance. On the other hand, the identifier of a file or directory is bound to a process of a specific metadata server, and the expansion and contraction of the metadata server cluster is precisely controlled. This mechanism allows the process of the metadata server to be quickly and cost-freely migrated to any node, further improving the stability and efficiency of the entire distributed file system.
[0057] Further features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate exemplary embodiments, features, and aspects of the disclosure and, together with the description, serve to explain the principles of the disclosure.
[0059] Figure 1A flowchart of a metadata extension method in a distributed file system provided by an exemplary embodiment of the present disclosure is shown.
[0060] Figure 2 A schematic diagram showing the principles of a metadata extension method in a distributed file system provided by an exemplary embodiment of the present disclosure is shown.
[0061] Figure 3 A schematic diagram showing the directory tree structure of a file system.
[0062] Figure 4 A schematic diagram showing a two-level directory structure of a distributed file system.
[0063] Figure 5 A flowchart of a metadata extension method under a distributed file system provided by another exemplary embodiment of the present disclosure is shown.
[0064] Figure 6 A flowchart of a metadata extension method under a distributed file system provided by another exemplary embodiment of the present disclosure is shown.
[0065] Figure 7 A flowchart of a metadata extension method under a distributed file system provided by another exemplary embodiment of the present disclosure is shown.
[0066] Figure 8 A schematic diagram of the structure of a metadata expansion device under a distributed file system provided by an exemplary embodiment of the present disclosure is shown.
[0067] Fig. 9 The invention is a block diagram showing a device for executing a metadata extension method in a distributed file system according to an exemplary embodiment. DETAILED DESCRIPTION
[0068] Various exemplary embodiments, features and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise specified.
[0069] The word “exemplary” is used exclusively herein to mean “serving as an example, example, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.
[0070] In addition, in order to better illustrate the present disclosure, numerous specific details are given in the following specific embodiments. It should be understood by those skilled in the art that the present disclosure can also be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the subject matter of the present disclosure.
[0071] The current metadata expansion methods mainly include static subtree partitioning, dynamic subtree partitioning, and hash-based metadata partitioning, but these methods all have their own limitations: static subtree partitioning is difficult to deal with hot issues and has poor scalability; dynamic subtree partitioning affects business access during the migration process; hash-based metadata partitioning destroys the hierarchical structure of the file system, resulting in a decrease in directory operation performance. In addition, these solutions often require a large amount of data migration when the cluster is expanded or reduced, which seriously affects system performance and availability.
[0072] The above three solutions will have a serious impact on user services under different conditions. The disclosed embodiment provides a metadata extension method under a distributed file system. Based on the hash algorithm of the directory or file, it can achieve load balancing at the directory level without reducing the directory operation performance, thereby reducing the occurrence of metadata hot spots. In addition, by binding the unique identifier of the file or directory to the process of the unique metadata server, the directory item is directly isolated from the index node, so that the migration cost is minimized. In addition, by introducing a metadata manager as an intermediate node to control the expansion and reduction of the metadata server cluster, while ensuring the high scalability of the cluster, the impact on the user's business is minimized, and the metadata server can be quickly and cost-free to move to any node, thereby achieving load balancing and reducing hot spots.
[0073] The following uses several exemplary embodiments to introduce the metadata extension method under the distributed file system provided by the embodiment of the present disclosure.
[0074] Please refer to Figure 1 , which shows a flowchart of a metadata extension method under a distributed file system provided by an exemplary embodiment of the present disclosure, the distributed file system includes multiple metadata servers, and this embodiment uses the method used in a metadata server of the distributed file system as an example. The method includes the following steps.
[0075] Step 101: receiving a directory creation request sent by a client, wherein the directory creation request includes a directory identifier of a target directory to be created.
[0076] The distributed file system includes multiple metadata servers. The metadata server is a server responsible for storing and managing metadata (such as permissions, location, size, etc.) of files or directories. The metadata server is also called a metadata server node.
[0077] The client sends a directory creation request, which is used to instruct the creation of a target directory in the distributed file system. The directory creation request may include a directory identifier of the target directory to be created, and the directory identifier is used to uniquely identify the name or path of a directory, which may be the name, path or other unique identifier of the directory. When the client sends a directory creation request, this request may be sent to the metadata server responsible for the parent directory of the target directory. For the convenience of explanation, this metadata server is referred to as the first metadata server, which is the metadata server where the parent directory of the target directory to be created is located.
[0078] Step 102: Determine a corresponding hash value by using a preset hash function according to the directory identifier of the target directory.
[0079] The first metadata server processes the directory identifier of the target directory using a preset hash function to generate a hash value. This hash value is used to determine which metadata server (target metadata server) will be responsible for storing and managing the metadata of the target directory. When selecting the target metadata server, the first metadata server can consider the hotspot situation (i.e., access frequency) of the parent directory and the load situation of all metadata servers to achieve load balancing.
[0080] A hash function is a preset hash algorithm used to convert input (such as a directory identifier) into a fixed-size number (hash value), which is usually used for fast search and data distribution.
[0081] In some embodiments, a corresponding hash value is determined by a preset hash function based on the directory identifier of the parent directory of the target directory and the directory identifier of the target directory; wherein the directory identifier of the parent directory is used to uniquely identify the parent directory among multiple directories, and the directory identifier of the target directory is used to uniquely identify the target directory among multiple directories.
[0082] Optionally, the first metadata server determines the target metadata server according to the hotspot situation of the parent directory and the hotspot situation of the metadata server cluster, and performs hash calculation according to the directory identifier of the parent directory, the directory identifier of the target directory, and the target metadata server to determine the hash mapping relationship between the directory identifier of the parent directory, the directory identifier of the target directory, and the target metadata server. The first metadata server can establish a mapping relationship between the directory identifier of the target directory and the target metadata server, and this mapping relationship can record the corresponding relationship between the parent directory identifier, the directory identifier of the target directory, and the target metadata server.
[0083] In some embodiments, each metadata server carries one or more processes, and the mapping relationship is used to indicate the hash mapping relationship between the parent directory identifier of the target directory, the directory identifier of the target directory, and a process of the target metadata server. That is to say, in the process of determining the hash mapping relationship, the hash mapping relationship between the input parameters and the output parameters is determined according to the input parameters (the parent directory identifier of a directory, the directory identifier of the directory) and the output parameters (the hash value corresponding to the process of the metadata server). After the hash mapping relationship is determined, according to the input parameters (the parent directory identifier of a directory, the directory identifier of the directory), the corresponding hash value can be determined by a preset hash function, and the hash value is used to uniquely identify a process of a metadata server. The corresponding metadata server process can be determined by the hash value, and the process of the metadata server is used to manage the metadata in the directory.
[0084] Step 103: assign the target directory to the target metadata server according to the hash value, so that the target metadata server creates the target directory.
[0085] The first metadata server assigns the target directory to the target metadata server based on the hash value. If the target metadata server is the first metadata server, the first metadata server creates the target directory and index node, and replies to the client after the creation is complete. If the target metadata server is not the first metadata server, the first metadata server sends a directory creation message to the target metadata server; after receiving the message, the target metadata server creates the target directory and index node, and after the creation is complete, it sends a success message to the first metadata server. After the first metadata server receives the creation completion message from the second metadata server, it believes that the directory creation request has been completed, so it replies to the client. The client receives the response message, indicating that the entire directory creation is complete.
[0086] In an illustrative example, Figure 2 As shown, the first metadata server receives a client request, which requires the creation of a directory in the distributed file system. The first metadata server uses the above-mentioned directory- or file-based hash algorithm to provide metadata services and allocates the directory to the target metadata server. The figure only schematically shows three metadata servers, metadata server 1, metadata server 2 and metadata server 3. Each metadata server manages a group of index nodes or directories. For example, metadata server 1 manages index node / directory 1, metadata server 2 manages index node / directory 2, and metadata server 3 manages index node / directory 3.
[0087] The disclosed embodiment introduces a hash algorithm based on directories or files. This technology aims to significantly reduce the performance bottleneck of directory operations and effectively reduce the occurrence of metadata hot spots by evenly distributing directories to various metadata server nodes. However, simple directory item hash partitioning cannot completely solve the problem of data migration volume when the cluster changes. In order to further optimize this problem, the following improvement plan is proposed.
[0088] First, the metadata server is designed as a stateless service. It does not store any persistent data content and exists only as a cache structure. All data modification operations rely on an independent storage engine to complete.
[0089] Through an in-depth analysis of the three core elements of the file system - directories, directory entries, and index nodes - an innovative decoupling method is proposed. Since directories and index nodes constitute the basic structure of data storage, when creating files and directories, the metadata servers to which they belong are explicitly specified. This design allows a monitoring program to directly perform load balancing on a metadata server basis when the cluster environment changes. This means that the specified metadata server service can be started on any node, achieving load balancing at the metadata server level while avoiding the problem of data migration.
[0090] By applying the above key technologies, the directory tree structure of the file system can be optimized.
[0091] In an illustrative example, Figure 3 As shown, it shows a schematic diagram of the directory tree structure of the file system. In this structure, you can see several directories (d) and files (f), which are arranged in a hierarchical relationship. This directory tree contains multiple directories (d1, d2, d3, d4, d5) and files (f1, f3, f4, f5, f6, f7, f8, ... fN). The relationship between files and folders is as follows: Directory d1 contains file f1 and directory d4. Directory d2 contains files f3, f4 ... fN, N is a positive integer. Directory d4 contains file f5, file f6 and directory d5. Directory d5 contains file f7 and file f8. This directory tree structure is a simplified file system representation used to show the hierarchical relationship between files and directories. Each directory can contain subdirectories and files, and files are located at the bottom of the directory structure.
[0092] In an illustrative example, Figure 4As shown in Figure 1, it shows a schematic diagram of the two-level directory structure of the distributed file system, in which directories (d) and files (f) are evenly distributed and stored on multiple metadata servers. This design not only improves the stability and scalability of the system, but also significantly reduces unnecessary data migration caused by cluster changes, thereby improving the overall system performance and efficiency.
[0093] Below, these key technologies are further introduced.
[0094] The disclosed embodiments provide a directory or file-based hash algorithm for implementing efficient metadata management in a distributed file system. Unlike conventional methods, the algorithm uses a directory structure rather than a file or index node as the basic unit of hashing. In some embodiments, the algorithm uses a directory identifier of a target directory (such as a path name of a target directory) as input, generates a hash value through a specific hash function, and then distributes the target directory to a corresponding metadata server based on the hash value.
[0095] The advantages of this algorithm are as follows: First, it preserves the hierarchical structure of the file system, so that directory operations (such as listing directory contents) can be completed efficiently on a single metadata server. Second, by hashing directories rather than individual files, the algorithm can distribute the load more evenly and achieve load balancing at the directory level. This balancing strategy significantly reduces the probability of metadata hotspots, because even if a directory contains a large number of files, the metadata of these files will be concentrated on the same metadata server, avoiding frequent access across multiple servers.
[0096] In addition, the algorithm also takes into account the dynamic changes of directory depth and file system. By adopting an adaptive hash function, the algorithm can dynamically adjust the hash function according to the depth of the target directory and the load of the distributed file system to further optimize the load balancing effect. This method not only improves the overall performance of the system, but also enhances the scalability of the system, enabling it to better adapt to the needs of large-scale file systems.
[0097] In some embodiments, the directory identifier or file identifier of the target directory can also be bound to the target metadata server, and the directory entry of the target directory can be separated from the index node; wherein the file identifier is used to uniquely identify the target file in the target directory among multiple files. This design greatly simplifies the management and migration process of metadata.
[0098] Among them, a directory is a collection of files and subdirectories stored in a distributed file system. It is similar to a folder and is used to organize and manage files. A directory entry is an entry in a directory. A directory entry contains metadata about a file or directory. A directory entry mainly contains the name of the file or directory and parent directory information, such as the file name, index node number, permissions, etc. An index node is a database record that stores file attributes and data structures in a distributed file system. An index node contains file attributes and data block location information. For example, an index node contains information such as file permissions, owners, size, timestamps, and data block locations.
[0099] Each file or directory is assigned a globally unique identifier, and a one-to-one mapping relationship is established between this identifier and the metadata server that manages the metadata of the file or directory. This mapping relationship is persistently stored and remains consistent throughout the file system. At the same time, the disclosed embodiment separates the directory entry and index node information, which are traditionally tightly coupled.
[0100] This design brings many advantages: First, since the binding relationship between the file / directory identifier and the metadata server is fixed, when performing load balancing or system expansion, only a small amount of metadata information needs to be migrated through the following incremental method, which greatly reduces the cost of data migration. Second, the separation of directory entries and index nodes allows the distributed file system to handle operations such as renaming and moving more flexibly, because these operations mainly involve changes to directory entries without modifying index node information.
[0101] In addition, this design can also improve the fault tolerance and recovery capability of the system. In some embodiments, when any one of the multiple metadata servers fails, the directory identifier or file identifier bound to the failed metadata server is reallocated to another metadata server without the need for large-scale data migration. This not only reduces system downtime, but also ensures data consistency and integrity.
[0102] In some embodiments, the disclosed embodiments may also introduce a metadata manager as an intermediate node to be responsible for comprehensive monitoring and management of the metadata server cluster. This metadata manager node, as the "brain" of the entire distributed file system, is responsible for coordinating and optimizing the operating status of the metadata server cluster, and plays a key role in especially when the cluster is expanded or reduced in capacity.
[0103] The main functions of the metadata manager node include:
[0104] 1. Real-time monitoring: Monitor the key indicators of multiple metadata servers to obtain monitoring data. The key indicators include at least one of load, response time, and storage utilization. The load of the metadata server usually refers to the busyness of the server when processing requests. It can be measured by a variety of indicators, including but not limited to CPU utilization, memory usage, disk I / O, network traffic, and the number of requests being processed. The response time of the metadata server refers to the time from when the user sends a request or instruction to when the metadata server reacts (responds). The storage utilization rate of the metadata server usually refers to the ratio of the used storage space to the total storage space in the metadata server, which is an important indicator for measuring the efficiency of the metadata server. These data are usually transmitted and processed in digital form to achieve timely monitoring and control of the metadata server cluster.
[0105] 2. Load balancing: Based on the monitoring data, dynamically adjust the process distribution of multiple metadata servers. Each metadata server carries one or more processes. Schematically, migrate part of the metadata on the high-load metadata server to the low-load metadata server to achieve load balancing. After deciding on the migration strategy, the system will perform the migration operation. This usually involves updating internal data structures, such as metadata mapping tables, as well as actual data movement. In some cases, the system may provide automated load balancing functions, while in other cases, manual intervention by the system administrator may be required depending on the specific situation.
[0106] 3. Cluster expansion and contraction management: When it is necessary to increase or reduce metadata server nodes, the metadata manager is responsible for formulating and executing a detailed migration plan to ensure the smooth progress of the entire process.
[0107] 4. Fault detection and recovery: Timely detect metadata server node failures and initiate an automatic recovery process to redistribute the affected metadata to healthy metadata server nodes.
[0108] With the introduction of the metadata manager, the migration process of the metadata server becomes faster and almost imperceptible. When the target process of the first metadata server needs to be migrated to the second metadata server, the metadata manager uses an incremental method to copy the metadata of the target process from the first metadata server to the second metadata server.
[0109] Please refer to Figure 5 , which shows a flowchart of a metadata extension method under a distributed file system provided by an exemplary embodiment of the present disclosure, the distributed file system includes a metadata manager and multiple metadata servers, and this embodiment uses the method used in the metadata manager as an example. The method includes the following steps.
[0110] Step 501: receiving a cluster expansion request sent by a client.
[0111] Expanding a cluster means adding computing resources to the cluster, such as servers, storage, and networks, to improve the processing power, storage capacity, and reliability of the cluster. The request to expand a cluster can be used to indicate the addition of new nodes, that is, adding metadata servers. Metadata servers are servers responsible for storing and managing metadata. They usually contain key information about data storage locations, access rights, data structures, and are core components for data management and retrieval.
[0112] Step 502: Determine the target process to be migrated according to the cluster expansion request. The target process is used to manage metadata. There is a hash mapping relationship between the identifier of the file or directory where the metadata is located and the target process.
[0113] The client is the software that users use to interact with the distributed file system. It can be an application, a web browser, or a mobile app. In the context of cluster management, the client usually refers to the system or user interface that issues management requests (such as expansion, migration, etc.).
[0114] Metadata is data that describes data, which provides information about the organization, storage, format, and properties of the data. In a distributed file system, metadata may include file name, size, creation date, etc.
[0115] There is a hash mapping relationship between the identifier of the file where the metadata is located and the target process, or there is a hash mapping relationship between the identifier of the directory where the metadata is located and the target process. The identifier of the file is used to uniquely indicate the file, and the identifier of the directory is used to uniquely indicate the directory. Hash mapping is a technology that maps data (such as a file name or key) to a specific location (such as a storage location or memory address). The hash function converts an input parameter into an output parameter of a fixed size, and this output parameter is used to determine the storage location of the data in the storage medium. In a distributed file system, hash mapping is used for data distribution and load balancing.
[0116] Step 503: copy the metadata of the target process from the first metadata server to the second metadata server, and adjust the hash mapping relationship, where the second metadata server is different from the first metadata server.
[0117] The target process is one or more processes, the second metadata server is different from the first metadata server, the first metadata server is the source metadata server where the target process is located before migration, and the second metadata server is the target metadata server after the target process is migrated. The first metadata server can be a metadata server with a high load (for example, a load index higher than a preset first load threshold), and the second metadata server can be a metadata server with a low load (for example, a load index lower than a preset second load threshold), and the load level of the first metadata server is higher than the load level of the second metadata server.
[0118] In some embodiments, the metadata of the target process is copied from the first metadata server to the second metadata server in an incremental manner. Incremental replication is a data replication technology that only copies the data that has changed on the source server, rather than copying the entire data set. This method can reduce the amount of data transmission and improve migration efficiency.
[0119] Optionally, continue to process client requests during data migration; stop running the target process when preset conditions are met, copy the remaining data of the target process to the second metadata server, and adjust the hash mapping relationship; after the migration is completed, clean up redundant data on the first metadata server.
[0120] Preset conditions are conditions that need to be met before the system performs a specific action (such as stopping the target process). These conditions can be based on factors such as time, data migration progress, system load, etc.
[0121] Once all metadata has been migrated to the second metadata server, the original hash mapping relationship needs to be updated to reflect the new location of the data. This involves recalculating hash values and associating these values with the new location of the second metadata server. That is, while copying the remaining data of the target process to the second metadata server, the hash mapping relationship corresponding to the metadata is adjusted, that is, a hash mapping relationship is established between the identifier of the file or directory where the metadata is located and the process of the migrated second metadata server.
[0122] Redundant data refers to data that is no longer needed or duplicated in the system. Redundant data includes information related to the target process. During data migration and system maintenance, cleaning up redundant data is an important step to optimize storage space and improve system performance.
[0123] That is, when the metadata of the target process needs to be migrated from one metadata server to another metadata server, the metadata manager can perform the following steps:
[0124] 1. Develop a migration plan: determine the scope of metadata to be migrated and select the target metadata server.
[0125] 2. Preprocessing: Pre-create necessary data structures and indexes on the target metadata server node.
[0126] 3. Incremental synchronization: Incremental synchronization is used to copy the metadata of the target process from the source metadata server to the target metadata server in batches and time periods, while continuing to process client requests. During this process, the metadata manager will continue to respond to client requests to ensure service continuity.
[0127] 4. Switching: When the preset conditions are met, stop running the target process and complete the copying of the remaining metadata, that is, copy the remaining data of the target process to the second metadata server and adjust the hash mapping relationship.
[0128] 5. Cleanup: After the migration is complete, clean up the first metadata server to remove redundant data that is no longer needed, especially information related to the target process, to optimize server performance.
[0129] The beneficial effect of this approach is that the entire migration process is almost transparent to the client, and the system can complete the metadata server reallocation without interrupting the service. In addition, due to the use of incremental synchronization and fast switching strategies, the duration of the migration process is greatly shortened, thereby minimizing the impact on system performance.
[0130] By introducing a metadata manager and implementing this efficient metadata server migration mechanism, the method provided by the embodiment of the present disclosure improves the flexibility and scalability of the distributed file system. System administrators can quickly adjust the scale and composition of the metadata server cluster according to actual needs without worrying about complex data migration issues. This not only simplifies system management, but also provides strong support for dynamic load balancing, effectively reducing performance hot spots in the distributed file system.
[0131] In summary, in terms of achieving efficient load balancing of metadata servers and reducing hot spot issues, the embodiments of the present disclosure, on the one hand, can achieve directory-level load balancing without sacrificing directory operation performance by adopting a hash algorithm based on a directory or file. This method helps to disperse the load of directory operations, thereby effectively reducing the generation of metadata hot spots. On the other hand, the unique identifier of a file or directory is bound to a specific metadata server, and the directory entry is isolated from the index node. Such a design can minimize the cost of the migration process, making metadata migration more efficient and low-cost. On the other hand, a metadata manager is introduced as an intermediate node to accurately control the expansion and contraction of the metadata server cluster. This mechanism allows the metadata server to be quickly and cost-free migrated to any node, further achieving load balancing and reducing hot spot issues.
[0132] In the embodiment of the present disclosure, by performing hash division on the directory, different directories can be evenly divided into multiple metadata servers to reduce metadata hot spots. In an illustrative example, the method includes but is not limited to the following steps: Figure 6 As shown:
[0133] 1. The client performs a pre-check before sending a request to create a directory. A pre-check refers to a series of verification and preparation work performed before performing a specific operation to ensure the smooth progress of the operation and the integrity of the data.
[0134] 2. The client parses and calculates the metadata server 1 where the parent directory is located.
[0135] 3. The client sends a request to create a directory to metadata server 1 where the parent directory is located.
[0136] 4. After receiving the request to create a directory, metadata server 1 determines that the target metadata server is metadata server 2 based on the hot spots of the parent directory and the hot spots of the metadata server cluster, and performs hash calculation based on the unique identifier of the parent directory, the unique identifier of the target directory to be created, and metadata server 2 to determine the mapping relationship between the unique identifier of the parent directory, the unique identifier of the target directory to be created, and metadata server 2.
[0137] 5. Metadata server 1 sends a create directory entry message to metadata server 2.
[0138] 6. After receiving the create directory entry message, metadata server 2 creates a target directory and an index node.
[0139] 7. After metadata server 2 is created, it sends a success message to metadata server 1 node.
[0140] 8. After receiving the creation completion message from metadata server 2, metadata server 1 considers that the directory creation request has been completed, and thus replies with a response message to the client.
[0141] 9. The client receives a response message, confirming that the entire directory creation is complete.
[0142] In the embodiment of the present disclosure, by introducing a metadata manager as a monitoring node, the metadata server is divided into multiple metadata management services, i.e., multiple processes, so that arbitrary expansion and scheduling of metadata server nodes can be achieved, resulting in imperceptible data migration. In an illustrative example, the method includes but is not limited to the following steps: Figure 7 As shown:
[0143] 1. Perform pre-checks.
[0144] 2. The client sends a cluster expansion request to the metadata manager.
[0145] 3. After receiving the request to expand the cluster, the metadata manager calculates the metadata server cluster and finds that the processes that need to be migrated are process A and process C in metadata server 1. There is a hash mapping relationship between process A and process C and the identifier of the file or directory where the metadata to be migrated is located.
[0146] 4. The metadata manager incrementally copies the metadata of process A and process C from metadata server 1 to metadata server 2, and continues to process client requests during the data migration process.
[0147] 5. When the preset conditions are met, the metadata manager stops running process A and process C, copies the remaining data of process A and process C to metadata server 2, and adjusts the hash mapping relationship; after the migration is completed, cleans up the redundant data of metadata server 1.
[0148] 6. The metadata manager sends a create process operation to metadata server 1 and metadata server 2, that is, sends an operation to create process E and process F to metadata server 1, and sends an operation to create process G and process H to metadata server 2.
[0149] 7. The metadata manager replies with a response message to the client, and the client considers that the expansion request has been completed.
[0150] In summary, the embodiments of the present disclosure provide a metadata extension method in a distributed system. The method adopts a hash algorithm based on directories or files to evenly distribute directories to multiple metadata service nodes, bind the unique identifier of the file / directory to a specific metadata server, and separate the directory entry from the index node, so as to achieve load balancing at the directory level without reducing the directory operation performance, thereby reducing metadata hot spots. In addition, the embodiments of the present disclosure introduce a metadata manager as a monitoring node to perform dynamic scheduling and load balancing of the metadata server cluster, and design the metadata server as a stateless service, using the object storage service as the back-end storage, and by minimizing the data migration cost, the metadata server can be quickly and cost-freely moved to any node, thereby achieving load balancing, reducing hot spots, and significantly reducing the impact on the business. Compared with traditional methods, the embodiments of the present disclosure provide better load balancing capabilities, lower data migration costs, and higher scalability.
[0151] The following is an apparatus embodiment of the present disclosure. For parts not described in detail in the apparatus embodiment, reference may be made to the technical details disclosed in the above method embodiment.
[0152] Please refer to Figure 8, which shows a schematic diagram of the structure of a metadata expansion device under a distributed file system provided by an exemplary embodiment of the present disclosure. The device can implement all or part of a distributed file system through software, hardware, or a combination of both. The device includes: a receiving module 82, a determining module 83, and an expansion module 84.
[0153] The receiving module 82 is used to receive a cluster expansion request sent by a client;
[0154] A determination module 83 is used to determine a target process to be migrated according to the cluster expansion request, where the target process is used to manage metadata, and a hash mapping relationship exists between an identifier of a file or directory where the metadata is located and the target process;
[0155] The expansion module 84 is used to copy the metadata of the target process from the first metadata server to the second metadata server and adjust the hash mapping relationship, and the second metadata server is different from the first metadata server.
[0156] In a possible implementation, the extension module 84 is further used to: incrementally copy the metadata of the target process from the first metadata server to the second metadata server, and continue to process client requests during the data migration process;
[0157] When the preset conditions are met, the target process is stopped, the remaining data of the target process is copied to the second metadata server, and the hash mapping relationship is adjusted;
[0158] After the migration is completed, the redundant data of the first metadata server is cleaned up.
[0159] In another possible implementation, the apparatus further includes: an allocation module, configured to:
[0160] A directory creation request is received from a client, where the directory creation request includes a directory identifier of a target directory to be created;
[0161] According to the directory identifier of the target directory, a corresponding hash value is determined by a preset hash function;
[0162] According to the hash value, the target directory is assigned to the target metadata server, so that the target metadata server creates the target directory.
[0163] In another possible implementation, the allocation module is further configured to:
[0164] Determine a corresponding hash value by using a preset hash function according to the directory identifier of the parent directory of the target directory and the directory identifier of the target directory;
[0165] The directory identifier of the parent directory is used to uniquely identify the parent directory among multiple directories, and the directory identifier of the target directory is used to uniquely identify the target directory among multiple directories.
[0166] In another possible implementation, the apparatus further includes: a binding module, configured to:
[0167] Bind the directory identifier or file identifier of the target directory to the process of the target metadata server, and separate the directory entry of the target directory from the index node;
[0168] The file identifier is used to uniquely identify a target file in a target directory among multiple files.
[0169] In another possible implementation, the apparatus further includes: a reallocation module, configured to:
[0170] When any one of the multiple metadata servers fails, the directory identifier or file identifier bound to the failed metadata server is reallocated to the process of another metadata server.
[0171] In another possible implementation, the distributed file system further includes a metadata manager, and the device further includes: an adjustment module, configured to:
[0172] The metadata manager monitors key indicators of each of the plurality of metadata servers to obtain monitoring data, wherein the key indicators include at least one of load condition, response time, and storage utilization rate;
[0173] The metadata manager dynamically adjusts the process distribution of multiple metadata servers based on monitoring data, and each metadata server carries one or more processes.
[0174] It should be noted that the device provided in the above embodiment only uses the division of the above-mentioned functional modules as an example to implement its functions. In practical applications, the above-mentioned functions can be assigned to different functional modules according to actual needs, that is, the content structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0175] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0176] The embodiment of the present disclosure also provides a metadata expansion device under a distributed file system, the device comprising: a processor; a memory for storing processor executable instructions; wherein the processor is configured to implement the above method when executing the instructions stored in the memory.
[0177] The embodiment of the present disclosure further provides a non-volatile computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by a processor, the above method is implemented.
[0178] The embodiment of the present disclosure also provides a computer program product, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of a computing device, the processor in the computing device executes the above method.
[0179] Fig. 9 1 is a block diagram of a device 1900 for executing a metadata extension method in a distributed file system according to an exemplary embodiment. For example, the device 1900 may be provided as a server. Fig. 9 , the apparatus 1900 includes a processing component 1922, which further includes one or more processors, and a memory resource represented by a memory 1932 for storing instructions, such as an application, that can be executed by the processing component 1922. The application stored in the memory 1932 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 1922 is configured to execute instructions to perform the above method.
[0180] The device 1900 may also include a power supply component 1926 configured to perform power management of the device 1900, a wired or wireless network interface 1950 configured to connect the device 1900 to a network, and an input / output interface 1958 (I / O interface). The device 1900 may operate based on an operating system stored in the memory 1932, such as Windows Server 2000. TM , MacOS X TM , Unix TM ,Linux TM , FreeBSD TM or similar.
[0181] In an exemplary embodiment, a non-volatile computer-readable storage medium is also provided, such as a memory 1932 including computer program instructions, which can be executed by the processing component 1922 of the device 1900 to perform the above method.
[0182] The present disclosure may be a system, a method and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for causing a processor to implement various aspects of the present disclosure.
[0183] A computer-readable storage medium may be a tangible device that can hold and store instructions used by an instruction execution device. A computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples of computer-readable storage media (a non-exhaustive list) include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination of the foregoing. As used herein, a computer-readable storage medium is not to be interpreted as a transient signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., a light pulse through a fiber optic cable), or an electrical signal transmitted through a wire.
[0184] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.
[0185] The computer program instructions for performing the operation of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages, such as Smalltalk, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. Computer-readable program instructions may be executed completely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider to connect via the Internet). In some embodiments, an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), may be customized by utilizing the state information of the computer-readable program instructions, and the electronic circuit may execute the computer-readable program instructions, thereby realizing various aspects of the present disclosure.
[0186] Various aspects of the present disclosure are described herein with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.
[0187] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0188] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0189] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and the part of the module, program segment or instruction contains one or more executable instructions for realizing the specified logical function. In some alternative implementations, the function marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or action, or can be implemented with a combination of special hardware and computer instructions.
[0190] The embodiments of the present disclosure have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or technical improvements in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.
Claims
1. A metadata extension method in a distributed file system, characterized in that: The distributed file system includes a plurality of metadata servers, and the method includes: Receive a cluster expansion request from the client; Determine a target process to be migrated according to the cluster expansion request, where the target process is used to manage metadata, and a hash mapping relationship exists between an identifier of a file or directory where the metadata is located and the target process; The metadata of the target process is copied from a first metadata server to a second metadata server, and the hash mapping relationship is adjusted, wherein the second metadata server is different from the first metadata server.
2. The method according to claim 1, characterized in that: The step of copying the metadata of the target process from the first metadata server to the second metadata server and adjusting the hash mapping relationship includes: Incrementally copying the metadata of the target process from the first metadata server to the second metadata server, and continuing to process client requests during the data migration process; When a preset condition is met, stop running the target process, copy the remaining data of the target process to the second metadata server, and adjust the hash mapping relationship; After the migration is completed, the redundant data of the first metadata server is cleaned up.
3. The method according to claim 2, characterized in that The method further comprises: A directory creation request is received from a client, wherein the directory creation request includes a directory identifier of a target directory to be created; According to the directory identifier of the target directory, a corresponding hash value is determined by a preset hash function; According to the hash value, the target directory is allocated to a target metadata server so that the target metadata server creates the target directory.
4. The method according to claim 3, characterized in that The determining a corresponding hash value by using a preset hash function according to the directory identifier of the target directory includes: Determine the corresponding hash value by using the preset hash function according to the directory identifier of the parent directory of the target directory and the directory identifier of the target directory; The directory identifier of the parent directory is used to uniquely identify the parent directory among multiple directories, and the directory identifier of the target directory is used to uniquely identify the target directory among multiple directories.
5. The method according to claim 3, characterized in that: The method further comprises: Binding the directory identifier or file identifier of the target directory to the process of the target metadata server, and separating the directory entry of the target directory from the index node; The file identifier is used to uniquely identify the target file in the target directory among multiple files.
6. The method according to claim 5, characterized in that The method further comprises: When any one of the multiple metadata servers fails, the directory identifier or file identifier bound to the failed metadata server is reallocated to a process of another metadata server.
7. The method according to any one of claims 1 to 6, characterized in that: The distributed file system further includes a metadata manager, and the method further includes: The metadata manager monitors key indicators of each of the plurality of metadata servers to obtain monitoring data, wherein the key indicators include at least one of load condition, response time, and storage utilization rate; The metadata manager dynamically adjusts the process distribution of the plurality of metadata servers according to the monitoring data, and each of the metadata servers carries one or more processes.
8. A metadata expansion device under a distributed file system, characterized in that: The distributed file system includes a plurality of metadata servers, and the device includes: A receiving module, used to receive a cluster expansion request sent by a client; A determination module, used to determine a target process to be migrated according to the cluster expansion request, wherein the target process is used to manage metadata, and an identifier of a file or directory where the metadata is located has a hash mapping relationship with the target process; An extension module is used to copy the metadata of the target process from a first metadata server to a second metadata server and adjust the hash mapping relationship, wherein the second metadata server is different from the first metadata server.
9. A computing device, characterized in that The computing device comprises: processor; a memory for storing processor-executable instructions; The processor is configured to implement the method described in any one of claims 1 to 7 when executing the instructions stored in the memory.
10. A non-volatile computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Method for distributing metadata of distributed type file system
CN101692239A
Method and system for load balancing of metadata management in distributed file system
CN101697526A
Distributed file system metadata management method facing to high-performance calculation
CN103150394A
System for live -migration and automated recovery of applications in a distributed system
CN104115469A
Data synchronization method and device and storage medium
CN111831748A
Cited By
Metadata management method and device for distributed storage
CN119557107A
Redis cluster federated data routing method and device, equipment, medium and product
CN120811974A
