Data replication method for distributed file system, and distributed file system
The file semantic layer-based data replication method simplifies distributed file system development and enhances performance by using a unified approach for synchronous and asynchronous replication.
Patent Information
- Authority / Receiving Office
- HK · HK
- Patent Type
- Applications
- Current Assignee / Owner
- HUAWEI CLOUD COMPUTING TECHNOLOGIES CO LTD
- Filing Date
- 2026-05-14
- Publication Date
- 2026-07-17
Smart Images

Figure 00000000_0000_ABST
Abstract
Description
(19) State Intellectual Property Office (12) Invention Patent Application (10) Application Publication Number (43) Application Publication Date (21) Application Number 202410800089.3 (22) Application Date 2024.06.19 (66) Domestic Priority Data 202410703584.2 2024.05.31 CN (71) Applicant Huawei Cloud Computing Technology Co., Ltd. Address 550025, Guizhou Province, Guiyang City, Guian New District, Qianzhong Avenue, Xinggong Road, Huawei Cloud Data Center (72) Inventors Zhu Tingwei, Wang Daohui, Qin Yantang, Zhao Xingcheng (74) Patent Agency Beijing Sangao Yongxin Intellectual Property Agency Co., Ltd. 11138 Patent Attorney Li Fang (51) Int.Cl. G06F 16 / 182 (2019.01) (54) Invention Title Data Replication Method and Distributed File System of Distributed File System (57) Abstract This application provides a data replication method and a distributed file system of distributed file system, which belongs to the field of storage technology. In this method, the first storage cluster executes the first operation request based on the semantics of the first operation request for the file and generates an operation log corresponding to the semantics of the first operation request. This operation log is then sent to the second storage cluster. The second storage cluster replays the first operation request based on the operation log. In this method, generating the operation log based on the semantics of the operation request and replaying the operation request based on the operation log achieves data replication at the file semantic layer. Compared to implementing data replication at the block layer, this method does not rely on the replication capabilities of the block layer and can use a single data replication scheme to achieve both synchronous and asynchronous replication capabilities. This eliminates the need for different block layer schemes to implement synchronous and asynchronous replication, thereby reducing the complexity of system development and maintenance and improving data replication performance. Claims 6 pages, Description 31 pages, Drawings 9 pages, CN 121051082 A 2025.12.02 CN 1 21 05 10 82 A 1. A data replication method in a distributed file system, characterized in that it is executed by a first storage cluster in the distributed file system, the distributed file system further comprising a second storage cluster, the method comprising: receiving a first operation request for a file; executing the first operation request based on the semantics of the first operation request; obtaining an execution result corresponding to the semantics of the first operation request, the execution result including at least one of an execution result for the data of the file and an execution result for the metadata of the file; generating an operation log for the first operation request based on the execution result and the execution order of the first operation request; sending the operation log to the second storage cluster, the operation log being used by the second storage cluster to replay the first operation request.2. The method according to claim 1, characterized in that, the step of executing the first operation request based on the semantics of the first operation request to obtain an execution result corresponding to the semantics of the first operation request, and generating an operation log for the first operation request based on the execution result and the execution order of the first operation request, includes: if the first operation request is an operation request on the metadata of the file, then executing the first operation request to obtain an execution result on the metadata of the file, generating a metadata operation log based on the execution result on the metadata of the file, and generating an operation log for the first operation request based on the metadata operation log and the execution order of the first operation request; if the first operation request is an operation request on the data of the file, then executing the first operation request to obtain an execution result on the data of the file and an execution result on the metadata of the file, generating a data operation log based on the execution result on the data of the file, generating a metadata operation log based on the execution result on the metadata of the file, and generating an operation log for the first operation request based on the metadata operation log, the data operation log, and the execution order of the first operation request. 3. The method according to claim 2, wherein the first storage cluster includes a first network attached storage (NAS) server cluster and a first metadata storage node; the step of executing the first operation request if it is an operation request on the metadata of the file, obtaining an execution result on the metadata of the file, generating a metadata operation log based on the execution result on the metadata of the file, and generating an operation log for the first operation request based on the metadata operation log and the execution order of the first operation request, includes: if the first operation request is an operation request on the metadata of the file, the first NAS server cluster sends the metadata targeted by the first operation request to the first metadata storage node; the first metadata storage node assigns a logical sequence number to the first operation request, executes the first operation request on the metadata, obtains an execution result on the metadata of the file, generates the metadata operation log based on the execution result on the metadata of the file, wherein the logical sequence number is used to indicate the execution order of the first operation request; and the first NAS server generates the operation log for the first operation request based on the metadata operation log and the execution order of the first operation request. 4. The method according to claim 2, wherein the first storage cluster comprises a first NAS server cluster, a first metadata storage node, and a first data storage cluster; wherein if the first operation request is an operation request on the data of the file, the first operation request is executed to obtain the execution result on the data of the file and the execution result on the metadata of the file, based on the operation request on the file...The execution result of the file's data generates a data operation log. Based on the execution result of the file's metadata, a metadata operation log is generated. Based on the metadata operation log, the data operation log, and the execution order of the first operation request, an operation log for the first operation request is generated, including: If the first operation request is an operation request for the file's data, the first NAS server cluster sends the data carried by the first operation request to the first data storage cluster; The first data storage cluster executes the first operation request on the data carried by the first operation request to obtain the execution result of the file's data, and generates the data operation log based on the execution result of the file's data; The first NAS server cluster sends the metadata targeted by the first operation request to the first metadata storage node; The first metadata storage node assigns a logical sequence number to the first operation request, executes the first operation request on the metadata to obtain the execution result of the file's metadata, and generates the metadata operation log based on the execution result of the file's metadata, wherein the logical sequence number is used to indicate the execution order of the first operation request; The first NAS server cluster generates the operation log of the first operation request based on the data operation log, the metadata operation log, and the logical sequence number of the first operation request. 5. The method according to claim 3, wherein the first NAS server cluster includes at least one first NAS server and at least one second NAS server, the first NAS server is used to receive and forward operation requests, and the second NAS server is used to generate and forward operation logs of operation requests; the first NAS server cluster generates the operation log of the first operation request based on the metadata operation log and the logical sequence number of the first operation request, including any one of the following: the first NAS server receives the metadata operation log and the logical sequence number of the first operation request sent by the first metadata storage node, sends the metadata operation log and the logical sequence number of the first operation request to the second NAS server, the second NAS server generates the operation log of the first operation request based on the metadata operation log and the logical sequence number of the first operation request; the second NAS server obtains the metadata operation log from the first metadata storage node according to the logical sequence number of the first operation request, and generates the operation log of the first operation request based on the metadata operation log and the logical sequence number of the first operation request. 6. The method according to claim 4, wherein the first NAS server cluster includes multiple first NAS servers.A server and at least one second NAS server, wherein the first NAS server is used to receive and forward operation requests, and the second NAS server is used to generate and forward operation logs for the operation requests; the first NAS server cluster generates the operation log for the first operation request based on the data operation log, the metadata operation log, and the logical sequence number of the first operation request, including any one of the following: the first NAS server receives the metadata operation log and the logical sequence number of the first operation request sent by the first metadata storage node, sends the metadata operation log, the logical sequence number of the first operation request, and the data carried by the first operation request to the second NAS server, and the second NAS server generates the operation log for the first operation request based on the data operation log, the metadata operation log, and the logical sequence number of the first operation request; the second NAS server obtains the metadata operation log from the first metadata storage node based on the logical sequence number of the first operation request, obtains the data carried by the first operation request from the first data storage cluster based on the metadata operation log, and generates the operation log for the first operation request based on the data operation log, the metadata operation log, and the logical sequence number of the first operation request. 7. The method according to claim 5 or 6, wherein each first NAS server is associated with a second NAS server, each first NAS server is used to receive and forward a set of operation requests, and the generation and forwarding of operation logs for the set of operation requests received and forwarded by each first NAS server are performed by the second NAS server associated with the first NAS server. 8. The method according to any one of claims 5 to 7, wherein the first NAS server and the second NAS server are the same NAS server. 9. A data replication method in a distributed file system, wherein the replication is performed by a second storage cluster in the distributed file system, the distributed file system further comprising a first storage cluster, the method comprising: receiving an operation log sent by the first storage cluster, the operation log indicating an execution result corresponding to the semantics of a first operation request and the execution order of the first operation request, the first operation request being an operation request for a file, the execution result including at least one of an execution result for the data of the file and an execution result for the metadata of the file; replaying the first operation request based on the operation log. 10. The method according to claim 9, wherein replaying the first operation request based on the operation log comprises:The method according to claim 10, wherein storing the operation log based on the execution order of the first operation request comprises: if the operation log includes a metadata operation log, storing the metadata operation log based on the execution order of the first operation request, wherein the metadata operation log indicates the execution result of the metadata of the file; if the operation log includes a metadata operation log and a data operation log, storing the metadata operation log and the data operation log based on the execution order of the first operation request, wherein the data operation log indicates the execution result of the data of the file. 12. The method according to claim 11, wherein the second storage cluster includes a second network attached storage (NAS) server cluster and a second data storage cluster, the second NAS server cluster is used to receive operation logs sent by the first storage cluster, the second data storage cluster includes multiple data storage nodes, each data storage node including at least one storage partition; the step of storing the metadata operation log based on the execution order of the first operation request, wherein the metadata operation log indicates the execution result of the metadata of the file, includes: if the operation log includes the metadata operation log, the second NAS server cluster determines a first storage partition in the second data storage cluster based on the logical sequence number of the first operation request in the operation log, and stores the metadata operation log in the first storage partition, wherein the logical sequence number is used to indicate the execution order of the first operation request. 13. The method according to claim 11, wherein the second storage cluster includes a second NAS server cluster and a second data storage cluster, the second NAS server cluster is used to receive operation logs sent by the first storage cluster, the second data storage cluster includes multiple data storage nodes, each data storage node including at least one storage partition; wherein if the operation log includes metadata operation logs and data operation logs, the metadata operation logs and the data operation logs are stored based on the execution order of the first operation request, the data operation logs indicating the execution result of the data of the file, including: if the operation log includes metadata operation logs and data operation logs, the second NAS server cluster determines the second storage partition in the second data storage cluster based on the logical sequence number of the first operation request in the operation logs, and stores the metadata operation logs in the second storage partition;The second NAS server cluster, based on the metadata operation log, divides the data carried by the first operation request in the data operation log into at least one data block, determines at least one third storage partition in the second storage cluster, and stores one data block and the logical sequence number of the first operation request in one of the third storage partitions. 14. The method according to claim 12 or 13, wherein the second NAS server cluster includes multiple third NAS servers, each of the third NAS servers is used to execute a stored procedure for the operation log of a set of operation requests, and the stored procedures for the operation logs of different sets of operation requests can be executed in parallel. 15. The method according to any one of claims 10 to 14, characterized in that, the step of replaying the first operation request based on the operation log includes: adding the first operation request to a waiting replay queue according to the execution order of the first operation request; if the first operation request is an operation request on the metadata of the file, when the first operation request meets the first concurrent replay condition, adding the first operation request to the metadata concurrent replay queue according to the execution order of the first operation request, performing metadata replay on the first operation request, and adding the first operation request from the metadata replay queue to the replay queue, wherein the first concurrent replay condition indicates that the first operation request and the operation requests in the metadata concurrent replay queue are not mutually exclusive, and multiple operation requests in the metadata concurrent replay queue can be replayed concurrently; If the first operation request is a data operation request on the file, when the first operation request meets the second concurrent replay condition, the first operation request is added to the data concurrent replay queue according to the execution order of the first operation request, and data replay is performed on the first operation request. When the first operation request meets the first concurrent replay condition, the first operation request is added from the data concurrent replay queue to the metadata concurrent replay queue according to the execution order of the first operation request, and metadata replay is performed on the first operation request. The first operation request is added from the metadata replay queue to the replayed queue. The second concurrent replay condition indicates that the first operation request and the operation requests in the data concurrent replay queue are not mutually exclusive, and multiple operation requests in the data concurrent replay queue can be replayed concurrently. 16. The method according to claim 15, wherein the second storage cluster further includes a second metadata storage node; the execution of metadata replay on the first operation request includes: the second NAS server cluster obtains the metadata operation log from the second data storage cluster and sends the metadata operation log to the second metadata storage node;The second metadata storage node performs metadata replay on the first operation request based on the metadata operation log. 17. The method according to claim 15, wherein the second storage cluster further includes a second metadata storage node, each of the storage partitions includes a data storage partition and a metadata storage partition, and the data carried by the first operation request and the logical sequence number of the first operation request are stored in the metadata storage partition of the third storage partition; the data replay on the first operation request includes: the second NAS server cluster obtains the metadata operation log from the second data storage cluster and sends the metadata operation log to the second metadata storage node; the second metadata storage node determines the plurality of third storage partitions in the second storage cluster based on the metadata operation log, and writes the data carried by the first operation request in the third storage partition from the metadata storage partition of the third storage partition to the data storage partition of the third storage partition. 18. The method according to claim 16 or 17, wherein the second NAS server cluster includes a plurality of fourth NAS servers, each of the fourth NAS servers is used to execute a replay process of a set of operation requests, and the replay processes of different sets of operation requests can be executed in parallel. 19. The method according to claim 18, wherein the third NAS server and the fourth NAS server are the same NAS server. 20. A data replication method for a distributed file system, characterized in that it is applied to a distributed file system, the distributed file system comprising a first storage cluster and a second storage cluster, the method comprising: the first storage cluster receiving a first operation request for a file, executing the first operation request based on the semantics of the first operation request, obtaining an execution result corresponding to the semantics of the first operation request, the execution result including at least one of an execution result for the data of the file and an execution result for the metadata of the file; the first storage cluster generating an operation log for the first operation request based on the execution result and the execution order of the first operation request; the first storage cluster sending the operation log to the second storage cluster; the second storage cluster receiving the operation log sent by the first storage cluster, and replaying the first operation request based on the operation log. 21. A distributed file system, characterized in that the distributed file system comprises: a first storage cluster, configured to: receive a first operation request for a file, execute the first operation request based on the semantics of the first operation request, obtaining an execution result corresponding to the semantics of the first operation request, the execution result including an execution result for the data of the file and an execution result for the metadata of the file.At least one of the execution result of the data and the execution result of the metadata of the file; Based on the execution result and the execution order of the first operation request, generate an operation log of the first operation request; Send the operation log to the second storage cluster; The second storage cluster is configured to: Receive the operation log sent by the first storage cluster, and replay the first operation request based on the operation log. 22. A storage node, characterized in that the storage node includes a memory and a processor; The processor is configured to execute instructions stored in the memory to cause the storage node to perform a data replication method in a distributed file system as described in any one of claims 1 to 20. 23. A storage cluster, characterized in that the storage cluster includes at least one storage node, each storage node including a memory and a processor; The processor of the at least one storage node is configured to execute instructions stored in the memory of the at least one storage node to cause the storage cluster to perform a data replication method in a distributed file system as described in any one of claims 1 to 20. 24. A computer program product comprising instructions, characterized in that, when the instructions are executed by a storage node, the storage node performs a data replication method in a distributed file system as described in any one of claims 1 to 20, or, when the instructions are executed by a storage cluster, the storage cluster performs a data replication method in a distributed file system as described in any one of claims 1 to 20. 25. A computer-readable storage medium, characterized in that it comprises computer program instructions, which, when executed by a storage node, perform a log synchronization method as described in any one of claims 1 to 20, or, when executed by a storage cluster, perform a data replication method in a distributed file system as described in any one of claims 1 to 20. Claims 6 / 6 Page 7 CN 121051082 A Data Replication Method and Distributed File System in a Distributed File System
[0001] This application claims priority to Chinese Patent Application No. 202410703584.2, filed on May 31, 2024, entitled “File Operation Log Processing Method and File System”, the entire contents of which are incorporated herein by reference. Technical Field
[0002] This application relates to the field of storage technology, and in particular to a data replication method for a distributed file system and a distributed file system. Background Art
[0003] A distributed file system includes multiple storage nodes, and the multiple storage nodes store files in units of physical blocks.Considering the high reliability and stability of the business, the storage nodes of the distributed file system can be networked in a master-slave configuration. That is, the distributed file system includes a master storage cluster and a slave storage cluster. Based on this network configuration, when copying data between the master and slave, it can be based on physical blocks and adopt synchronous or asynchronous replication modes.
[0004] However, the above-mentioned synchronous or asynchronous replication modes are based on physical blocks. When a storage node executes an operation request for a file in a distributed file system, it may decompose it into multiple operations on physical blocks. The backup storage cluster synchronizes the physical block operations of the primary storage cluster. In synchronous replication mode, all physical block operations are copied from the primary storage cluster to the backup storage cluster in real time, without needing to consider historical data versions. In asynchronous replication mode, it is necessary to ensure that the operations received by the backup storage cluster can be restored to a consistent data version at a certain historical moment (i.e., the complete set of physical block operations corresponding to the file operation request at that time). Therefore, the physical block-based replication method requires different schemes to be designed for synchronous and asynchronous replication modes, which makes the development and maintenance of distributed file systems more complex. In addition, the replication capability of a distributed file system depends on the system's replication capability of physical blocks, resulting in low data replication performance between the primary and backup ends. Summary of the Invention
[0005] The embodiments of this application provide a data replication method and a distributed file system for a distributed file system, which can reduce the complexity of development and maintenance of distributed file systems and improve data replication performance. The technical solution is as follows:
[0006] In a first aspect, a data replication method in a distributed file system is provided, which is executed by a first storage cluster in the distributed file system. The distributed file system further includes a second storage cluster. The method includes:
[0007] The first storage cluster receives a first operation request for a file, executes the first operation request based on the semantics of the first operation request, and generates an operation log corresponding to the semantics of the first operation request. The operation log is used to indicate at least one of the execution result of the file data and the execution result of the file metadata. The first storage cluster sends the operation log to the second storage cluster, and then the second storage cluster replays the first operation request based on the operation log.
[0008] Wherein, the semantics of the operation request is used to indicate whether the operation request is an operation request for the file metadata or an operation request for the file data. The file data is used to describe the actual content of the file. The file data includes the file content, which can be text, audio, video, etc. The file metadata is used to describe the characteristics of the file. The file metadata includes the file name, file size, file index node (inode), and storage location of data blocks.The file must contain at least one of the following information: address, file creation time, owner, and permissions. The storage address of the data block can be represented by two parameters: offset and length. This application does not limit the content of the file's data and metadata. Operation requests on the file's metadata include requests to create and delete files, while operation requests on the file's data include requests to write data to the file.
[0009] In the above method, generating an operation log based on the semantics of the file operation requests and replaying the operation requests based on the operation log is a data replication method implemented at the file semantic layer. Compared to implementing data replication at the block layer, this method does not rely on the replication capabilities of the block layer and can use a single data replication scheme to achieve synchronous and asynchronous replication capabilities. Therefore, it eliminates the need for different block layer scheme designs to achieve synchronous and asynchronous replication, thereby reducing the complexity of system development and maintenance and improving data replication performance.
[0010] In one possible implementation, based on the semantics of the first operation request, the first operation request is executed to obtain an execution result corresponding to the semantics of the first operation request. Based on the execution result and the execution order of the first operation request, an operation log of the first operation request is generated, including:
[0011] If the first operation request is an operation request on the metadata of a file, the first operation request is executed to obtain an execution result on the metadata of the file. Based on the execution result on the metadata of the file, a metadata operation log is generated. Based on the metadata operation log and the execution order of the first operation request, an operation log of the first operation request is generated. If the first operation request is an operation request on the data of a file, the first operation request is executed to obtain an execution result on the data of the file and an execution result on the metadata of the file. Based on the execution result on the data of the file, a data operation log is generated. Based on the execution result on the metadata of the file, a metadata operation log is generated. Based on the metadata operation log, the data operation log, and the execution order of the first operation request, an operation log of the first operation request is generated.
[0012] In one possible implementation, the first storage cluster includes a first network attached storage (NAS) server cluster and a first metadata storage node;
[0013] If the first operation request is an operation request on the metadata of a file, then the first operation request is executed to obtain the execution result of the metadata of the file. Based on the execution result of the metadata of the file, a metadata operation log is generated. Based on the metadata operation log and the execution order of the first operation request, an operation log of the first operation request is generated, including:
[0014] If the first operation request is an operation request on the metadata of a file, then the first NAS server cluster sends the metadata targeted by the first operation request to the first metadata storage node; the first metadata storage node distributes the metadata of the first operation request to the first metadata storage node.Assign a logical sequence number, execute the first operation request on the metadata, obtain the execution result of the metadata of the file, and generate a metadata operation log based on the execution result of the metadata of the file. The logical sequence number is used to indicate the execution order of the first operation request; the first NAS server generates the operation log of the first operation request based on the metadata operation log and the execution order of the first operation request.
[0015] In one possible implementation, the first storage cluster includes a first NAS server cluster, a first metadata storage node, and a first data storage cluster;
[0016] If the first operation request is a data operation request for a file, then the first operation request is executed to obtain the execution result of the data on the file and the execution result of the metadata on the file. Based on the execution result of the data on the file, a data operation log is generated. Based on the execution result of the metadata on the file, a metadata operation log is generated. Based on the execution order of the metadata operation log, the data operation log, and the first operation request, an operation log for the first operation request is generated, including:
[0017] If the first operation request is a data operation request for a file, then the first NAS server cluster sends the data carried by the first operation request to the first data storage cluster; the first data storage cluster executes the first operation request on the data carried by the first operation request to obtain the execution result of the data on the file. Based on the execution result of the data on the file, a data operation log is generated. According to the operation log; the first NAS server cluster sends the metadata targeted by the first operation request to the first metadata storage node; the first metadata storage node assigns a logical sequence number to the first operation request, executes the first operation request on the metadata, obtains the execution result of the metadata of the file, and generates a metadata operation log based on the execution result of the metadata of the file. The logical sequence number is used to indicate the execution order of the first operation request; the first NAS server cluster generates the operation log of the first operation request based on the data operation log, the metadata operation log, and the logical sequence number of the first operation request.
[0018] In one possible implementation, the first NAS server cluster includes at least one first NAS server and at least one second NAS server. The first NAS server is used to receive and forward operation requests, and the second NAS server is used to generate and forward operation logs for the operation requests.
[0019] The first NAS server cluster generates an operation log for the first operation request based on the metadata operation log and the logical sequence number of the first operation request, including any one of the following:
[0020] The first NAS server receives the metadata operation log and the logical sequence number of the first operation request sent by the first metadata storage node, and sends the metadata operation log and the logical sequence number of the first operation request to the second NAS server. The second NAS server generates an operation log for the first operation request based on the metadata operation log and the logical sequence number of the first operation request.Log the operation; the second NAS server retrieves the metadata operation log from the first metadata storage node according to the logical sequence number of the first operation request, and generates the operation log of the first operation request based on the metadata operation log and the logical sequence number of the first operation request.
[0021] In one possible implementation, the first NAS server cluster includes multiple first NAS servers and at least one second NAS server. The first NAS servers are used to receive and forward operation requests, and the second NAS servers are used to generate and forward operation logs for the operation requests.
[0022] The first NAS server cluster generates the operation log for the first operation request based on the data operation log, the metadata operation log, and the logical sequence number of the first operation request, including any one of the following:
[0023] The first NAS server receives the metadata operation log and the logical sequence number of the first operation request sent by the first metadata storage node, and sends the metadata operation log, the logical sequence number of the first operation request, and the data carried by the first operation request to the second NAS server. The second NAS server generates the operation log for the first operation request based on the data operation log, the metadata operation log, and the logical sequence number of the first operation request. The second NAS server obtains the metadata operation log from the first metadata storage node based on the logical sequence number of the first operation request, obtains the data carried by the first operation request from the first data storage cluster based on the metadata operation log, and generates the operation log for the first operation request based on the data operation log, the metadata operation log, and the logical sequence number of the first operation request.
[0024] In one possible implementation, each first NAS server is associated with a second NAS server, and each first NAS server is used to receive and forward a set of operation requests. The generation and forwarding of operation logs for the set of operation requests received and forwarded by each first NAS server are performed by the second NAS server associated with the first NAS server.
[0025] In one possible implementation, the first NAS server and the second NAS server are the same NAS server.
[0026] In a second aspect, a data replication method in a distributed file system is provided, which is performed by a second storage cluster in the distributed file system. The distributed file system further includes a first storage cluster. The method includes:
[0027] Receiving an operation log sent by the first storage cluster, the operation log indicating the execution result and the execution order of the first operation request corresponding to the semantics of the first operation request, wherein the first operation request is an operation request for a file, and the execution result includes at least one of the execution result of the file data and the execution result of the file metadata; and replaying the first operation request based on the operation log.
[0028] In one possible implementation, replaying the first operation request based on the operation log includes: Specification 3 / 31 pages 10 CN 121051082 A
[0029] The operation log is stored based on the execution order of the first operation request; the first operation request is replayed based on the operation log.
[0030] In one possible implementation, storing the operation log based on the execution order of the first operation request includes:
[0031] If the operation log includes a metadata operation log, the metadata operation log is stored based on the execution order of the first operation request, and the metadata operation log indicates the execution result of the file's metadata; if the operation log includes a metadata operation log and a data operation log, the metadata operation log and the data operation log are stored based on the execution order of the first operation request, and the data operation log indicates the execution result of the file's data.
[0032] In one possible implementation, the second storage cluster includes a second NAS server cluster and a second data storage cluster. The second NAS server cluster is used to receive operation logs sent by the first storage cluster. The second data storage cluster includes multiple data storage nodes, and each data storage node includes at least one storage partition.
[0033] If the operation log includes metadata operation logs, then based on the execution order of the first operation request, the metadata operation logs are stored to indicate the execution result of the metadata of the file, including:
[0034] If the operation log includes metadata operation logs, then the second NAS server cluster determines the first storage partition in the second data storage cluster based on the logical sequence number of the first operation request in the operation log, and stores the metadata operation logs in the first storage partition. The logical sequence number is used to indicate the execution order of the first operation request.
[0035] In one possible implementation, the second storage cluster includes a second NAS server cluster and a second data storage cluster. The second NAS server cluster is used to receive operation logs sent by the first storage cluster. The second data storage cluster includes multiple data storage nodes, and each data storage node includes at least one storage partition.
[0036] If the operation log includes metadata operation logs and data operation logs, the metadata operation logs and data operation logs are stored based on the execution order of the first operation request. The data operation logs indicate the execution result of the data on the file, including:
[0037] If the operation log includes metadata operation logs and data operation logs, the second NAS server cluster determines the second storage partition in the second data storage cluster based on the logical sequence number of the first operation request in the operation log, and stores the metadata operation log in the second storage partition. Based on the metadata operation logs, the second NAS server cluster divides the data carried by the first operation request in the data operation log into at least one data block, determines at least one third storage partition in the second storage cluster, and stores a data block and the logical sequence number of the first operation request in a third storage partition.
[0038] In one possible implementation, the second NAS server cluster includes multiple third NAS servers, each of which is used to execute a stored procedure for the operation logs of a set of operation requests, and the stored procedures for the operation logs of different sets of operation requests can be executed in parallel.
[0039] In one possible implementation, replaying the first operation request based on the operation log includes:
[0040] Adding the first operation request to the waiting replay queue according to the execution order of the first operation request; if the first operation request is an operation request on file metadata, when the first operation request meets the first concurrent replay condition, adding the first operation request to the metadata concurrent replay queue according to the execution order of the first operation request, performing metadata replay on the first operation request, and adding the first operation request from the metadata replay queue to the already replayed queue, the first concurrent replay condition indicating that the first operation request and the operation requests in the metadata concurrent replay queue are not mutually exclusive, and multiple operation requests in the metadata concurrent replay queue can perform metadata replay concurrently; if the first operation request is an operation request on file data, when the first operation request meets the second concurrent replay condition, adding the first operation request to the waiting replay queue according to the execution order of the first operation request. The data concurrent replay queue is entered, and data replay is performed on the first operation request. When the first operation request meets the first concurrent replay condition, the first operation request is added from the data concurrent replay queue to the metadata concurrent replay queue according to the execution order of the first operation request. Metadata replay is performed on the first operation request, and the first operation request is added from the metadata replay queue to the replay queue. The second concurrent replay condition indicates that the first operation request and the operation requests in the data concurrent replay queue are not mutually exclusive, and multiple operation requests in the data concurrent replay queue can be replayed concurrently.
[0041] Wherein, "not mutually exclusive with the operation requests in the metadata concurrent replay queue" means that the first operation request and the operation requests in the metadata concurrent replay queue can be executed in parallel. For example, the inode information corresponding to the first operation request is different from the inode information of the operation requests in the metadata concurrent replay queue, that is, the first operation request and the operation requests in the metadata concurrent replay queue cannot be operation requests for the same metadata.
[0042] In one possible implementation, the second storage cluster further includes a second metadata storage node;
[0043] Performing metadata replay on the first operation request includes:
[0044] The second NAS server cluster obtains metadata operation logs from the second data storage cluster and sends the metadata operation logs to the second metadata storage node; the second metadata storage node performs metadata replay on the first operation request based on the metadata operation logs.
[0045] In one possible implementation, the second storage cluster further includes a second metadata storage node, each storage...The partition includes a data storage partition and a metadata storage partition. The data carried by the first operation request and the logical sequence number of the first operation request are stored in the metadata storage partition of the third storage partition;
[0046] Data playback of the first operation request includes:
[0047] The second NAS server cluster obtains the metadata operation log from the second data storage cluster and sends the metadata operation log to the second metadata storage node; the second metadata storage node determines multiple third storage partitions in the second storage cluster based on the metadata operation log, and writes the data carried by the first operation request in the third storage partition from the metadata storage partition of the third storage partition to the data storage partition of the third storage partition.
[0048] In one possible implementation, the second NAS server cluster includes multiple fourth NAS servers, each fourth NAS server is used to execute the playback process of a set of operation requests, and the playback processes of different sets of operation requests can be executed in parallel.
[0049] In one possible implementation, the third NAS server and the fourth NAS server are the same NAS server.
[0050] In a third aspect, a distributed file method is provided, applied to a distributed file system, the distributed file system including a first storage cluster and a second storage cluster, the method comprising:
[0051] the first storage cluster receiving a first operation request for a file, executing the first operation request based on the semantics of the first operation request, obtaining an execution result corresponding to the semantics of the first operation request, the execution result including at least one of the execution result of the file data and the execution result of the file metadata; the first storage cluster generating an operation log of the first operation request based on the execution result and the execution order of the first operation request; the first storage cluster sending the operation log to the second storage cluster; the second storage cluster receiving the operation log sent by the first storage cluster, and replaying the first operation request based on the operation log.
[0052] In one possible implementation, the first storage cluster executes the first operation request based on the semantics of the first operation request, obtains an execution result corresponding to the semantics of the first operation request, and generates an operation log for the first operation request based on the execution result and the execution order of the first operation request, including:
[0053] If the first operation request is an operation request on the metadata of a file, the first storage cluster executes the first operation request, obtains an execution result on the metadata of the file, generates a metadata operation log based on the execution result on the metadata of the file, and generates an operation log for the first operation request based on the metadata operation log and the execution order of the first operation request; if the first operation request is an operation request on the data of a file, the first storage cluster executes the first operation request, obtains an execution result on the data of the file and an execution result on the metadata of the file, and generates an operation log for the first operation request based on the execution result on the data of the file.According to the operation log, based on the execution result of the file's metadata, a metadata operation log is generated. Based on the metadata operation log, the data operation log, and the execution order of the first operation request, an operation log for the first operation request is generated.
[0054] In one possible implementation, the first storage cluster includes a first NAS server cluster and a first metadata storage node;
[0055] If the first operation request is an operation request for the file's metadata, the first storage cluster executes the first operation request, obtains the execution result of the file's metadata, generates a metadata operation log based on the execution result of the file's metadata, and generates an operation log for the first operation request based on the metadata operation log and the execution order of the first operation request, including:
[0056] If the first operation request is an operation request for the file's metadata, the first NAS server cluster sends the metadata targeted by the first operation request to the first metadata storage node; the first metadata storage node assigns a logical sequence number to the first operation request, executes the first operation request on the metadata, obtains the execution result of the file's metadata, generates a metadata operation log based on the execution result of the file's metadata, and the logical sequence number is used to indicate the execution order of the first operation request; the first NAS server generates an operation log for the first operation request based on the metadata operation log and the execution order of the first operation request.
[0057] In one possible implementation, the first storage cluster includes a first NAS server cluster, a first metadata storage node, and a first data storage cluster;
[0058] If the first operation request is a data operation request for a file, the first storage cluster executes the first operation request, obtains the execution result of the data operation on the file and the execution result of the metadata operation on the file, generates a data operation log based on the execution result of the data operation on the file, generates a metadata operation log based on the execution result of the metadata operation log, the data operation log, and the execution order of the first operation request, including:
[0059] If the first operation request is a data operation request on a file, the first NAS server cluster sends the data carried by the first operation request to the first data storage cluster; the first data storage cluster executes the first operation request on the data carried by the first operation request, obtains the execution result on the file data, and generates a data operation log based on the execution result on the file data; the first NAS server cluster sends the metadata targeted by the first operation request to the first metadata storage node; the first metadata storage node assigns a logical sequence number to the first operation request, executes the first operation request on the metadata, obtains the execution result on the file metadata, and generates a metadata operation log based on the execution result on the file metadata, with the logical sequence number used to indicate the execution order of the first operation request; the first NAS server cluster, based on the data operation log and metadata...Based on the operation log and the logical sequence number of the first operation request, an operation log for the first operation request is generated.
[0060] In one possible implementation, the first NAS server cluster includes at least one first NAS server and at least one second NAS server. The first NAS server is used to receive and forward operation requests, and the second NAS server is used to generate and forward operation logs for the operation requests.
[0061] The first NAS server cluster generates the operation log for the first operation request based on the metadata operation log and the logical sequence number of the first operation request, including any one of the following:
[0062] The first NAS server receives the metadata operation log and the logical sequence number of the first operation request sent by the first metadata storage node, and sends the metadata operation log and the logical sequence number of the first operation request to the second NAS server. The second NAS server generates the operation log for the first operation request based on the metadata operation log and the logical sequence number of the first operation request. The second NAS server obtains the metadata operation log from the first metadata storage node according to the logical sequence number of the first operation request, and generates the operation log for the first operation request based on the metadata operation log and the logical sequence number of the first operation request.
[0063] In one possible implementation, the first NAS server cluster includes multiple first NAS servers and at least one second NAS server. The first NAS servers are used to receive and forward operation requests, and the second NAS servers are used to generate and forward operation logs for the operation requests.
[0064] The first NAS server cluster generates the operation log for the first operation request based on the data operation log, the metadata operation log, and the logical sequence number of the first operation request, including any one of the following:
[0065] The first NAS server receives the metadata operation log and the logical sequence number of the first operation request sent by the first metadata storage node, and sends the metadata operation log, the logical sequence number of the first operation request, and the data carried by the first operation request to the second NAS server. The second NAS server generates the operation log for the first operation request based on the data operation log, the metadata operation log, and the logical sequence number of the first operation request. The second NAS server obtains the metadata operation log from the first metadata storage node based on the logical sequence number of the first operation request, obtains the data carried by the first operation request from the first data storage cluster based on the metadata operation log, and generates the operation log for the first operation request based on the data operation log, the metadata operation log, and the logical sequence number of the first operation request.
[0066] In one possible implementation, each first NAS server is associated with a second NAS server, and each first NAS server is used to receive and forward a set of operation requests.The generation and forwarding of the requested operation logs are performed by a second NAS server associated with the first NAS server.
[0067] In one possible implementation, the first NAS server and the second NAS server are the same NAS server.
[0068] In one possible implementation, the second storage cluster replays the first operation request based on the operation logs, including:
[0069] The second storage cluster stores the operation logs based on the execution order of the first operation request; and replays the first operation request based on the operation logs.
[0070] In one possible implementation, the second storage cluster stores the operation logs based on the execution order of the first operation request, including:
[0071] If the operation logs include metadata operation logs, the second storage cluster stores the metadata operation logs based on the execution order of the first operation request, and the metadata operation logs indicate the execution result of the file's metadata; if the operation logs include metadata operation logs and data operation logs, the metadata operation logs and data operation logs are stored based on the execution order of the first operation request, and the data operation logs indicate the execution result of the file's data.
[0072] In one possible implementation, the second storage cluster includes a second NAS server cluster and a second data storage cluster. The second NAS server cluster is used to receive operation logs sent by the first storage cluster. The second data storage cluster includes multiple data storage nodes, and each data storage node includes at least one storage partition.
[0073] If the operation log includes metadata operation logs, the second storage cluster stores the metadata operation logs based on the execution order of the first operation requests. The metadata operation logs indicate the execution result of the metadata of the file, including:
[0074] If the operation log includes metadata operation logs, the second NAS server cluster determines the first storage partition in the second data storage cluster based on the logical sequence number of the first operation request in the operation log, and stores the metadata operation logs in the first storage partition. The logical sequence number is used to indicate the execution order of the first operation request.
[0075] In one possible implementation, the second storage cluster includes a second NAS server cluster and a second data storage cluster. The second NAS server cluster is used to receive operation logs sent by the first storage cluster. The second data storage cluster includes multiple data storage nodes, and each data storage node includes at least one storage partition.
[0076] If the operation log includes metadata operation logs and data operation logs, the second storage cluster stores the metadata operation logs and data operation logs based on the execution order of the first operation request. The data operation logs indicate the execution results of the data on the file, including:
[0077] If the operation log includes metadata operation logs and data operation logs, the second NAS server cluster determines the second storage partition in the second data storage cluster based on the logical sequence number of the first operation request in the operation log, and stores the metadata operation log in the second storage partition; the second NAS server cluster, based on the metadata operation log, divides the data carried by the first operation request in the data operation log into at least one data block, determines at least one third storage partition in the second storage cluster, and stores one data block and the logical sequence number of the first operation request in one third storage partition.
[0078] In one possible implementation, the second NAS server cluster includes multiple third NAS servers, each third NAS server is used to execute the storage procedure of the operation logs of a set of operation requests, and the storage procedures of the operation logs of different sets of operation requests can be executed in parallel.
[0079] In one possible implementation, the second storage cluster replays the first operation request based on the operation log, including:
[0080] According to the execution order of the first operation requests, the first operation requests are added to the waiting replay queue. If the first operation request is a file metadata operation request, when the first operation request meets the first concurrent replay condition, the first operation request is added to the metadata concurrent replay queue according to the execution order of the first operation requests, metadata replay is performed on the first operation request, and the first operation request is added from the metadata replay queue to the replay queue. The first concurrent replay condition indicates that the first operation request and the operation requests in the metadata concurrent replay queue are not mutually exclusive, and multiple operation requests in the metadata concurrent replay queue can be replayed concurrently. If the first operation request is a file data operation request... When the first operation request meets the second concurrent replay condition, the first operation request is added to the data concurrent replay queue according to the execution order of the first operation request, and data replay is performed on the first operation request. When the first operation request meets the first concurrent replay condition, the first operation request is added from the data concurrent replay queue to the metadata concurrent replay queue according to the execution order of the first operation request, and metadata replay is performed on the first operation request. The first operation request is added from the metadata replay queue to the replay queue. The second concurrent replay condition indicates that the first operation request and the operation requests in the data concurrent replay queue are not mutually exclusive, and multiple operation requests in the data concurrent replay queue can be replayed concurrently.
[0081] In one possible implementation, the second storage cluster further includes a second metadata storage node;
[0082] The second storage cluster performs metadata replay on the first operation request, including:
[0083] The second NAS server cluster obtains metadata operation logs from the second data storage cluster and sends the metadata operation logs to the second metadata storage node; the second metadata storage node performs metadata replay on the first operation request based on the metadata operation logs.
[0084] In one possible implementation, the second storage cluster further includes a second metadata storage node. Each storage partition includes a data storage partition and a metadata storage partition. The data carried by the first operation request and the logical sequence number of the first operation request are stored in the metadata storage partition of the third storage partition.
[0085] The second storage cluster performs data playback on the first operation request, including:
[0086] The second NAS server cluster obtains the metadata operation log from the second data storage cluster and sends the metadata operation log to the second metadata storage node. Based on the metadata operation log, the second metadata storage node determines multiple third storage partitions in the second data storage cluster and writes the data carried by the first operation request in the third storage partition from the metadata storage partition of the third storage partition to the data storage partition of the third storage partition.
[0087] In one possible implementation, the second NAS server cluster includes multiple fourth NAS servers. Each fourth NAS server is used to execute a playback process of a set of operation requests. The playback processes of different sets of operation requests can be executed in parallel.
[0088] In one possible implementation, the third NAS server and the fourth NAS server are the same NAS server.
[0089] In a fourth aspect, a distributed file system is provided, comprising:
[0090] a first storage cluster, configured to:
[0091] receive a first operation request for a file, execute the first operation request based on the semantics of the first operation request, and obtain an execution result corresponding to the semantics of the first operation request, wherein the execution result includes at least one of an execution result for the data of the file and an execution result for the metadata of the file;
[0092] generate an operation log for the first operation request based on the execution result and the execution order of the first operation request;
[0093] send the operation log to a second storage cluster;
[0094] a second storage cluster, configured to:
[0095] receive the operation log sent by the first storage cluster, and replay the first operation request based on the operation log.
[0096] In one possible implementation, the first storage cluster is used to:
[0097] If the first operation request is an operation request on the metadata of a file, the first storage cluster executes the first operation request, obtains the execution result on the metadata of the file, generates a metadata operation log based on the execution result on the metadata of the file, and generates an operation log for the first operation request based on the metadata operation log and the execution order of the first operation request; if the first operation request is an operation request on the data of a file, the first storage cluster executes the first operation request, obtains the execution result on the data of the file and the execution result on the metadata of the file, and generates a data operation log based on the execution result on the data of the file.According to the operation log, based on the execution result of the file's metadata, a metadata operation log is generated. Based on the metadata operation log, the data operation log, and the execution order of the first operation request, an operation log for the first operation request is generated.
[0098] In one possible implementation, the first storage cluster includes a first NAS server cluster and a first metadata storage node;
[0099] The first NAS server cluster is used to: if the first operation request is an operation request for the file's metadata, send the metadata targeted by the first operation request to the first metadata storage node;
[0100] The first metadata storage node is used to: assign a logical sequence number to the first operation request, execute the first operation request on the metadata, obtain the execution result of the file's metadata, and generate a metadata operation log based on the execution result of the file's metadata, wherein the logical sequence number is used to indicate the execution order of the first operation request; the first NAS server generates the operation log for the first operation request based on the metadata operation log and the execution order of the first operation request.
[0101] In one possible implementation, the first storage cluster includes a first NAS server cluster, a first metadata storage node, and a first data storage cluster;
[0102] The first NAS server cluster is used to:
[0103] If the first operation request is an operation request on the data of a file, then send the data carried by the first operation request to the first data storage cluster; the first data storage cluster executes the first operation request on the data carried by the first operation request to obtain the execution result on the data of the file, and generates a data operation log based on the execution result on the data of the file;
[0104] Send the metadata targeted by the first operation request to the first metadata storage node;
[0105] The first metadata storage node is used to: assign a logical sequence number to the first operation request, execute the first operation request on the metadata to obtain the execution result on the metadata of the file, and generate a metadata operation log based on the execution result on the metadata of the file, wherein the logical sequence number is used to indicate the execution order of the first operation request;
[0106] The first NAS server cluster is also used to: generate an operation log for the first operation request based on the data operation log, the metadata operation log, and the logical sequence number of the first operation request.
[0107] In one possible implementation, the first NAS server cluster includes any of the following:
[0108] The first NAS server is configured to: receive a metadata operation log and a logical sequence number of a first operation request sent by a first metadata storage node, send the metadata operation log and the logical sequence number of the first operation request to a second NAS server, and the second NAS server generates an operation log for the first operation request based on the metadata operation log and the logical sequence number of the first operation request;
[0109] The second NAS server is configured to: obtain metadata operation logs from the first metadata storage node according to the logical sequence number of the first operation request, and generate operation logs for the first operation request based on the metadata operation logs and the logical sequence number of the first operation request.
[0110] In one possible implementation, the first NAS server cluster includes any of the following:
[0111] The first NAS server is configured to: receive metadata operation logs and the logical sequence number of the first operation request sent by the first metadata storage node, send the metadata operation logs, the logical sequence number of the first operation request, and the data carried by the first operation request to the second NAS server, and the second NAS server generates operation logs for the first operation request based on the data operation logs, the metadata operation logs, and the logical sequence number of the first operation request;
[0112] The second NAS server is configured to: obtain metadata operation logs from the first metadata storage node based on the logical sequence number of the first operation request, obtain the data carried by the first operation request from the first data storage cluster based on the metadata operation logs, and generate operation logs for the first operation request based on the data operation logs, the metadata operation logs, and the logical sequence number of the first operation request.
[0113] In one possible implementation, each first NAS server is associated with a second NAS server. Each first NAS server is used to receive and forward a set of operation requests. The generation and forwarding of operation logs for the set of operation requests received and forwarded by each first NAS server are performed by the second NAS server associated with the first NAS server.
[0114] In one possible implementation, the first NAS server and the second NAS server are the same NAS server.
[0115] In one possible implementation, the second storage cluster is used for:
[0116] storing operation logs based on the execution order of the first operation requests;
[0117] replaying the first operation requests based on the operation logs.
[0118] In one possible implementation, the second storage cluster is used for:
[0119] if the operation logs include metadata operation logs, storing metadata operation logs based on the execution order of the first operation requests, wherein the metadata operation logs indicate the execution result of the metadata of the file;
[0120] if the operation logs include metadata operation logs and data operation logs, storing metadata operation logs and data operation logs based on the execution order of the first operation requests, wherein the data operation logs indicate the execution result of the data of the file.
[0121] In one possible implementation, the second storage cluster includes a second NAS server cluster and a second data storage cluster. The second NAS server cluster is used to receive operation logs sent by the first storage cluster. The second data storage cluster includes multiple data storage nodes, and each data storage node includes at least one storage partition.
[0122] The second NAS server cluster is used to: if the operation log includes metadata operation logs, determine the first storage partition in the second data storage cluster based on the logical sequence number of the first operation request in the operation log, and store the metadata operation log (page 10 / 31, CN 121051082 A) in the first storage partition. The logical sequence number is used to indicate the execution order of the first operation request.
[0123] In one possible implementation, the second storage cluster includes a second NAS server cluster and a second data storage cluster. The second NAS server cluster is used to receive operation logs sent by the first storage cluster. The second data storage cluster includes multiple data storage nodes, and each data storage node includes at least one storage partition.
[0124] The second NAS server cluster is used to:
[0125] If the operation log includes metadata operation logs and data operation logs, then based on the logical sequence number of the first operation request in the operation log, determine the second storage partition in the second data storage cluster and store the metadata operation log in the second storage partition;
[0126] Based on the metadata operation logs, divide the data carried by the first operation request in the data operation log into at least one data block, determine at least one third storage partition in the second storage cluster, and store a data block and the logical sequence number of the first operation request in a third storage partition.
[0127] In one possible implementation, the second NAS server cluster includes multiple third NAS servers. Each third NAS server is used to execute a storage procedure for the operation logs of a set of operation requests. The storage procedures for the operation logs of different sets of operation requests can be executed in parallel.
[0128] In one possible implementation, the second storage cluster is used to:
[0129] add the first operation requests to a waiting replay queue according to the execution order of the first operation requests; if the first operation request is an operation request on file metadata, when the first operation request meets the first concurrent replay condition, add the first operation request to the metadata concurrent replay queue according to the execution order of the first operation requests, perform metadata replay on the first operation request, and add the first operation request from the metadata replay queue to the replay queue, wherein the first concurrent replay condition indicates that the first operation request and the operation requests in the metadata concurrent replay queue are not mutually exclusive, and multiple operation requests in the metadata concurrent replay queue can perform metadata replay concurrently; if the first operation request is an operation request on file data, when the first operation request meets the second concurrent replay condition, add the first operation request to the data concurrent replay queue according to the execution order of the first operation requests, perform data replay on the first operation request, and when the first operation request meets the first concurrent replay condition, add the first operation request from the data concurrent replay queue to the metadata queue according to the execution order of the first operation requests.A concurrent replay queue is used to perform metadata replay on the first operation request, adding the first operation request from the metadata replay queue to the replay queue. A second concurrent replay condition indicates that the first operation request and the operation requests in the data concurrent replay queue are not mutually exclusive, and multiple operation requests in the data concurrent replay queue can be replayed concurrently.
[0130] In one possible implementation, the second storage cluster further includes a second metadata storage node;
[0131] The second NAS server cluster is used to: obtain metadata operation logs from the second data storage cluster and send the metadata operation logs to the second metadata storage node;
[0132] The second metadata storage node is used to: perform metadata replay on the first operation request based on the metadata operation logs.
[0133] In one possible implementation, the second storage cluster further includes a second metadata storage node. Each storage partition includes a data storage partition and a metadata storage partition. The data carried by the first operation request and the logical sequence number of the first operation request are stored in the metadata storage partition of the third storage partition.
[0134] The second NAS server cluster is used to: obtain metadata operation logs from the second data storage cluster and send the metadata operation logs to the second metadata storage node.
[0135] The second metadata storage node is used to: determine multiple third storage partitions in the second storage cluster based on the metadata operation logs, and write the data carried by the first operation request in the third storage partition from the metadata storage partition of the third storage partition to the data storage partition of the third storage partition.
[0136] In one possible implementation, the second NAS server cluster includes multiple fourth NAS servers. Each fourth NAS server is used to execute a replay process of a set of operation requests. The replay processes of different sets of operation requests can be executed in parallel.
[0137] In one possible implementation, the third NAS server and the fourth NAS server are the same NAS server.
[0138] In a fifth aspect, a data replication method apparatus for a distributed file system is provided, applied to a first storage cluster of a distributed file system. The apparatus includes at least one functional module for performing the data replication method for a distributed file system provided by the first aspect or any possible implementation thereof.
[0139] In a sixth aspect, a data replication method apparatus for a distributed file system is provided, applied to a second storage cluster of a distributed file system. The apparatus includes at least one functional module for performing the data replication method for a distributed file system provided by the second aspect or any possible implementation thereof.
[0140] In a seventh aspect, a storage node is provided, the storage node including a memory and a processor;
[0141] The processor is configured to execute instructions stored in the memory to cause the storage node to perform a data replication method of a distributed file system provided by any possible implementation of the first or second aspect described above.
[0142] In an eighth aspect, a storage cluster is provided, the storage cluster including at least one storage node, each storage node including a memory and a processor;
[0143] The processor of the at least one storage node is configured to execute instructions stored in the memory of the at least one storage node to cause the storage cluster to perform a data replication method of a distributed file system provided by any possible implementation of the first or second aspect described above.
[0144] In a ninth aspect, a computer program product including instructions is provided, which, when executed by a storage node, cause the storage node to perform a data replication method of a distributed file system provided by the first aspect or any possible implementation of the first aspect described above, or, when executed by a storage cluster, cause the storage cluster to perform a data replication method of a distributed file system provided by the second aspect or any possible implementation of the second aspect described above.
[0145] In a tenth aspect, a computer-readable storage medium is provided, comprising computer program instructions that, when executed by a storage node, execute a data replication method of a distributed file system as provided in the first aspect or any possible implementation thereof, or, when executed by a storage cluster, execute a data replication method of a distributed file system as provided in the second aspect or any possible implementation thereof.
[0146] Based on the implementations provided in the above aspects, this application can be further combined to provide more implementations.
[0147] FIG1 is a schematic diagram of a distributed file system provided in an embodiment of the present application;
[0148] FIG2 is a schematic diagram of a distributed file system provided in an embodiment of the present application;
[0149] FIG3 is a flowchart of a data replication method of a distributed file system provided in an embodiment of the present application;
[0150] FIG4 is a flowchart of a method for replicating operation logs provided in an embodiment of the present application;
[0151] FIG5 is a schematic diagram of a concurrent playback window provided in an embodiment of the present application; Specification 12 / 31 pages 19 CN 121051082 A
[0152] FIG6 is a flowchart of a data replication method of a distributed file system provided in an embodiment of the present application;
[0153] FIG7 is a schematic diagram of a playback process provided in an embodiment of the present application;
[0154] FIG8 is a structural schematic diagram of a data replication device in a distributed file system provided in an embodiment of the present application;
[0155] FIG9 is a structural schematic diagram of a data replication device in a distributed file system provided in an embodiment of the present application;
[0156] Figure 10 is a schematic diagram of the structure of a storage node provided in an embodiment of this application;
[0157] Figure 11 is a schematic diagram of a storage cluster provided in an embodiment of this application;
[0158] Figure 12 is a schematic diagram of a possible implementation of a storage cluster provided in an embodiment of this application. Detailed Description
[0159] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be further described in detail below with reference to the accompanying drawings.
[0160] First, several technical terms involved in the embodiments of this application will be introduced.
[0161] File system: A file system provides users with a multi-level structure called a directory tree for managing files. In the directory tree structure, each file or directory has metadata information. Metadata operations typically involve two main steps: path decoding and metadata processing. When a user accesses a file by path name, the metadata is accessed as follows: First, the file system performs path decoding, locates the target file, and checks whether the user has the correct permissions; second, the file system performs metadata operations, atomically updating the metadata of the accessed file.
[0162] Distributed File System: In a distributed file system, data is distributed across multiple storage nodes. The performance of system access is improved through the concurrency capability of multiple nodes, and the total capacity of the system is improved through the capacity of multiple nodes. A distributed file system generally includes multiple NAS servers, multiple data storage nodes, and at least one metadata storage node. The file writing process is as follows: first, the data is divided into multiple data blocks, and the multiple data blocks are written to the data storage nodes. Then, the metadata is updated to the metadata storage nodes. The file reading process is as follows: first, the metadata information is read from the metadata storage nodes to obtain the file's index node (inode) information and the data block storage location. Then, the data is read from the data storage nodes.
[0163] The implementation environment of the embodiments of this application is described below.
[0164] Figure 1 is a schematic diagram of a distributed file system provided by an embodiment of this application. As shown in Figure 1, the distributed file system includes a first storage cluster 101 and a second storage cluster 102. Data is replicated between the first storage cluster and the second storage cluster based on a replication link. It should be noted that Figure 1 only shows two storage clusters in the distributed file system, and the first storage cluster 101 is the primary storage cluster and the second storage cluster 102 is the secondary storage cluster for example. However, the number of storage clusters in the distributed file system is not limited. The number of storage clusters can be greater than 2. When the number of storage clusters is greater than 2, the number of primary and secondary storage clusters is not limited. For example, the primary and secondary storage clusters can be one-to-many or many-to-many. This embodiment of the application does not limit this.
[0165] The first storage cluster 101 includes a first NAS server cluster 1011, a first metadata storage node 1012, and a first data storage cluster 1013.
[0166] The first NAS server cluster 1011 includes multiple NAS servers. The NAS server can be a Windows Server Message Block (SMB) server or a Linux or Unix Network File System (NFS) server. This application embodiment does not limit this. The first function of the first NAS server cluster specification (pages 13 / 31, 20 CN 121051082 A) is: to receive a file operation request sent by a client, and based on the semantics of the operation request, to generate at least one of the metadata request and the data request. The metadata request is used to interact with the first metadata storage node 1012 to generate a metadata operation log; the data request is used to interact with the first data storage cluster 1013 to generate a data operation log. The semantics of the operation request indicate whether it is an operation request on the file's metadata or on the file's data. Operation requests on the file's metadata include requests to create and delete files, while operation requests on the file's data include requests to write data. The second function of the first NAS server cluster is to generate operation logs for the operation requests and send these logs to the second storage cluster via a replication link, thereby triggering the second storage cluster to synchronize the operation requests and ensuring data consistency between the primary and backup ends. As shown in Figure 1, the first NAS server cluster 1011 includes multiple first NAS servers and one second NAS server. The first NAS servers execute the first function of the first NAS server cluster 1011, and the second NAS server executes the second function. By assigning different functions of the first NAS server cluster 1011 to different NAS servers, the processing of different operation requests and the sending of operation logs can be synchronized, improving the performance of the first NAS server cluster. In some embodiments, the first function is implemented by a processing module, and the second function is implemented by a replication module; that is, the processing module is deployed on the first NAS server, and the second replication module is deployed on the second NAS server. This embodiment does not limit this.
[0167] In some embodiments, as shown in FIG2, FIG2 is a schematic diagram of a distributed file system provided in an embodiment of the present application. The first NAS server cluster includes multiple first NAS servers and multiple second NAS servers. A first NAS server and a second NAS server are bound together to form multiple NAS server groups. Each NAS server group is responsible for a set of operations.The request enables the first NAS server cluster to concurrently process multiple sets of operation requests, thereby improving the throughput and data replication efficiency of the first NAS server for operation requests.
[0168] In some embodiments, the first NAS server and the second NAS server are the same NAS server, that is, the above two functions of the first storage cluster are provided on one NAS server, and different NAS servers in the first NAS server cluster concurrently process multiple sets of operation requests.
[0169] The first metadata storage node 1012 can be a metadata server (MDS). The first metadata storage node 1012 is used to process metadata requests, store metadata and metadata operation logs, and assign a globally unique logical sequence number (LSN) to the operation request. The logical sequence number is used to indicate the execution order of the operation request. The first metadata storage node 1012 includes a metadata area and a metadata operation log area. The metadata area is used to store metadata, and the metadata operation log area is used to store metadata operation logs. In some embodiments, the first metadata storage node 1012 adopts a key-value log (KVLOG) format to store metadata operation logs in the metadata operation log area, thereby improving the readability and maintainability of the metadata operation logs. It should be noted that Figure 1 is an example using one first metadata storage node. The number of first metadata storage nodes in the first storage cluster can be more. This application embodiment does not limit the number of first metadata storage nodes in the first storage cluster.
[0170] The first data storage cluster 1013 includes multiple data storage nodes, and each data storage node includes at least one storage partition (PT). Figure 1 is an example using the first data storage cluster including M storage partitions, where M is an integer greater than 1. This application embodiment does not limit the number of storage partitions in the first data storage cluster. Each storage partition includes a log storage partition and a data storage partition. The log storage partition is used to store data operation logs, and the data storage partition is used to store data. In some embodiments, the data operation log is a write-ahead log (WAL). When processing a data request, the data storage node does not directly write the data carried by the data request to the partition specified on page 14 / 31 of the data storage specification (CN 121051082 A). Instead, it writes the data to a file called WAL in the log storage partition, and then writes the data in the WAL from the log storage partition to the data storage partition.
[0171] Here, the storage partition stores data at the physical block level. Therefore, when processing a data request, the data storage node does not directly write the data carried by the data request to the partition specified on page 14 / 31 of the data storage specification (CN 121051082 A). Instead, it writes the data to a file called WAL in the log storage partition, and then writes the data in the WAL from the log storage partition to the data storage partition.Before data is written to a storage partition, it needs to be divided into at least one data block to fill a physical block within that partition. This data block is then stored in different storage partitions. For example, the first data storage cluster includes three storage partitions, A-C, with a physical block capacity of 4 megabytes (MB). If operation request Q1 is received first, carrying 10MB of data, it is divided into three data blocks of 4MB, 4MB, and 2MB, and stored in storage partitions A-C respectively. If operation request Q2 is received later, carrying 5MB of data, it is divided into two data blocks of 2MB and 3MB. The 2MB block is written to storage partition C to fill a physical block, and the 3MB block is written to storage partition A. This process continues in the order of storage partitions A-C-A, filling a physical block in one storage partition before writing the next physical block.
[0172] The second storage cluster 102 includes a second NAS server cluster 1021, a second metadata storage node 1022, and a second data storage cluster 1023.
[0173] The second NAS server cluster 1021 includes multiple NAS servers. The NAS server can be a Windows Server Message Block (SMB) server, or a Linux or Unix Network File System (NFS) server. This application embodiment does not limit this. The first function of the second NAS server cluster is to receive operation logs sent by the first storage cluster; the second function is to determine the storage location of the operation logs in the second data storage cluster 1023 and store the operation logs in the corresponding storage location; the third function is to retrieve the operation logs of the operation requests from the second storage cluster 1023 according to the execution order of the operation requests, and send the operation logs to the second metadata storage node 1022 for playback. As shown in Figure 1, the second NAS server cluster 1021 includes one third NAS server and multiple fourth NAS servers. The third NAS server performs the first function of the second NAS server cluster 1021, and the fourth NAS servers perform the second and third functions of the second NAS server cluster 1021. In some embodiments, as shown in Figure 2, the second NAS server cluster includes multiple third NAS servers and multiple fourth NAS servers. One third NAS server and one fourth NAS server are bound together to form multiple NAS server groups. Each NAS server group is responsible for a set of operation requests, and each NAS server group is associated with a set of storage partitions in the second storage cluster (i.e.,...).The operation logs of a set of operation requests handled by this group of NAS servers are stored in a set of storage partitions associated with this group of NAS servers, so that multiple NAS server groups can concurrently process the operation log storage and playback process of multiple sets of operation requests, thereby improving the data replication performance of the distributed file system.
[0174] The second data storage cluster 1023 includes multiple data storage nodes, each data storage node including at least one storage partition. Figure 1 takes the first data storage cluster including M storage partitions as an example, where M is an integer greater than 1. This application embodiment does not limit the number of storage partitions in the second data storage cluster. Each storage partition includes a log storage partition and a data storage partition. The log storage partition is used to store the operation logs to be played back, and the data storage partition is used to store data. In some embodiments, the operation logs to be played back are stored in the log storage partition in the format of redo log (RDL). The process of writing the data carried by the operation request into the storage partition in the second data storage cluster 1023 is the same as that of the first data storage cluster, and will not be described again.
[0175] The second metadata storage node 1022 is used to control the playback of operation requests and store metadata. The first metadata storage node 1012 includes a metadata area for storing metadata. It should be noted that Figure 1 uses a second metadata storage node as an example; this application embodiment does not limit the number of first metadata storage nodes in the first storage cluster.
[0176] The replication link between the first storage cluster 101 and the second storage cluster 102 can be an Ethernet link, Fibre Channel, or InfiniBand, etc., and this application embodiment does not limit this.
[0177] This application embodiment provides a data replication method for a distributed file system. In this method, the first storage cluster executes the first operation request based on the semantics of the first operation request for a file and generates an operation log corresponding to the semantics of the first operation request. The operation log indicates at least one of the execution result of the file's data and the execution result of the file's metadata; the first storage cluster sends the operation log to the second storage cluster; the second storage cluster replays the first operation request based on the operation log. In the above method, generating operation logs based on the semantics of file operation requests and replaying operation requests based on these operation logs is a data replication method implemented at the file semantic layer. Compared with implementing data replication at the block layer, it does not rely on the replication capabilities of the block layer and can use a single data replication scheme to achieve synchronous and asynchronous replication capabilities. Therefore, it is not necessary to design different block layer schemes to implement synchronous and asynchronous replication, thereby reducing the complexity of distributed file system development and maintenance and improving data replication performance.
[0178] The semantics of the operation request are used to indicate whether the operation request is a request to operate on the file's metadata or a request to operate on the file's data. Requests to operate on the file's metadata include file creation requests and file deletion requests, while requests to operate on the file's data include data writing requests. The first storage cluster determines the semantics of the first operation request in different ways depending on the actual situation. For example, the first storage cluster can determine the semantics of the first operation request based on the request's Uniform Resource Locator (URL), request method, request header information, request parameters, and request body content. This application embodiment does not limit this.
[0179] The flow of the above method will be further described below with the first operation request being a request to operate on the file's metadata and a request to operate on the file's data as examples.
[0180] First, based on the distributed file system shown in Figure 1, the flow of the above method will be introduced with the first operation request being a request to operate on the file's metadata as an example. Figure 3 is a flowchart of a data replication method for a distributed file system provided in this application embodiment. The method is executed by a distributed file system, which includes a first storage cluster and a second storage cluster. The first storage cluster includes a first NAS server cluster, a first metadata storage node, and a first data storage cluster. The second storage cluster includes a second NAS server cluster, a second metadata storage node, and a second data storage cluster. The method includes the following steps 301 to 311.
[0181] Step 301: The first storage cluster receives a first operation request for a file sent by a client.
[0182] Wherein, the first NAS server cluster receives the first operation request for a file sent by the client. In some embodiments, any NAS server in the first NAS server cluster can receive the first operation request. In other embodiments, the first NAS server in the first NAS server cluster can receive the first operation request, that is, some NAS servers in the first NAS server cluster can receive the first operation request. This application embodiment does not limit this.
[0183] Step 302: If the first operation request is an operation request for the metadata of the file, the first storage cluster executes the first operation request and obtains the execution result of the metadata of the file.
[0184] Wherein, the first NAS server cluster determines that the first operation request is an operation request for file metadata, generates a metadata request, and sends the metadata request to the first metadata storage node in the first storage cluster; the first metadata storage node executes the metadata request and obtains the execution result of the file metadata. Taking the first operation request as a file creation operation request as an example, the execution result of the file metadata includes the file creation time, the file owner and rights.Information such as limits. In some embodiments, the first metadata storage node stores the execution result of the file's metadata in the metadata area of the first metadata storage node. Specification 16 / 31 Page 23 CN 121051082 A
[0185] Step 303: The first storage cluster assigns a logical sequence number to the first operation request. The logical sequence number of the first operation request is used to indicate the execution order of the first operation request.
[0186] Wherein, the first metadata storage node assigns a globally unique logical sequence number to the first operation request. When the second storage cluster replays the first operation request later, it executes it based on the order of the logical sequence number of the first operation request, thereby ensuring that the second storage cluster can replay the operation request in the correct order, thereby ensuring the correctness of data replication and improving the data reliability of the distributed file system.
[0187] Step 304: The first storage cluster generates a metadata operation log based on the execution result of the file's metadata.
[0188] In some embodiments, the first metadata storage node generates a metadata operation log based on the execution result of the file's metadata using the KVLOG format, and stores the metadata operation log in the metadata operation log area of the first metadata storage node.
[0189] Step 305: The first storage cluster generates an operation log for the first operation request based on the metadata operation log and the execution order of the first operation request.
[0190] Wherein, the first NAS server cluster includes at least one first NAS server and at least one second NAS server. The first NAS server is used to receive and forward operation requests, and the second NAS server is used to generate and forward operation logs for operation requests. By assigning different functions of the first NAS server cluster 1011 to different NAS servers, the processing of different operation requests and the sending of operation logs can be executed synchronously, thereby improving the performance of the first NAS server cluster.
[0191] The process of the first storage cluster generating the operation log of the first operation request includes: the first NAS server receiving the metadata operation log and the logical sequence number of the first operation request sent by the first metadata storage node, sending the metadata operation log and the logical sequence number of the first operation request to the second NAS server, and the second NAS server generating the operation log of the first operation request based on the metadata operation log and the logical sequence number of the first operation request.
[0192] In some embodiments, each first NAS server is associated with a second NAS server, each first NAS server is used to receive and forward a set of operation requests, and the generation and forwarding of the operation log of the set of operation requests received and forwarded by each first NAS server is performed by the second NAS server associated with the first NAS server. In the above embodiments, throughThe operation requests are grouped, and the operation log generation and forwarding of each group of operation requests are performed by a group of NAS servers. Different groups of NAS servers can perform the generation and forwarding of operation logs for different groups of operation requests in parallel, thereby improving the efficiency of data replication and the concurrent performance of the distributed file system.
[0193] In some embodiments, the first NAS server and the second NAS server are the same NAS server. This application embodiment does not limit this.
[0194] Step 306: The first storage cluster sends the operation log to the second storage cluster.
[0195] Wherein, the second NAS server sends the operation log to the second storage cluster.
[0196] Step 307: The second storage cluster receives the operation log sent by the first storage cluster.
[0197] Wherein, the second NAS server cluster in the second storage cluster receives the operation log. In some embodiments, any NAS server in the second NAS server cluster can receive the first operation request sent by the first storage cluster. In other embodiments, a third NAS server in the second NAS server cluster can receive the second operation request sent by the first storage cluster, that is, some NAS servers in the second NAS server cluster can receive the second operation request. This application embodiment does not limit this.
[0198] Step 308: The second storage cluster stores the operation log based on the execution order of the first operation request.
[0199] Wherein, the second storage cluster stores the metadata operation log based on the execution order of the first operation request. (See specification 17 / 31, page 24, CN 121051082 A). This metadata operation log indicates the execution result of the file's metadata.
[0200] Wherein, the second storage cluster includes a second NAS server cluster and a second data storage cluster. The second NAS server cluster is used to receive the operation log sent by the first storage cluster. The second data storage cluster includes multiple data storage nodes, and each data storage node includes at least one storage partition.
[0201] In some embodiments, each storage partition is associated with a metadata operation log used to store a set of operation requests, that is, each storage partition is associated with a set of logical sequence numbers. The process of the second storage cluster storing the operation log includes: the second NAS server cluster determines the first storage partition in the second data storage cluster based on the logical sequence number of the first operation request in the operation log, and stores the metadata operation log in the first storage partition. In this second NAS server cluster, each NAS server is bound to at least one set of logical sequence numbers, and each NAS server is further bound to a set of storage partitions. The second NAS server cluster determines the NAS server associated with the logical sequence number of the first operation request, and then determines the storage partition bound to that NAS server. In some embodiments, when the second storage cluster receives...After the first storage cluster sends the operation log, the first storage cluster randomly allocates the storage partition corresponding to the logical sequence number. This application embodiment does not limit this.
[0202] Step 309: The second storage cluster sends a replication completion message for the operation log to the first storage cluster.
[0203] In the above steps 308 and 309, the second storage cluster returns a replication completion message to the first storage node immediately after storing the operation log, without waiting for the operation log to be synchronized. Under the synchronous replication method, the waiting time of the first storage cluster can be reduced.
[0204] Step 310: After receiving the replication completion message, the first storage cluster returns an operation completion message for the first operation request to the client.
[0205] It should be noted that the above steps 305 to 310 are described using the synchronous replication method as an example. In some embodiments, the asynchronous replication method is used, that is, after the first storage cluster sends the operation log to the second storage cluster, it immediately returns an operation completion message for the first operation request to the client. In asynchronous replication mode, the process of the first storage cluster generating the operation log of the first operation request includes: the second NAS server obtains the metadata operation log from the first metadata storage node according to the logical sequence number of the first operation request, and generates the operation log of the first operation request based on the metadata operation log and the logical sequence number of the first operation request. The second NAS server sends the operation log to the second storage cluster. Among them, the second NAS server obtains the metadata operation log from the first metadata storage node in a round-robin manner according to the logical sequence number.
[0206] Step 311: The second storage cluster replays the first operation request based on the operation log.
[0207] The process by which the second storage cluster replays the first operation request based on the operation log includes: adding the first operation request to the waiting replay queue according to the execution order of the first operation request; when the first operation request meets the first concurrent replay condition, adding the first operation request to the metadata concurrent replay queue according to the execution order of the first operation request, performing metadata replay on the first operation request, and adding the first operation request from the metadata replay queue to the replay queue. The first concurrent replay condition indicates that the first operation request and the operation requests in the metadata concurrent replay queue are not mutually exclusive, and multiple operation requests in the metadata concurrent replay queue can be replayed concurrently. Wherein, "not mutually exclusive" means that the first operation request and the operation requests in the metadata concurrent replay queue can be executed in parallel. For example, the inode information corresponding to the first operation request is different from the inode information of the operation requests in the metadata concurrent replay queue, that is, the first operation request and the operation requests in the metadata concurrent replay queue cannot be operation requests for the same metadata.
[0208] The second storage cluster performs metadata replay on the first operation request, including: the second NAS server cluster obtains metadata operation logs from the second data storage cluster (page 18 / 31, CN 121051082 A) and sends the metadata operation logs to the second metadata storage node; the second metadata storage node performs metadata replay on the first operation request based on the metadata operation logs.
[0209] In the above method, the first storage cluster executes the first operation request based on the semantics of the first operation request and generates an operation log corresponding to the semantics of the first operation request; the first storage cluster sends the operation logs to the second storage cluster; the second storage cluster replays the first operation request based on the operation logs. In the above method, generating operation logs based on the semantics of the operation request and replaying the operation request based on the operation logs is to implement data replication at the file semantic layer. Compared with implementing data replication at the block layer, it does not rely on the replication capability of the block layer and can use a set of data replication schemes to achieve synchronous replication and asynchronous replication capabilities. Therefore, it is not necessary to design different block layer schemes to achieve synchronous replication and asynchronous replication, thereby reducing the complexity of distributed file system development and maintenance and improving data replication performance. Furthermore, a single solution is used to implement synchronous and asynchronous replication, reducing system complexity.
[0210] Below, taking the first operation request as a file creation request (create) as an example, the process shown in steps 301 to 311 above will be illustrated.
[0211] Example 1: Based on the distributed file system shown in Figure 1, the process of the first storage cluster executing the create operation request includes: After the master NAS Server (i.e., the first NAS server cluster) receives the create request, it is first processed by the processing module (deployed on the first NAS server in the first NAS server cluster), and then the relevant metadata is sent to the master MDS (i.e., the first metadata storage node); the master MDS allocates a globally unique LSN for this create operation request to ensure that the operation can be replayed in the correct order on the backup, then writes the metadata into the metadata area, and then generates a metadata operation log for the result, writes it into the KVLOG, and after the execution is completed, returns the LSN and KVLOG to the NAS Server node; after the NAS Server receives the LSN and KVLOG corresponding to the create operation request: if it is synchronous replication, NAS The server forwards the LSN and KVLOG to the replication module (deployed on the second NAS server in the first NAS server cluster). The replication module assembles the complete log (i.e., the operation log of the first operation request) and sends it to the backup (i.e., the second storage cluster) for processing through the replication link. After the backup has finished processing, this create request ends. If it is asynchronous replication, this create operation request ends here.The replication module reads the KVLOG from the master MDS node (e.g., by polling according to LSN order) and assembles it into a complete log before sending it to the backup node for processing via the replication link.
[0212] Example 2: Based on the distributed file system shown in Figure 2, the process of the first storage cluster executing the create operation includes: After receiving the create operation request, the master NAS Server (i.e., the first NAS server cluster) first selects a Shard (group) within the current NAS Server node. The processing module (deployed on the first NAS server in the first NAS server cluster) processes the create operation request and sends the relevant metadata and the Shard information to the master MDS (i.e., the first metadata storage node). The master MDS allocates a globally unique LSN for this create operation to ensure that the operation can be replayed in the correct order on the backup node. Then, it writes the metadata into the metadata area and generates a metadata operation log, which is written to the KVLOG by Shard. After the execution is completed, the LSN and KVLOG are returned to the NAS Server node. After receiving the LSN and KVLOG, the NAS Server: if it is synchronous replication, NAS The server forwards the LSN and KVLOG to the replication module (deployed on the second NAS server in the first NAS server cluster). The replication module assembles the complete log (i.e., the operation log of the first operation request) and sends it to the backup (i.e., the second storage cluster) for processing through the replication link. After the backup completes the processing, the create request ends. If it is asynchronous replication, the create operation request ends. The replication modules of each shard in all NAS Servers read their own LSN and KVLOG in the MDS according to the shard order, assemble them into a complete log, and send them to the backup for processing.
[0213] As can be seen from the above example, compared with Example 1, this embodiment maps the LSN to multiple shards according to certain rules. In the MDS, the metadata operation log is stored at the shard granularity. In the NAS Server, each replication module reads the metadata operation log from the MDS at the shard granularity and replicates it to the backup for processing, which significantly improves the efficiency and throughput of log replication.
[0214] Example 3: Based on Example 2, in the second storage cluster, the LSN is mapped to N logical Shards according to certain rules, and then these N logical Shards are mapped to M PTs, thereby ensuring that each Shard knows which PT its logs are stored in for subsequent playback processing (M and N are both positive integers). In the second storage cluster, the second NAS serviceThe first NAS server cluster includes a replication module (deployed on the third NAS server in the second NAS server cluster), which is responsible for receiving replication messages sent by the first storage cluster and deserializing them into metadata operation logs and data. In addition, the second NAS server cluster also includes a log module (deployed on the fourth NAS server in the second NAS server cluster), which is responsible for calculating the attribution PT for the metadata operation logs according to their LSN and offset relative to the first PT, so as to achieve log distribution balance. The second data storage cluster includes a log module and a playback module, and divides the storage area into an RDL area (i.e., a metadata storage partition) and a data area (i.e., a data storage partition). The RDL area is used to store logs, and the data area is used to store the actual data of user files (i.e., the data carried by operation requests).
[0215] Referring to Figure 4, which is a flowchart of the operation log replication provided in an embodiment of this application, taking the first operation request as a create operation request as an example, the process of the second storage cluster replicating the operation log includes: the replication module of a node in the NAS Server cluster receives the replication message of the create operation request sent by the master and deserializes it into the metadata operation log of the create operation request; the log module obtains the identifier (identification, ID) of the Shar by taking the modulo of the LSN of the metadata operation log of this create operation request with the total number of Shars, and then obtains the ID of the PT to which the metadata operation log belongs by taking the modulo of the Shar ID with the total number of PTs, and then sends the metadata operation log to the Space node (that is, the data storage node) where the PT ID is located; after receiving the create metadata log, the Space node appends it to the redo log in the RDL area, and the backup replication process is completed.
[0216] Example 4: Based on Example 3, the process of the second storage cluster replaying operation logs is as follows: The replay module of the NAS Server loads the metadata operation logs of its own shard into the replay module according to the LSN order, and forwards them to the MDS node to add them to the waiting replay queue (in Example 3, we have mapped the LSN to N shards according to certain rules, and each shard is bound to a replay module of the NAS Server, so that the replay module knows which LSNs it should be responsible for replaying); the MDS, as the control center of replay, after receiving the metadata logs and LSNs forwarded by the NAS Server, maintains two sliding windows in its internal replay module: the metadata concurrent replay window (equivalent to the metadata concurrent replay queue) and the data concurrent replay window (equivalent to the data concurrent replay queue), as shown in Figure 5. Figure 5 is a diagram of this application.The embodiment provides a schematic diagram of a concurrent playback window, which is strictly arranged in ascending order of LSNs for playback. The LSNs first enter the data concurrent playback window (LSNs within the concurrent playback window are required to be non-exclusive; for example, different operation requests for file data cannot target overlapping storage address ranges, and operation requests for file metadata are skipped in the data concurrent playback window). After data playback is complete, the LSNs can enter the metadata concurrent playback window (LSNs within the concurrent playback window are also required to be mutually exclusive; for example, inodes cannot be the same). The size of the sliding window controls the degree of concurrent playback, and the non-exclusive mechanism for LSNs entering the window also ensures the correctness of the playback.
[0217] Below, based on the distributed file system shown in Figure 1, the process of the above method is described using the first operation request as an operation request for file metadata as an example. Figure 6 is a flowchart of a data replication method for a distributed file system provided in this application embodiment. The method is executed by a distributed file system, which includes a first storage cluster and a second storage cluster. The first storage cluster includes a first NAS server cluster, a first metadata storage node, and a first data storage cluster. The second storage cluster includes a second NAS server cluster, a second metadata storage node, and a second data storage cluster. The method includes steps 601 to 609 below. Specification 20 / 31 Page 27 CN 121051082 A
[0218] Step 601: The first storage cluster receives a first operation request sent by the client.
[0219] Wherein, the first NAS server cluster receives the first operation request sent by the client. In some embodiments, any NAS server in the first NAS server cluster can receive the first operation request. In other embodiments, the first NAS server in the first NAS server cluster can receive the first operation request, that is, some NAS servers in the first NAS server cluster can receive the first operation request. This application embodiment does not limit this.
[0220] Step 602: If the first operation request is an operation request on the data of a file, the first storage cluster executes the first operation request to obtain the execution result on the data of the file and the execution result on the metadata of the file.
[0221] The process by which the first storage cluster obtains the execution results of the file data and the file metadata includes: the first NAS server cluster sending the data carried by the first operation request to the first data storage cluster; the first data storage cluster executing the first operation request on the data carried by the first operation request to obtain the execution results of the file data, and generating a data operation log based on the execution results of the file data; the first NAS server cluster sending the metadata targeted by the first operation request to the first metadata storage node; and the first metadata storage node allocating data for the first operation request.The logical sequence number is used to indicate the execution order of the first operation request.
[0222] Step 603: The first storage cluster generates an operation log for the first operation request based on the execution result of the file data, the execution result of the file metadata, and the execution order of the first operation request.
[0223] The process of the first storage cluster generating the operation log for the first operation request includes: the first NAS server cluster generating a metadata operation log based on the execution result of the file metadata; and the first NAS server cluster generating the operation log for the first operation request based on the metadata operation log and the execution order of the first operation request.
[0224] In some embodiments, the first metadata storage node generates a metadata operation log based on the execution result of the file metadata using the KVLOG format, and stores the metadata operation log in the metadata operation log area of the first metadata storage node.
[0225] The first NAS server cluster includes at least one first NAS server and at least one second NAS server. The first NAS server is used to receive and forward operation requests, and the second NAS server is used to generate and forward operation logs for operation requests. The process of generating the operation log of the first operation request in the first storage cluster includes: the first NAS server receiving the metadata operation log and the logical sequence number of the first operation request sent by the first metadata storage node, sending the metadata operation log, the logical sequence number of the first operation request, and the data carried by the first operation request to the second NAS server, and the second NAS server generating the operation log of the first operation request based on the data operation log, the metadata operation log, and the logical sequence number of the first operation request.
[0226] In some embodiments, each first NAS server is associated with a second NAS server, and each first NAS server is used to receive and forward a set of operation requests. The generation and forwarding of the operation log of the set of operation requests received and forwarded by each first NAS server is performed by the second NAS server associated with the first NAS server. In the above embodiments, by grouping the operation requests, the generation and forwarding of the operation log of each set of operation requests is performed by a set of NAS servers. Different groups of NAS servers can perform the generation and forwarding of the operation log of different sets of operation requests in parallel, thereby improving the efficiency of data replication and the concurrent performance of the distributed file system.
[0227] In some embodiments, the first NAS server and the second NAS server are the same NAS server. This application embodiment does not limit this.
[0228] Step 604: The first storage cluster sends the operation log to the second storage cluster.
[0229] Wherein, the second NAS server sends the operation log to the second storage cluster. (Pages 21 / 31 of the specification, 28 CN)121051082 A
[0230] Step 605: The second storage cluster receives the operation log sent by the first storage cluster.
[0231] Wherein, the second NAS server cluster in the second storage cluster receives the operation log. In some embodiments, any NAS server in the second NAS server cluster can receive the first operation request sent by the first storage cluster. In other embodiments, the third NAS server in the second NAS server cluster can receive the second operation request sent by the first storage cluster, that is, some NAS servers in the second NAS server cluster can receive the second operation request, which is not limited in this application embodiment.
[0232] Step 606: The second storage cluster stores the operation log based on the execution order of the first operation request.
[0233] Wherein, the second storage cluster stores the metadata operation log and data operation log in the operation log based on the execution order of the first operation request.
[0234] Wherein, the second storage cluster includes a second NAS server cluster and a second data storage cluster. The second NAS server cluster is used to receive the operation log sent by the first storage cluster. The second data storage cluster includes multiple data storage nodes, and each data storage node includes at least one storage partition. In some embodiments, each storage partition is associated with a metadata operation log for storing a set of operation requests, that is, each storage partition is associated with a set of logical sequence numbers. The process of the second storage cluster storing the operation log includes: the second NAS server cluster determines the second storage partition in the second data storage cluster based on the logical sequence number of the first operation request in the operation log, and stores the metadata operation log in the second storage partition; the second NAS server cluster divides the data carried by the first operation request in the data operation log into at least one data block based on the metadata operation log, determines at least one third storage partition in the second storage cluster, and stores a data block and the logical sequence number of the first operation request in a third storage partition.
[0235] Wherein, each NAS server in the second NAS server cluster is bound to at least one set of logical sequence numbers, and each NAS server is bound to a set of storage partitions. The second NAS server cluster determines the NAS server associated with the logical sequence number based on the logical sequence number of the first operation request, and then determines the storage partition bound to the NAS server. In some embodiments, after the second storage cluster receives the operation log sent by the first storage cluster, the first storage cluster randomly allocates the storage partition corresponding to the logical sequence number. This application embodiment does not limit this.
[0236] The first storage cluster, based on the principle of filling a physical block in a storage partition, needs to divide the data into at least one data block, and store the at least one data block in different storage partitions.The inode, offset, length, and other information of the data are stored in the metadata operation log. Based on the metadata operation log, the second storage cluster obtains the inode, offset, length, and other information, and divides the data into at least one data block in the same way as the first storage node, thereby determining the storage partition where each data block is located.
[0237] Step 607: The second storage cluster sends a replication completion message for the operation log to the first storage cluster.
[0238] In steps 606 and 607 above, the second storage cluster returns a replication completion message to the first storage node immediately after storing the operation log, without waiting for the operation log to be synchronized. Under the synchronous replication method, the waiting time of the first storage cluster can be reduced.
[0239] Step 608: After receiving the replication completion message, the first storage cluster returns an operation completion message for the first operation request to the client.
[0240] It should be noted that steps 604 to 608 above are described using synchronous replication as an example. In some embodiments, asynchronous replication is used, that is, after the first storage cluster sends the operation log to the second storage cluster, it immediately returns an operation completion message for the first operation request to the client. Under asynchronous replication, the process of the first storage cluster generating the operation log of the first operation request includes: the second NAS server obtains the metadata operation log from the first metadata storage node based on the logical sequence number of the first operation request, obtains the data carried by the first operation request from the first data storage cluster based on the metadata operation log, and generates the operation log of the first operation request based on the data operation log, the metadata operation log and the logical sequence number of the first operation request. Among them, the second NAS server obtains the metadata operation log from the first metadata storage node in a round-robin manner according to the logical sequence number.
[0241] Step 609: The second storage cluster replays the first operation request based on the operation log.
[0242] The process by which the second storage cluster replays the first operation request based on the operation log includes: when the first operation request meets the second concurrent replay condition, adding the first operation request to the data concurrent replay queue according to the execution order of the first operation request, performing data replay on the first operation request; when the first operation request meets the first concurrent replay condition, adding the first operation request from the data concurrent replay queue to the metadata concurrent replay queue according to the execution order of the first operation request, performing metadata replay on the first operation request, and adding the first operation request from the metadata replay queue to the replayed queue. The second concurrent replay condition indicates that the first operation request and the operation requests in the data concurrent replay queue are not mutually exclusive, and multiple operation requests in the data concurrent replay queue can be concurrently executed.Data replay. The non-mutual exclusion between the first operation request and the operation requests in the concurrent data replay queue means that the first operation request and the operation requests in the concurrent data replay queue can be executed in parallel. For example, the data address corresponding to the first operation request is different from the data address corresponding to the operation request in the concurrent metadata replay queue; that is, the data address ranges corresponding to the first operation request and the operation requests in the concurrent data replay queue cannot overlap.
[0243] The second storage cluster performing metadata replay on the first operation request includes: the second NAS server cluster obtaining metadata operation logs from the second data storage cluster and sending the metadata operation logs to the second metadata storage node; the second metadata storage node performing metadata replay on the first operation request based on the metadata operation logs.
[0244] The second storage cluster also includes a second metadata storage node. Each storage partition includes a data storage partition and a metadata storage partition. The data carried by the first operation request and the logical sequence number of the first operation request are stored in the metadata storage partition of the third storage partition. The second storage cluster performs data replay on the first operation request, including: the second NAS server cluster obtains metadata operation logs from the second data storage cluster and sends the metadata operation logs to the second metadata storage node; the second metadata storage node determines multiple third storage partitions in the second storage cluster based on the metadata operation logs, and writes the data carried by the first operation request from the metadata storage partition of the third storage partition to the data storage partition of the third storage partition.
[0245] In the above method, the first storage cluster executes the first operation request based on the semantics of the first operation request and generates an operation log corresponding to the semantics of the first operation request; the first storage cluster sends the operation logs to the second storage cluster; the second storage cluster replays the first operation request based on the operation logs. In the above method, generating operation logs based on the semantics of the operation request and replaying the operation request based on the operation logs is to implement data replication at the file semantic layer. Compared with implementing data replication at the block layer, it does not rely on the replication capability of the block layer and can use a set of data replication schemes to achieve synchronous replication and asynchronous replication capabilities. Therefore, it is not necessary to design different block layer schemes to achieve synchronous replication and asynchronous replication, thereby reducing the complexity of distributed file system development and maintenance and improving data replication performance. Furthermore, a single scheme is used to implement synchronous replication and asynchronous replication, reducing system complexity.
[0246] Below, taking the first operation request as a data write request as an example, the process shown in steps 601 to 609 above will be illustrated.
[0247] Example 5: After the master NAS Server (i.e., the first NAS server cluster) receives the write operation request, the processing module (deployed on the first NAS server in the first NAS server cluster) distributes the data according to the PT distribution rule.The data is broken down and then forwarded in chunks to the corresponding Space node (i.e., the data storage node in the first storage cluster) where the PT is located. After receiving the data chunks, the master Space node appends the write-allocation (WAL) to the corresponding PT. This data request is processed by the Space node (as described on page 23 / 31 of the manual, CN 121051082 A). (The background process moves the data from the WAL to the data area to reduce operation latency). After the master processing module finishes writing the data chunks, it sends the metadata related to the write operation request to the master MDS node (i.e., the first metadata storage node in the first NAS server cluster). The master MDS node assigns a globally unique LSN to this write operation request and persists the KVLOG. After execution, it returns the LSN and KVLOG to the NAS Server node. After receiving the LSN and KVLOG corresponding to the write operation request, the NAS Server: if it is synchronous replication, NAS... The server forwards the LSN, KVLOG, and data to the replication module. The replication module (deployed on the first NAS server in the first NAS server cluster) assembles the complete log and sends it to the backup for processing via the replication link. After processing, this Write request ends. If it is asynchronous replication, this Write request ends, and the replication module reads the KVLOG from the master MDS node in LSN order (e.g., it can obtain it by polling in LSN order). Then, according to the KVLOG, it reads the WAL from the corresponding PT according to the same PT shuffling rule as in step 1, assembles it into a complete log (that is, the operation log of the first operation request), and sends it to the backup for processing via the replication link. Among them, the complete log is the operation log, and the LSN indicates the execution order of the operation request.
[0248] Example 6: Based on Example 5, the replication module is bound to the processing module in the NAS Server of the master NAS cluster. All LSNs are divided into N logical Shards (groups). Each Shard is mapped to the replication module of a NAS Server node (each NAS Server will not have the same Shard), so that multiple nodes can replicate concurrently to improve replication performance. Based on the distributed file system shown in Figure 2, the process of executing a write operation request in the first storage cluster includes: After receiving the write request, the master NAS Server first selects a shard within the current NAS Server node, then shuffles the data according to the PT shuffling rules, and then forwards the shuffled data blocks to the corresponding PT's Space node; after receiving the data blocks, each node in the master Space appends the write write log (WAL) to the corresponding PT, and the data request is completed at the Space node.(The background process will move the data from WAL to the data area to reduce operation latency); After the master processing module finishes writing the data blocks, it sends the operation-related metadata and corresponding shard information to the master MDS node; The master MDS node assigns a globally unique LSN for this write operation request and persists the KVLOG to the shard. After execution, it returns the LSN and KVLOG to the NAS Server node; After the NAS Server receives the LSN and KVLOG corresponding to the write operation request: If it is synchronous replication, the NAS Server processing module directly assembles the LSN, KVLOG and data into a complete log and sends it to the backup for processing via the replication link. After processing, this write operation request ends; If it is asynchronous replication, this write operation request ends here. Each shard's replication module in all NAS Servers reads its own LSN and KVLOG from the MDS in shard order. Then, based on the KVLOG, using the same shuffling rules as the processing module, it reads the WAL log from the corresponding PT. The LSN, metadata operation log, and data blocks are assembled into a complete log and sent to the backup end for processing via the replication link. As can be seen from the above example, compared to Example 5, Example 6 significantly improves the efficiency and throughput of log replication by mapping the LSN to N shards according to certain rules, storing the metadata operation log at the shard granularity in the MDS, and having each replication module in the NAS Server read the metadata operation log from the MDS at the shard granularity and concurrently replicate it to the backup end for processing.
[0249] Example 7: Based on Example 6, in the second storage cluster, the LSN is mapped to N logical shards according to certain rules, and these N logical shards are then mapped to M PTs, thereby ensuring that each shard knows which PT its logs are stored in for subsequent replay processing (M and N are both positive integers). In the second storage cluster, the second NAS server cluster includes a replication module, which is responsible for receiving replication messages sent by the first storage cluster and deserializing them into metadata operation logs and data; in addition, it also includes a log module, which is responsible for calculating the attribution PT of the metadata operation logs according to their LSN and data offset, so as to perform log distribution balancing; the second data storage cluster includes a log module and a playback module, and divides the storage area into an RDL area (that is, a metadata storage partition) and a data area (that is, a data storage partition). The RDL area is used to store logs, and the data area is used to store the actual data of user files (that is, the data carried by the operation request).
[0250] Referring to Figure 4, Figure 4 is a flowchart of copying operation logs provided by an embodiment of this application, referring to the first specification 24 / 31 pages 31 CN 121051082 ATaking a write operation request as an example, the process of replicating the operation log in the second storage cluster includes: The replication module of one node in the NAS Server cluster receives the replication message of the write operation request sent by the master and deserializes it into the metadata log and data of the write operation request; the log module obtains the belonging shard ID by taking the modulo of the LSN of the metadata log of this write operation request with the total number of shards, and then obtains the ID of the PT to which the metadata log (excluding data) belongs by taking the modulo of the shard ID with the total number of PTs. At the same time, the data of this write operation request is broken into multiple data blocks according to the inode and offset, and each data block also has its own belonging PT ID. Finally, a write operation request is divided into a metadata operation log (not containing data, only recording metadata information such as LSN, inode, and offset) and multiple data blocks (containing LSN, data, etc.). Finally, the log module sends these to the Space node where their respective belonging PT is located; after receiving the log, each Space node appends it to the redo log in the RDL area, and the backup replication process is completed. In Example 7, any node in the NAS Server cluster can receive any replication message sent by the master. The log module maps the log LSN to N Shards, and the N Shards are mapped to M PTs to distribute the metadata log evenly to different storage areas. This improves replication performance by utilizing multiple nodes and also facilitates subsequent playback processing.
[0251] Meanwhile, for write operation requests, in addition to storing the metadata information in the PT according to the mapping rules, the data is also distributed into multiple data blocks according to the PT's distribution rules. The data blocks and LSNs are stored in the RDL area of the corresponding PT. When replaying this write operation request, it is only necessary to first read the inode, offset, length and other information from the PT where the metadata information is located, and then calculate the PT where each data block is located according to the PT distribution rules based on this information. The playback data request can then be sent to the PT where each data block is located. Finally, the logs read locally in the PT are moved to the data area to complete the data playback operation. During playback, there is no need to read and write data blocks across nodes, which greatly reduces the network traffic between nodes and improves playback performance.
[0252] Example 8: Based on Example 7, the process of the second storage cluster replaying operation logs is as follows: The replay module of the NAS Server loads the metadata logs of its own shard into the replay module according to the LSN order, and forwards them to the MDS node to add them to the waiting replay queue (in Example 3, we have mapped the LSN to N shards according to certain rules, and each shard is associated with a NAS).The server's replay module is bound, allowing the replay module to know which LSNs it should be responsible for replaying. The MDS, as the replay control center, receives the metadata logs and LSNs forwarded by the NAS server. Its internal replay module maintains two sliding windows: a metadata concurrent replay window (equivalent to a metadata concurrent replay queue) and a data concurrent replay window (equivalent to a data concurrent replay queue), as shown in Figure 5. Figure 5 is a schematic diagram of a concurrent replay window provided in this embodiment, strictly arranged in ascending order of LSNs for replay. LSNs first enter the data concurrent replay window (LSNs within the concurrent replay window must be non-exclusive; for example, different data operation requests targeting different storage address ranges cannot overlap, and metadata operation requests are skipped in the data replay window). Only after data replay is complete can LSNs enter the metadata concurrent replay window (LSNs within the concurrent replay window must also be mutually exclusive; for example, inodes cannot be identical). The size of the sliding window controls the degree of concurrent replay, and the non-exclusive mechanism for LSNs entering the window also ensures the correctness of the replay.
[0253] Referring to FIG7, FIG7 is a schematic diagram of a playback process provided in an embodiment of the present application. The concurrent data playback window process and the concurrent metadata playback window process are shown below. Upon entering the concurrent data replay window (non-write operation requests are directly marked as completed data replay), MDS broadcasts a list of LSNs for all write operation requests within the replay window to all NAS Server nodes. Each NAS Server, upon receiving the list of replayable write operation request LSNs, calculates the PT (Primary Time Limit) for the data block based on the PT shuffling rules from the write metadata (including inodes, offsets, etc.) within this list, and then issues a data replay request to the corresponding PT. The Space node of the corresponding PT receives the data replay request, reads the data block from its local RDL area, and moves it to Area A (page 25 / 31, CN 121051082, section A of the data specification), completing the data replay. The NAS Server then reports the information that the corresponding LSN has completed data replay to MDS. MDS marks the LSNs that have completed data replay as completed and awaits entry into the metadata concurrent replay window.
[0254] In Example 8, each NAS Server's replay module is bound to one or more Shards. The LSN that this NAS Server needs to load for replay is obtained through the mapping rules between LSN and Shard. Then, the PT where the metadata log of this LSN is located is calculated through the LSN. After reading the metadata log from the corresponding PT, it is forwarded to the MDS node, and then the data is replayed through the concurrent replay window.The concurrent playback window mechanism for the interface and metadata significantly improves the concurrency of playback and speeds up playback while ensuring playback correctness.
[0255] The file semantic layer replication method and technology based on logs proposed in this application can also be applied to master-slave replication scenarios in distributed clusters, such as distributed databases, distributed KV systems, etc.
[0256] Figure 8 is a schematic diagram of the structure of a data replication device in a distributed file system provided in an embodiment of this application. The device includes a receiving module 801, an execution module 802, and a sending module 803.
[0257] The receiving module 801 is configured to: receive a first operation request for a file, execute the first operation request based on the semantics of the first operation request, and obtain an execution result corresponding to the semantics of the first operation request. The execution result includes at least one of the execution result of the file's data and the execution result of the file's metadata;
[0258] The generating module 802 is configured to: generate an operation log for the first operation request based on the execution result and the execution order of the first operation request;
[0259] The sending module 803 is configured to: send the operation log to the second storage cluster, which is used by the second storage cluster to replay the first operation request.
[0260] In one possible implementation, the generation module 802 is used to:
[0261] If the first operation request is an operation request on the metadata of a file, then execute the first operation request to obtain the execution result on the metadata of the file, generate a metadata operation log based on the execution result on the metadata of the file, and generate an operation log for the first operation request based on the metadata operation log and the execution order of the first operation request;
[0262] If the first operation request is an operation request on the data of a file, then execute the first operation request to obtain the execution result on the data of the file and the execution result on the metadata of the file, generate a data operation log based on the execution result on the metadata of the file, generate a metadata operation log based on the execution result on the metadata of the file, and generate an operation log for the first operation request based on the metadata operation log, the data operation log, and the execution order of the first operation request.
[0263] FIG9 is a schematic diagram of the structure of a data replication device in a distributed file system provided in an embodiment of this application. The device includes a receiving module 901 and a playback module 902.
[0264] A receiving module 901 is configured to receive an operation log sent by a first storage cluster. The operation log indicates the execution result and the execution order of the first operation request, which is an operation request for a file. The execution result includes at least one of the execution result of the file's data and the execution result of the file's metadata.
[0265] A playback module 902 is configured to play back the first operation request based on the operation log.
[0266] In one possible implementation, the playback module 902 includes:
[0267] A storage unit is used to store operation logs based on the execution order of the first operation request;
[0268] A playback unit is used to play back the first operation request based on the operation log.
[0269] In one possible implementation, the storage unit is used to:
[0270] If the operation log includes a metadata operation log, then the metadata operation log is stored based on the execution order of the first operation request, and the metadata operation log indicates the execution result of the file's metadata; Specification 26 / 31 pages 33 CN 121051082 A
[0271] If the operation log includes a metadata operation log and a data operation log, then the metadata operation log and the data operation log are stored based on the execution order of the first operation request, and the data operation log indicates the execution result of the file's data.
[0272] In one possible implementation, the playback unit is used to:
[0273] According to the execution order of the first operation requests, the first operation requests are added to the waiting replay queue. If the first operation request is a file metadata operation request, when the first operation request meets the first concurrent replay condition, the first operation request is added to the metadata concurrent replay queue according to the execution order of the first operation requests, metadata replay is performed on the first operation request, and the first operation request is added from the metadata replay queue to the replay queue. The first concurrent replay condition indicates that the first operation request and the operation requests in the metadata concurrent replay queue are not mutually exclusive, and multiple operation requests in the metadata concurrent replay queue can be replayed concurrently. If the first operation request is a file data operation request... When the first operation request meets the second concurrent replay condition, the first operation request is added to the data concurrent replay queue according to the execution order of the first operation request, and data replay is performed on the first operation request. When the first operation request meets the first concurrent replay condition, the first operation request is added from the data concurrent replay queue to the metadata concurrent replay queue according to the execution order of the first operation request, and metadata replay is performed on the first operation request. The first operation request is added from the metadata replay queue to the replay queue. The second concurrent replay condition indicates that the first operation request and the operation requests in the data concurrent replay queue are not mutually exclusive, and multiple operation requests in the data concurrent replay queue can be replayed concurrently.
[0274] The receiving module 801, the execution module 802, the sending module 803, the receiving module 901, and the replay module 902 can all be implemented by software or by hardware. For example, the implementation method of the receiving module 801 will be described below using the receiving module 801 as an example. Similarly, the implementation methods of execution module 802, sending module 803, receiving module 901, and playback module 902 can refer to the implementation method of receiving module 801.
[0275] As an example of a software functional unit, the receiving module 801 may include modules running on a computing instance.The code. The computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Further, the computing instance may be one or more. For example, the receiving module 801 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code may be distributed in the same region or in different regions. Further, the multiple hosts / virtual machines / containers used to run the code may be distributed in the same availability zone (AZ) or in different AZs, each AZ including one data center or multiple geographically proximate data centers. Typically, a region may include multiple AZs.
[0276] Similarly, the multiple hosts / virtual machines / containers used to run the code may be distributed in the same virtual private cloud (VPC) or in multiple VPCs. Typically, a VPC is set up within one region. Cross-region communication between two VPCs within the same region, and between VPCs in different regions, requires a communication gateway to be set up within each VPC to achieve interconnection between VPCs.
[0277] As an example of a hardware functional unit, the receiving module 801 may include at least one computing device, such as a server. Alternatively, the receiving module 801 may also be a device implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.
[0278] The multiple computing devices included in the receiving module 801 may be distributed in the same region or in different regions. The multiple computing devices included in the receiving module 801 may be distributed in the same Availability Zone (AZ) or in different AZs. Similarly, the multiple computing devices included in the receiving module 801 may be distributed in the same Virtual Private Cloud (VPC) or in different Virtual Private Clouds (VPCs).In multiple VPCs. Among them, multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.
[0279] It should be noted that, in other embodiments, the receiving module 801 can be used to execute any step in the data replication method in the distributed file system, the execution module 802 can be used to execute any step in the data replication method in the distributed file system, the sending module 803 can be used to execute any step in the data replication method in the distributed file system, the receiving module 901 and the playback module 902 can be used to execute any step in the data replication method in the distributed file system, and the steps implemented by the receiving module 801, the execution module 802, the sending module 803, the receiving module 901 and the playback module 902 can be specified as needed. The receiving module 801 and the execution module 802 respectively implement all the functions of the data replication device in the distributed file system shown in FIG8; or, the sending module 803, the receiving module 901 and the playback module 902 respectively implement all the functions of the data replication device in the distributed file system shown in FIG9.
[0280] This application embodiment also provides a storage node 1000. Figure 10 is a schematic diagram of a storage node provided in an embodiment of this application. As shown in Figure 10, the storage node 1000 includes: a bus 1001, a processor 1002, a memory 1003, and a communication interface 1004. The processor 1002, the memory 1003, and the communication interface 1004 communicate with each other through the bus 1001. The storage node 1000 can be a storage node or a terminal device. It should be understood that this application does not limit the number of processors and memories in the storage node 1000.
[0281] The bus 1001 can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, only one line is used in Figure 10, but this does not mean that there is only one bus or one type of bus. Bus 1001 may include a path for transmitting information between various components of storage node 1000 (e.g., memory 1003, processor 1002, communication interface 1004).
[0282] Processor 1002 may include a central processing unit (CPU), graphics processing unit (GPU), microprocessor (MP), or digital signal processor (DSP).
[0283] The memory 1003 may include volatile memory, such as random access memory (RAM). The memory 1003 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state drive (SSD).
[0284] The memory 1003 stores executable program code, which the processor 1002 executes to implement the functions of the aforementioned receiving module 801, generating module 802, and sending module 803, or to implement the functions of the aforementioned receiving module 901 and playback module 902, thereby implementing the steps in the data copying method of the distributed file system. That is, the memory 1003 stores instructions for executing the data copying method of the distributed file system. FIG10 only shows, by way of example, the program code stored in the memory 1003 to implement the functions of the aforementioned receiving module 901 and recycling module 902.
[0285] The communication interface 1004 uses, for example, but not limited to, a transceiver module such as a network interface card or transceiver, to realize communication between the storage node 1000 and other devices or communication networks.
[0286] This application embodiment also provides a storage cluster. FIG11 is a schematic diagram of a storage cluster provided in this application embodiment. As shown in FIG11, the storage cluster includes at least one storage node 1000. The memory 1003 of one or more storage nodes 1000 in the storage cluster may store the same instructions for executing the data replication method in the distributed file system.
[0287] In some possible implementations, the memory 1003 of one or more storage nodes 1000 in the storage cluster may also store partial instructions for executing the data replication method in the distributed file system. In other words, a combination of one or more storage nodes 1000 can jointly execute the instructions for executing the data replication method in the distributed file system.
[0288] It should be noted that the memory 1003 in different storage nodes 1000 in the storage cluster can store different instructions, which are used to execute some functions of the data replication device in the distributed file system. That is, the instructions stored in the memory 1003 in different storage nodes 1000 can implement the functions of one or more of the aforementioned receiving module 801, generating module 802, sending module 803, receiving module 901, and playback module 902.
[0289] It should be understood that the function of storage node 1000 shown in Figure 11 can also be performed by multiple storage nodes 1000.
[0290] In some possible implementations, one or more storage nodes in a storage cluster can be connected via a network. This network can be a wide area network (WAN) or a local area network (LAN), etc. Figure 12 shows one possible implementation. Figure 12 is a schematic diagram of a possible implementation of a storage cluster provided in an embodiment of this application. As shown in Figure 12, storage node 1000A and storage node 1000B are connected via a network. Specifically, they are connected to the network through the communication interface in each storage node. In this type of possible implementation, the memory 1003 in storage node 1000A stores instructions for performing the function of the receiving module 901. Figure 12 uses the example of the memory 1003 in storage node 1000A storing instructions for performing the function of the receiving module 901. Meanwhile, the memory 1003 in storage node 1000B stores instructions for performing the function of the playback module 902. Figure 12 shows an example where the memory 1003 of storage node 1000B stores instructions for executing the function of playback module 902.
[0291] This application embodiment also provides another storage cluster. The connection relationship between the storage nodes in this storage cluster can be similarly referred to the connection method in Figure 11 or Figure 12. The difference is that the memory 1003 of one or more storage nodes 1000 in this storage cluster can store the same instructions for executing the data replication method in the distributed file system.
[0292] In some possible implementations, the memory 1003 of one or more storage nodes 1000 in this storage cluster can also store some instructions for executing the data replication method in the distributed file system. In other words, a combination of one or more storage nodes 1000 can jointly execute the instructions for executing the data replication method in the distributed file system.
[0293] It should be noted that the memory 1003 of different storage nodes 1000 in the storage cluster can store different instructions, which are used to execute some functions of the data replication device in the distributed file system. That is, the instructions stored in the memory 1003 of different storage nodes 1000 can implement the functions of one or more of the aforementioned receiving module 801, generating module 802, sending module 803, receiving module 901, and playback module 902.
[0294] This application embodiment also provides a computer program product containing instructions. The computer program product may be a software or program product containing instructions that can run on a computing device or be stored in any available medium. When the computer program product is run on at least one computing device, it causes the at least one computing device to execute a data copying method in a distributed file system.
[0295] This application embodiment also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that a computing device can store, or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state drive). The computer-readable storage medium includes instructions that instruct the computing device to execute a data copying method in a distributed file system as described on pages 29 / 31 of the specification, CN 121051082 A.
[0296] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.), and signals involved in this application are all authorized by the user or fully authorized by all parties, and the collection, use, and processing of related data must comply with the relevant laws, regulations, and standards of the relevant countries and regions. For example, the storage clusters and storage spaces involved in this application are obtained under fully authorized conditions.
[0297] Those skilled in the art will recognize that the method steps and units described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the steps and components of each embodiment have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0298] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0299] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the unit is only a logical functional division. In actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices or units, or may be electrical, mechanical or other forms of connection.
[0300] The unit described as a separate component may or may not be physically separated, and is shown as a unit.The components may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of the embodiments of this application, depending on actual needs.
[0301] Furthermore, the units in the various embodiments of this application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The integrated unit can be implemented in hardware or software.
[0302] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computing device (which may be a personal computer, a server, or a computing device, etc.) to execute all or part of the steps of the methods in the various embodiments of this application. The aforementioned storage media include: USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, optical disks, and other media capable of storing program code.
[0303] In this application, the terms "first," "second," etc., are used to distinguish between identical or similar items with essentially the same function. It should be understood that there is no logical or temporal dependency between "first," "second," and "nth," nor is there any limitation on quantity or execution order. It should also be understood that although the following description uses the terms "first," "second," etc., to describe various elements, these elements should not be limited by the terms. These terms are only used to distinguish one element from another. For example, without departing from the scope of various examples, a first storage cluster may be referred to as a second storage cluster, and similarly to page 30 / 31 of the specification, 37 CN 121051082 A, a second storage cluster may be referred to as a first storage cluster. Both the first and second storage clusters can be storage clusters, and in some cases, they can be separate and different storage clusters.
[0304] In this application, the term "at least one" means one or more, and the term "multiple" means two or more. The terms "system" and "network" are often used interchangeably herein.
[0305] It should also be understood that the term "if" can be interpreted as "when" or "upon" or "in response to determination" or "in response to detection." Similarly, depending on the context, the phrases "if determination..." or "if detection [as stated]...""Condition or event" can be interpreted as "when it is determined that..." or "in response to determining that..." or "when [the stated condition or event] is detected" or "in response to detecting [the stated condition or event]".
[0306] The above description is only a specific embodiment of this application, but the protection scope of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should be covered within the protection scope of this application. Therefore, the protection scope of this application should be determined by the protection scope of the claims.
[0307] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer program instructions. When the computer program instructions are loaded and executed on a computer, the flow or function according to the embodiments of this application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device.
[0308] The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer program instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired or wireless means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., digital video disc, DVD), or a semiconductor medium (e.g., solid-state drive)).
[0309] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0310] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application. Specification 31 / 31 pages 38 CN 121051082 A Figure 1 Specification Drawings 1 / 9 pages 39 CNFigure 2 (Instruction Manual Appendix 2 / 9, Page 40) CN 121051082 A Figure 3 (Instruction Manual Appendix 3 / 9, Page 41) CN 121051082 A Figure 4 Figure 5 (Instruction Manual Appendix 4 / 9, Page 42) CN 121051082 A Figure 6 (Instruction Manual Appendix 5 / 9, Page 43) CN 121051082 A Figure 7 (Instruction Manual Appendix 6 / 9, Page 44) CN 121051082 A Figure 8 Figure 9 (Instruction Manual Appendix 7 / 9, Page 45) CN 121051082 A Figure 10 Figure 11 (Instruction Manual Appendix 8 / 9, Page 46) CN 121051082 A Figure 12 (Instruction Manual Appendix 9 / 9, Page 47) CN 121051082 A Title: DATA REPLICATION METHOD FOR DISTRIBUTED FILE SYSTEM, AND DISTRIBUTED FILE SYSTEM Abstract: The present application relates to the technical field of storage, and provides a data replication method for a distributed file system, and a distributed file system.log. In the described method, generating the operation log on the basis of the semantics of the operation request, and replaying the operation request on the basis of the operation log are to implement data replication at a file semantic layer; compared with implementing data replication at a block layer, the method does not rely on the replication capability of the block layer, and can use a single data replication scheme to implement both synchronous and asynchronous replication capabilities; thus, there is no need to design different block layer schemes to implement synchronous and asynchronous replication, thereby reducing the complexity of system development and maintenance, improving the data replication performance. Abstract
Claims
1. A data replication method in a distributed file system, characterized in that, The method, executed by a first storage cluster in a distributed file system, which further includes a second storage cluster, comprises: Receive a first operation request for a file, execute the first operation request based on the semantics of the first operation request, and obtain an execution result corresponding to the semantics of the first operation request. The execution result includes at least one of the execution result of the data of the file and the execution result of the metadata of the file. Based on the execution result and the execution order of the first operation request, an operation log for the first operation request is generated; The operation log is sent to the second storage cluster, and the operation log is used by the second storage cluster to replay the first operation request.
2. The method according to claim 1, characterized in that, Based on the semantics of the first operation request, the first operation request is executed to obtain an execution result corresponding to the semantics of the first operation request. Based on the execution result and the execution order of the first operation request, an operation log of the first operation request is generated, including: If the first operation request is an operation request on the metadata of the file, then the first operation request is executed to obtain the execution result of the metadata of the file. Based on the execution result of the metadata of the file, a metadata operation log is generated. Based on the metadata operation log and the execution order of the first operation request, an operation log of the first operation request is generated. If the first operation request is an operation request on the data of the file, then the first operation request is executed to obtain the execution result of the data of the file and the execution result of the metadata of the file. Based on the execution result of the data of the file, a data operation log is generated. Based on the execution result of the metadata of the file, a metadata operation log is generated. Based on the metadata operation log, the data operation log and the execution order of the first operation request, an operation log of the first operation request is generated.
3. The method according to claim 2, characterized in that, The first storage cluster includes a first network-attached storage (NAS) server cluster and a first metadata storage node; If the first operation request is an operation request on the metadata of the file, then the first operation request is executed to obtain the execution result on the metadata of the file. Based on the execution result on the metadata of the file, a metadata operation log is generated. Based on the metadata operation log and the execution order of the first operation request, an operation log for the first operation request is generated, including: If the first operation request is an operation request on the metadata of the file, the first NAS server cluster sends the metadata targeted by the first operation request to the first metadata storage node; The first metadata storage node assigns a logical sequence number to the first operation request, executes the first operation request on the metadata, obtains the execution result of the metadata of the file, and generates the metadata operation log based on the execution result of the metadata of the file. The logical sequence number is used to indicate the execution order of the first operation request. The first NAS server generates the operation log of the first operation request based on the metadata operation log and the execution order of the first operation request.
4. The method according to claim 2, characterized in that, The first storage cluster includes a first NAS server cluster, a first metadata storage node, and a first data storage cluster; If the first operation request is a data operation request for the file, then the first operation request is executed to obtain the execution result of the data operation on the file and the execution result of the metadata operation on the file. Based on the execution result of the data operation on the file, a data operation log is generated. Based on the execution result of the metadata operation on the file, a metadata operation log is generated. Based on the metadata operation log, the data operation log, and the execution order of the first operation request, an operation log for the first operation request is generated, including: If the first operation request is a data operation request for the file, then the first NAS server cluster sends the data carried in the first operation request to the first data storage cluster; The first data storage cluster executes the first operation request on the data carried by the first operation request, obtains the execution result of the data on the file, and generates the data operation log based on the execution result of the data on the file; The first NAS server cluster sends the metadata targeted by the first operation request to the first metadata storage node; The first metadata storage node assigns a logical sequence number to the first operation request, executes the first operation request on the metadata, obtains the execution result of the metadata of the file, and generates the metadata operation log based on the execution result of the metadata of the file. The logical sequence number is used to indicate the execution order of the first operation request. The first NAS server cluster generates the operation log of the first operation request based on the data operation log, the metadata operation log, and the logical sequence number of the first operation request.
5. The method according to claim 3, characterized in that, The first NAS server cluster includes at least one first NAS server and at least one second NAS server. The first NAS server is used to receive and forward operation requests, and the second NAS server is used to generate and forward operation logs of operation requests. The first NAS server cluster generates an operation log for the first operation request based on the metadata operation log and the logical sequence number of the first operation request, including any one of the following: The first NAS server receives the metadata operation log and the logical sequence number of the first operation request sent by the first metadata storage node, and sends the metadata operation log and the logical sequence number of the first operation request to the second NAS server. The second NAS server generates the operation log of the first operation request based on the metadata operation log and the logical sequence number of the first operation request. The second NAS server retrieves the metadata operation log from the first metadata storage node according to the logical sequence number of the first operation request, and generates the operation log of the first operation request based on the metadata operation log and the logical sequence number of the first operation request.
6. The method according to claim 4, characterized in that, The first NAS server cluster includes multiple first NAS servers and at least one second NAS server. The first NAS servers are used to receive and forward operation requests, and the second NAS servers are used to generate and forward operation logs of the operation requests. The first NAS server cluster generates an operation log for the first operation request based on the data operation log, the metadata operation log, and the logical sequence number of the first operation request, including any one of the following: The first NAS server receives the metadata operation log and the logical sequence number of the first operation request sent by the first metadata storage node, and sends the metadata operation log, the logical sequence number of the first operation request and the data carried by the first operation request to the second NAS server. The second NAS server generates the operation log of the first operation request based on the data operation log, the metadata operation log and the logical sequence number of the first operation request. The second NAS server obtains the metadata operation log from the first metadata storage node based on the logical sequence number of the first operation request, obtains the data carried by the first operation request from the first data storage cluster based on the metadata operation log, and generates the operation log of the first operation request based on the data operation log, the metadata operation log, and the logical sequence number of the first operation request.
7. The method according to claim 5 or 6, characterized in that, Each first NAS server is associated with a second NAS server. Each first NAS server is used to receive and forward a set of operation requests. The generation and forwarding of operation logs for the set of operation requests received and forwarded by each first NAS server are performed by the second NAS server associated with the first NAS server.
8. The method according to any one of claims 5 to 7, characterized in that, The first NAS server and the second NAS server are the same NAS server.
9. A data replication method in a distributed file system, characterized in that, The method, executed by a second storage cluster in a distributed file system, which further includes a first storage cluster, comprises: The system receives operation logs sent by the first storage cluster. The operation logs indicate the execution results corresponding to the semantics of the first operation request and the execution order of the first operation request. The first operation request is an operation request for a file. The execution results include at least one of the execution results of the data of the file and the execution results of the metadata of the file. Based on the operation log, the first operation request is replayed.
10. The method according to claim 9, characterized in that, The step of replaying the first operation request based on the operation log includes: The operation log is stored based on the execution order of the first operation request; Based on the operation log, the first operation request is replayed.
11. The method according to claim 10, characterized in that, The step of storing the operation log based on the execution order of the first operation request includes: If the operation log includes a metadata operation log, then the metadata operation log is stored based on the execution order of the first operation request, and the metadata operation log indicates the execution result of the metadata of the file; If the operation log includes a metadata operation log and a data operation log, then the metadata operation log and the data operation log are stored based on the execution order of the first operation request, and the data operation log indicates the execution result of the data of the file.
12. The method according to claim 11, characterized in that, The second storage cluster includes a second network attached storage (NAS) server cluster and a second data storage cluster. The second NAS server cluster is used to receive operation logs sent by the first storage cluster. The second data storage cluster includes multiple data storage nodes, and each data storage node includes at least one storage partition. If the operation log includes a metadata operation log, then based on the execution order of the first operation request, the metadata operation log is stored, and the metadata operation log indicates the execution result of the metadata of the file, including: If the operation log includes the metadata operation log, the second NAS server cluster determines the first storage partition in the second data storage cluster based on the logical sequence number of the first operation request in the operation log, and stores the metadata operation log in the first storage partition. The logical sequence number is used to indicate the execution order of the first operation request.
13. The method according to claim 11, characterized in that, The second storage cluster includes a second NAS server cluster and a second data storage cluster. The second NAS server cluster is used to receive operation logs sent by the first storage cluster. The second data storage cluster includes multiple data storage nodes, and each data storage node includes at least one storage partition. If the operation log includes a metadata operation log and a data operation log, then based on the execution order of the first operation request, the metadata operation log and the data operation log are stored. The data operation log indicates the execution result of the data in the file, including: If the operation log includes metadata operation log and data operation log, then the second NAS server cluster determines the second storage partition in the second data storage cluster based on the logical sequence number of the first operation request in the operation log, and stores the metadata operation log in the second storage partition. Based on the metadata operation log, the second NAS server cluster divides the data carried by the first operation request in the data operation log into at least one data block, determines at least one third storage partition in the second storage cluster, and stores one of the data blocks and the logical sequence number of the first operation request into one of the third storage partitions.
14. The method according to claim 12 or 13, characterized in that, The second NAS server cluster includes multiple third NAS servers, each of which is used to execute a stored procedure for the operation logs of a set of operation requests. The stored procedures for the operation logs of different sets of operation requests can be executed in parallel.
15. The method according to any one of claims 10 to 14, characterized in that, The step of replaying the first operation request based on the operation log includes: According to the execution order of the first operation requests, add the first operation requests to the waiting replay queue; If the first operation request is an operation request on the metadata of the file, when the first operation request meets the first concurrent replay condition, the first operation request is added to the metadata concurrent replay queue according to the execution order of the first operation requests, the metadata replay is performed on the first operation request, and the first operation request is added from the metadata replay queue to the replay queue. The first concurrent replay condition indicates that the first operation request and the operation requests in the metadata concurrent replay queue are not mutually exclusive, and multiple operation requests in the metadata concurrent replay queue can perform metadata replay concurrently. If the first operation request is a data operation request on the file, when the first operation request meets the second concurrent playback condition, the first operation request is added to the data concurrent playback queue according to the execution order of the first operation requests, and data playback is performed on the first operation request. When the first operation request meets the first concurrent playback condition, the first operation request is added from the data concurrent playback queue to the metadata concurrent playback queue according to the execution order of the first operation requests, and metadata playback is performed on the first operation request. The first operation request is added from the metadata playback queue to the already played-out queue. The second concurrent playback condition indicates that the first operation request and the operation requests in the data concurrent playback queue are not mutually exclusive, and multiple operation requests in the data concurrent playback queue can be played back concurrently.
16. The method according to claim 15, characterized in that, The second storage cluster also includes a second metadata storage node; The step of performing metadata replay on the first operation request includes: The second NAS server cluster obtains the metadata operation log from the second data storage cluster and sends the metadata operation log to the second metadata storage node; The second metadata storage node performs metadata replay on the first operation request based on the metadata operation log.
17. The method according to claim 15, characterized in that, The second storage cluster also includes a second metadata storage node. Each storage partition includes a data storage partition and a metadata storage partition. The data carried by the first operation request and the logical sequence number of the first operation request are stored in the metadata storage partition of the third storage partition. The step of replaying the data for the first operation request includes: The second NAS server cluster obtains the metadata operation log from the second data storage cluster and sends the metadata operation log to the second metadata storage node; Based on the metadata operation log, the second metadata storage node determines the plurality of third storage partitions in the second storage cluster, and writes the data carried by the first operation request in the third storage partition from the metadata storage partition of the third storage partition to the data storage partition of the third storage partition.
18. The method according to claim 16 or 17, characterized in that, The second NAS server cluster includes multiple fourth NAS servers, each of which is used to execute a replay process of a set of operation requests, and the replay processes of different sets of operation requests can be executed in parallel.
19. The method according to claim 18, characterized in that, The third NAS server and the fourth NAS server are the same NAS server.
20. A data replication method for a distributed file system, characterized in that, Applied to a distributed file system, the distributed file system comprising a first storage cluster and a second storage cluster, the method includes: The first storage cluster receives a first operation request for a file, executes the first operation request based on the semantics of the first operation request, and obtains an execution result corresponding to the semantics of the first operation request. The execution result includes at least one of the execution result of the data of the file and the execution result of the metadata of the file. The first storage cluster generates an operation log for the first operation request based on the execution result and the execution order of the first operation request; The first storage cluster sends the operation log to the second storage cluster; The second storage cluster receives the operation log sent by the first storage cluster and replays the first operation request based on the operation log.
21. A distributed file system, characterized in that, The distributed file system includes: The first storage cluster is used for: Receive a first operation request for a file, execute the first operation request based on the semantics of the first operation request, and obtain an execution result corresponding to the semantics of the first operation request. The execution result includes at least one of the execution result of the data of the file and the execution result of the metadata of the file. Based on the execution result and the execution order of the first operation request, an operation log for the first operation request is generated; Send the operation log to the second storage cluster; The second storage cluster is used for: The system receives the operation log sent by the first storage cluster and replays the first operation request based on the operation log.
22. A storage node, characterized in that, The storage node includes a memory and a processor; The processor is configured to execute instructions stored in the memory, causing the storage node to perform the data replication method in the distributed file system according to any one of claims 1 to 20.
23. A storage cluster, characterized in that, The storage cluster includes at least one storage node, and each storage node includes a memory and a processor; The processor of the at least one storage node is used to execute instructions stored in the memory of the at least one storage node, so that the storage cluster performs the data replication method in the distributed file system as described in any one of claims 1 to 20.
24. A computer program product containing instructions, characterized in that, When the instruction is executed by a storage node, the storage node performs the data replication method in a distributed file system as described in any one of claims 1 to 20; or, when the instruction is executed by a storage cluster, the storage cluster performs the data replication method in a distributed file system as described in any one of claims 1 to 20.
25. A computer-readable storage medium, characterized in that, The method includes computer program instructions, which, when executed by a storage node, enable the storage node to perform the log synchronization method as described in any one of claims 1 to 20; or, when executed by a storage cluster, enable the storage cluster to perform the data replication method in a distributed file system as described in any one of claims 1 to 20.