Method and system for modifying and backing up distributed file system

By obtaining file operation records and message queue processing at the file gateway layer, incremental backup of the distributed file system is realized, solving the problem of low backup efficiency, improving backup efficiency and reducing data loss.

CN118733342APending Publication Date: 2024-10-01CHINA TELECOM CLOUD TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410820441.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-24
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

Common distributed file systems cannot monitor file operations in real time, resulting in the need to scan all files in the file system during backup, which results in long backup times and low efficiency.

Method used

Obtain file operation records at the file gateway layer, process file operation requests asynchronously through the message queue, merge file operation notifications, generate a list of files to be backed up, and back up only the incremental parts to avoid full scanning.

Benefits of technology

The backup efficiency is improved, files can be backed up at smaller time intervals, and data loss during backup intervals is reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118733342A_ABST
    Figure CN118733342A_ABST
Patent Text Reader

Abstract

The invention provides a method and a system for modifying and backing up a distributed file system. The method comprises the following steps of: receiving a file operation request; asynchronously sending the file operation request to a message queue; obtaining the file operation notifications from the message queue, and merging all the file operation notifications to obtain a to-be-backed-up file list; and backing up the file list to be backed up. The incremental data can be backed up through the file operation record, all files in the file system do not need to be scanned, and the backup efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of file storage, and in particular relates to a modification and backup method and system for a distributed file system. Background Art

[0002] A distributed file system is a complete hierarchical file system that combines several different logical disk partitions or volumes through a computer network. A distributed file system allows access to files using the same interface and semantics as a local file system - for example, loading / unloading, listing directories, opening files, reading and writing files. A distributed file system allows programs to access or store independent files as if they were local files, and also allows multiple clients to access the file system simultaneously. Common distributed file systems include CephFS, GlusterFS, HDFS, etc. In order to prevent data loss caused by equipment failure or natural disasters, the data of the distributed file system needs to be backed up to another file system.

[0003] Since common distributed file systems do not have the inotify mechanism of local file systems, they cannot monitor file operations in real time, resulting in the need to scan all files in the file system during backup, which results in long backup time and low efficiency. Summary of the invention

[0004] In view of the above deficiencies in the prior art, an object of the present invention is to provide a modification and backup method and system for a distributed file system.

[0005] The present invention provides a modification and backup method for a distributed file system, comprising:

[0006] S1: receiving a file operation request;

[0007] S2: asynchronously sending the file operation request to a message queue;

[0008] S3: Obtain file operation notifications from the message queue, and merge all file operation notifications to obtain a list of files to be backed up;

[0009] S4: Backing up the list of files to be backed up.

[0010] According to a modification and backup method of a distributed file system provided by the present invention, step S1 further comprises:

[0011] S11: receiving a file operation request sent by the client;

[0012] S12: filtering the file operation request to obtain a modification type operation in the file operation request;

[0013] S13: The file operation monitoring process is deployed in the file gateway node;

[0014] S14: Asynchronously notifying the file operation monitoring process of the file operation request corresponding to the modification type operation.

[0015] According to a distributed file system modification and backup method provided by the present invention, the modification type operation in step S12 includes writing a file, deleting a file, and modifying a file attribute.

[0016] According to a distributed file system modification and backup method provided by the present invention, step S2 further comprises:

[0017] S21: the file operation monitoring process constructs the acquired file operation request corresponding to the modification type operation into a file operation message;

[0018] S22: Push the file operation message to a message queue.

[0019] According to a modification and backup method of a distributed file system provided by the present invention, step S22 also includes:

[0020] When the push fails due to a network failure, the file operation message is temporarily stored in the local file system. When the network is restored, all the file operation information temporarily stored in the local file system will continue to be pushed.

[0021] According to a modification and backup method of a distributed file system provided by the present invention, the file operation message in step S21 includes a timestamp, a file path to be operated, and an operation type.

[0022] According to a modification and backup method of a distributed file system provided by the present invention, in step S3, the file operation notification in the message queue is obtained by subscribing to the message queue.

[0023] According to a modification and backup method of a distributed file system provided by the present invention, in step S3, merging all file operation notifications specifically includes:

[0024] Merge the same file operations in the file operation notifications within the preset time;

[0025] Discard expired messages in file operation notifications;

[0026] Clear the files in the file list that have been backed up.

[0027] The present invention also provides a distributed file system modification backup system, which is used to execute a distributed file system modification backup method as described in any one of the above items, including:

[0028] Receiving module: used to receive file operation requests;

[0029] Forwarding module: used for asynchronously sending the file operation request to the message queue;

[0030] Subscription module: used to obtain file operation notifications from the message queue, and merge all file operation notifications to obtain a list of files to be backed up;

[0031] Backup module: used for backing up the list of files to be backed up.

[0032] According to a modification backup system of a distributed file system provided by the present invention, the receiving module and the forwarding module are both established based on a file gateway node.

[0033] The beneficial effects of the present invention are as follows:

[0034] The present invention provides a modification backup method and system for a distributed file system, which can back up only the incremental part modified by the client. Since common distributed file systems do not have the inotify mechanism of local file systems and cannot monitor file operations in real time, the present invention obtains file operation records at the gateway layer, and the backup control process backs up incremental data through the file operation records. This backup method does not need to scan all files in the file system, thereby improving backup efficiency, and can back up files at shorter time intervals, reducing data loss in the backup interval. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] The accompanying drawings are only used to illustrate specific embodiments and are not considered to limit the present invention. In the entire drawings, the same reference symbols represent the same components. Obviously, the drawings described below are only some embodiments recorded in the embodiments of the present invention. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings.

[0036] Figure 1 A flow chart of a method for modifying and backing up a distributed file system provided by an embodiment of the present invention;

[0037] Figure 2 A schematic diagram of the structure of a modification and backup system of a distributed file system provided by an embodiment of the present invention.

[0038] Reference numerals:

[0039] 100, receiving module; 200, forwarding module; 300, subscription module; 400, backup module. DETAILED DESCRIPTION

[0040] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention, the technical solutions of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. It should be understood that these descriptions are only exemplary and are not intended to limit the scope of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in the field without making creative work should fall within the scope of protection of the present invention.

[0041] Furthermore, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessarily obscuring the concepts disclosed in the present invention.

[0042] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the orientation or position relationship indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inside", "outside", etc. is based on the orientation or position relationship shown in the drawings, which is only for the convenience of describing the present invention and simplifying the description, and does not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation of the present invention. In addition, the terms "first", "second", and "third" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. The terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be a connection between the two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0043] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Instead, they are merely examples of methods and systems consistent with some aspects of the present invention as detailed in the appended claims.

[0044] Combine the following Figure 1 to Figure 2 Embodiments of the present invention are described.

[0045] like Figure 1 As shown, the present invention provides a modification and backup method of a distributed file system, comprising:

[0046] S1: receiving a file operation request;

[0047] In step S1, the client first sends a file operation request to the file gateway node, and then the file gateway node forwards the request to the backend distributed file system. The receiving operation is implemented by deploying a file operation monitoring process based on the original file gateway process to obtain file operations.

[0048] Wherein, step S1 further comprises:

[0049] S11: receiving a file operation request sent by the client;

[0050] S12: filtering the file operation request to obtain a modification type operation in the file operation request;

[0051] The modification type operation in step S12 includes writing a file, deleting a file, and modifying file attributes.

[0052] S13: The file operation monitoring process is deployed in the file gateway node;

[0053] S14: Asynchronously notifying the file operation monitoring process of the file operation request corresponding to the modification type operation.

[0054] In steps S11 to S14, first, based on the original file gateway process, a file operation monitoring process is deployed to obtain file operations and push file operation messages to the message queue. Specifically, after receiving the client file operation request, the gateway process filters out modification type file operations, such as writing, modifying file attributes, etc., and notifies the file operation monitoring process in an asynchronous manner.

[0055] S2: asynchronously sending the file operation request to a message queue;

[0056] In step S2, after receiving the file operation request from the client, the gateway process filters out the file operations of the modification type and notifies the file operation monitoring process in an asynchronous manner. The subsequent file operation monitoring process pushes the monitored file operations of the modification type to the message queue.

[0057] Step S2 further comprises:

[0058] S21: the file operation monitoring process constructs the acquired file operation request corresponding to the modification type operation into a file operation message;

[0059] The file operation message in step S21 includes a timestamp, a file path to be operated, and an operation type.

[0060] Furthermore, the constructed file operation message should include a timestamp, a file path, and an operation type. The timestamp records the operation time, which is used to merge operations within the backup control process time interval and discard expired operations; the file path records the path of the file being operated on; the operation type, such as deletion, data modification, metadata modification, and move, is used for backup control process merge operations to notify the backup module to synchronize file data or metadata.

[0061] S22: Push the file operation message to a message queue.

[0062] In steps S21 to S22, the file operation notification of the gateway process is first constructed as a file operation message through the file operation monitoring process, and the operation message can also be secondary filtered according to backup requirements, such as new files in a specified file directory and modified files in a specified directory.

[0063] Wherein, step S22 also includes:

[0064] When the push fails due to a network failure, the file operation message is temporarily stored in the local file system. When the network is restored, all the file operation information temporarily stored in the local file system will continue to be pushed.

[0065] If the push fails due to network failure or other reasons, the file operation record will be temporarily saved to the local file system and the temporary record will be pushed after recovery.

[0066] S3: Obtain file operation notifications from the message queue, and merge all file operation notifications to obtain a list of files to be backed up;

[0067] Step S3 is implemented through the backup control process, which performs corresponding file operation notification acquisition, obtains the corresponding list of files waiting to be backed up, and then initiates a backup request to perform backup in the subsequent step S4.

[0068] Wherein, in step S3, the file operation notification in the message queue is obtained by subscribing to the message queue.

[0069] In step S3, the merging of all file operation notifications specifically includes:

[0070] Merge the same file operations in the file operation notifications within the preset time;

[0071] Discard expired messages in file operation notifications;

[0072] Clear the files in the file list that have been backed up.

[0073] Subscribe to the file operation notification of the message queue, obtain the timestamp, full file path, and operation type, and put them into the list of files to be backed up. The controller regularly sends backup requests to the backup module, merges the same file operations within the time interval, discards the received expired messages, and clears the successfully backed up files in the list.

[0074] S4: Backing up the list of files to be backed up.

[0075] After steps S1 to S3, a list of files waiting to be backed up is obtained, and then the backup module backs up the files of the distributed file system to the target file system according to the list of files to be backed up, and can be connected to common backup software such as rsync and rclone.

[0076] Specifically, the controller periodically initiates a backup request to the backup module, and then the backup module obtains the files waiting to be backed up from the list of files to be backed up, and then the backup module initiates a backup file request to the distributed file system, and backs up to the backup file system associated with the distributed file system.

[0077] like Figure 2 As shown, the present invention also provides a distributed file system modification backup system, which is used to execute a distributed file system modification backup method as described in any one of the above items, including:

[0078] Receiving module 100: used to receive a file operation request;

[0079] Forwarding module 200: used for asynchronously sending the file operation request to a message queue;

[0080] Subscription module 300: used to obtain file operation notifications from the message queue, and merge all file operation notifications to obtain a list of files to be backed up;

[0081] The backup module 400 is used to back up the list of files to be backed up.

[0082] The modified subsystem as a whole includes a file gateway, a message queue, a backup control process, a distributed file system, and a backup file system.

[0083] Wherein, the receiving module 100 and the forwarding module 200 are both established based on the file gateway node.

[0084] The above-mentioned modification backup system is implemented by a gateway process in the file gateway node through a receiving module to receive file operation requests sent by the client, and then the gateway process filters them to obtain the modification operations in the file operation requests, and subsequently notifies the file operation monitoring process of the forwarding module, and then the file operation monitoring process pushes the message to the message queue.

[0085] Secondly, the backup control process implemented by the subscription module subscribes to the file operation events and inserts the modified files into the list of files to be backed up. Then the controller in the backup control process initiates a scheduled backup request to the backup module. After receiving the request, the backup module obtains the list to be backed up and backs up the target database.

[0086] The present invention provides a modification backup method and system for a distributed file system, which mainly obtains file operation records in a file gateway, and a backup control process backs up incremental data through the file operation records, so that only incremental data is backed up without scanning all files in the file system, thereby improving backup efficiency.

[0087] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the embodiments of the present invention, rather than to limit them. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the above embodiments, or replace some of the technical features therein by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention. Any changes or replacements that can be easily thought of by those skilled in the art within the technical scope disclosed in the present invention should be covered within the protection scope of the present invention.

Claims

1. A modification and backup method for a distributed file system, characterized in that: include: S1: receiving a file operation request; S2: asynchronously sending the file operation request to a message queue; S3: Obtain file operation notifications from the message queue, and merge all file operation notifications to obtain a list of files to be backed up; S4: Backing up the list of files to be backed up.

2. A method for modifying and backing up a distributed file system according to claim 1, characterized in that: Step S1 further comprises: S11: receiving a file operation request sent by the client; S12: filtering the file operation request to obtain a modification type operation in the file operation request; S13: The file operation monitoring process is deployed in the file gateway node; S14: Asynchronously notifying the file operation monitoring process of the file operation request corresponding to the modification type operation.

3. A method for modifying and backing up a distributed file system according to claim 2, characterized in that: The modification type operation in step S12 includes writing a file, deleting a file, and modifying file attributes.

4. The modification and backup method of a distributed file system according to claim 2, characterized in that: Step S2 further comprises: S21: The file operation monitoring process constructs the acquired file operation request corresponding to the modification type operation into a file operation message; S22: Push the file operation message to a message queue.

5. A method for modifying and backing up a distributed file system according to claim 4, characterized in that: Step S22 also includes: When the push fails due to a network failure, the file operation message is temporarily stored in the local file system. When the network is restored, all the file operation information temporarily stored in the local file system will continue to be pushed.

6. A method for modifying and backing up a distributed file system according to claim 4, characterized in that: The file operation message in step S21 includes a timestamp, a file path to be operated, and an operation type.

7. The modification and backup method of a distributed file system according to claim 1, characterized in that: In step S3, the file operation notification in the message queue is obtained by subscribing to the message queue.

8. The modification and backup method of a distributed file system according to claim 1, characterized in that: In step S3, the merging of all file operation notifications specifically includes: Merge the same file operations in the file operation notifications within the preset time; Discard expired messages in file operation notifications; Clear the files in the file list that have been backed up.

9. A distributed file system modification backup system, used to execute a distributed file system modification backup method as claimed in any one of claims 1 to 8, characterized in that: include: Receiving module: used to receive file operation requests; Forwarding module: used for asynchronously sending the file operation request to the message queue; Subscription module: used to obtain file operation notifications from the message queue, and merge all file operation notifications to obtain a list of files to be backed up; Backup module: used for backing up the list of files to be backed up.

10. A distributed file system modification backup system according to claim 9, characterized in that: The receiving module and the forwarding module are both established based on the file gateway node.