A distributed file system hot backup method based on Linux operating system
Patent Information
- Application Number
- CN202410939371.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-15
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2044-07-15
AI Technical Summary
[0003]但是,对于跨集群或跨数据中心的灾备场景,CephFS提供的CephFS-mirror机制通过快照机制进行备份数据的同步,基于快照的方式进行备份,系统的RPO(Recovery PointObjective)只能受限于快照创建的时间间隔,而不能实现操作级
[0038] The present invention increases the hot backup capability of the distributed file system through logging, and is mainly implemented in the Linux operating system kernel, effectively reducing the RPO of the disaster recovery system, improving the stability of the file system in the face of various faults, and improving the file system. The system's disaster recovery capability ensures data reliability and business continuity.
Smart Images

Figure CN118484345B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of cloud computing, and in particular to a distributed file system hot backup method based on a Linux operating system. Background Art
[0002] In a distributed file system, data can be distributed across multiple servers, disk arrays, and other storage devices, which enables the system to handle large amounts of data and high-concurrency requests while enhancing system reliability and performance. Ceph is a high-performance, highly reliable, and scalable distributed storage system that provides object, block, and file storage capabilities in a unified storage system. CephFS is the file system service it provides, which ensures data reliability and business continuity through data redundancy mechanisms such as multiple copies of data, erasure codes, data consistency protocols, and log mechanisms.
[0003] However, for disaster recovery scenarios across clusters or data centers, the CephFS-mirror mechanism provided by CephFS synchronizes backup data through a snapshot mechanism. Backup is performed based on snapshots, and the system's RPO (Recovery Point Objective) is limited to the time interval between snapshot creation, and cannot achieve the operational level. Summary of the invention
[0004] In view of the current cross-storage cluster or cross-data center disaster recovery scenario, the CephFS file system kernel client cannot achieve the operation-level RPO. The present invention provides a distributed file system hot backup method based on the Linux operating system, which can achieve the operation-level RPO, improve the stability of the file system in the face of various failures, enhance the disaster recovery capability of the file system, and ensure data reliability and business continuity.
[0005] The technical solution of the present invention is:
[0006] A distributed file system hot backup method based on the Linux operating system records the client's file system operation log on the client by configuring the backup cluster information, and updates the data to the main cluster file system and the backup cluster file system after the data is persisted. The update mode can be synchronous or asynchronous.
[0007] Furthermore,
[0008] Mainly includes backing up file system configuration, file system operation records, and file system operation backup execution;
[0009] The backup file system configuration refers to configuring hot backup rules and related environment configuration for a specified directory / file system when using a distributed file system hot backup;
[0010] File system operation logging records all client operations into a specified log;
[0011] File system operation backup execution refers to synchronizing the file system operations recorded in the log to the backup file system, which can be updated synchronously or asynchronously according to the backup rules.
[0012] Going further,
[0013] In the data synchronization update mode, when a request is received, the request is directly sent to the primary file system and the backup file system, and the storage cluster waits for the returned result after processing, and returns it to the client. The data of the primary and backup cluster file systems are strongly consistent, which can better ensure business continuity during data switching.
[0014] The asynchronous update mode records the operating system logs and flushes the data to the file system of the active and standby clusters in the background process. The log recording path can select a higher-performance storage medium or high-performance storage to avoid performance degradation caused by increasing file system backup.
[0015] The data update mode can customize the synchronization mode, and balance performance and reliability by selecting the synchronous update / asynchronous update mode and matching the user's RPO tolerance with the relevant configuration items.
[0016] Going further,
[0017] Logging can choose local storage media, storage pools, or other high-performance distributed file systems.
[0018] Logging configures the path of the logging file; using logs to record client operations to achieve persistence can prevent the loss of operation content due to abnormal client exit.
[0019] Furthermore,
[0020] You can add configuration properties when mounting the file system by setting properties or use the file system IOCTL interface to add corresponding configuration after mounting the file system.
[0021] The file system operation record identifies the user's file system operation. If it is a modification operation, the operation content is recorded in the log file; according to the log record, the recorded operation can be replayed.
[0022] If it is a query operation, there is no need to record logs and the request can be sent directly to the storage cluster for query according to the original process.
[0023] Going further,
[0024] When the file system operation backup is performed,
[0025] Synchronous updates do not rely on log records. After receiving a request, if it is a modification operation, it directly sends the request to the primary file system and the backup file system, and waits for the storage cluster to process the returned result and return it to the client; if it is a query operation, it forwards the request to the primary file system and waits for the request to return.
[0026] During asynchronous updates, the operations are first serialized and recorded in the log file, and the write position in the log position information is updated to identify the current latest log position. At this point, the operation has been persisted and a successful operation is returned to the client. When the background process meets the set flushing conditions, data is flushed. After the data is successfully written to the two file systems, the read position of the log information is updated to indicate that the logs before this position have completed the data flush and can be safely deleted.
[0027] If the file size exceeds the preset single log file size, a new log file is created; the log file size is configured by the configuration item; the log location information is persisted in a separate file and is persisted each time it is updated.
[0028] The log file naming format consists of two parts, connected by a hyphen (-). The first part is the client ID, and the second part is the file shard number, starting from 0000000. When the size of the previous file reaches the configured size and a new log file is created, the shard number increases by one.
[0029] The location record of the above-mentioned file includes write position, read position, and trim position; the write position identifies the latest position where the current log is written; the read position indicates that the content before the current position has been flushed, that is, the operation request has been completed in the primary file system and the backup file system; the trim position indicates the position to which the current log is trimmed.
[0030] The background process flushing operation conditions can be controlled through configuration items; by configuring the number of operations for a single flush and the interval between flushes, when the number of operations in the log exceeds the threshold or the last flush time exceeds the threshold, the operation data is updated to the backend storage cluster or updated by direct triggering.
[0031] Furthermore,
[0032] Add a scheduled task. The execution cycle is configured through the configuration item. The scheduled task is responsible for regularly trimming logs and trimming the operations that have been flushed to the backend primary file system and backup file system. In the scheduled task, the logs between the trimming position and the reading position are trimmed according to the stored log position information.
[0033] Going further,
[0034] When the client restarts, the replay operation is performed from the log first; starting from the log at the read position, the file system log is replayed one by one, and the request is sent to the primary cluster and the backup cluster; the replay ends when the log is replayed to the write position; normal request processing is then performed.
[0035] When the primary file system fails and cannot process file system requests, the backup cluster's file system will process file system requests from clients normally; write requests will be recorded through logs, and read requests will be redirected to the backup file system; after the file system is restored, the operations recorded in the logs will be replayed in the primary file system to achieve data consistency between the two file systems.
[0036] When a problem occurs in the backup file system, read requests are still processed by the primary file system, and write modification operations use the same operations as when the primary file system fails, using log records and flushing data when the cluster recovers.
[0037] The beneficial effects of the present invention are
[0038] The present invention increases the hot backup capability of the distributed file system by means of log recording, which is mainly implemented in the Linux operating system kernel, effectively reduces the RPO of the disaster recovery system, improves the stability of the file system in the face of various failures, enhances the disaster recovery capability of the file system, and ensures data reliability and business continuity.
[0039] Logging can select faster storage devices or other high-speed file systems to act as a cache layer for data access and improve data access speed.
[0040] The present invention can customize the file system synchronization mode, and achieve a balance between performance and reliability by selecting a synchronous update / asynchronous update mode to match the user's RPO tolerance. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 It is the overall working block diagram of the present invention;
[0042] Figure 2 It is a specific workflow schematic diagram of the present invention. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0044] The present invention provides a distributed file system hot backup method based on the Linux operating system, which is applied to the CephFS distributed file system and mainly includes backup file system configuration, file system operation record, and file system operation backup execution. The backup file system configuration refers to configuring hot backup rules and related environment configurations for a specified directory / file system when using the distributed file system hot backup; the file system operation record is to record all client operations in a specified log; the file system operation backup execution refers to synchronizing the file system operations recorded in the log to the backup file system, which can be updated synchronously or asynchronously according to the backup rules. In this application, the hot backup capability of the distributed file system is increased by log recording, which is mainly implemented in the Linux operating system kernel, thereby improving the stability of the file system in the face of various failures and enhancing the disaster recovery capability of the file system. In addition, log recording can select a faster storage device or other high-speed file system, thereby acting as a cache layer for data access and improving the data access speed.
[0045] The present invention can add a backup module in the Linux operating system. By configuring the backup cluster information, the client's file system operation log is recorded on the client, and after the data is persisted, the data is updated to the main cluster file system and the backup cluster file system. The update mode can be selected as synchronous or asynchronous update.
[0046] This application mainly includes: backing up file system configuration, file system operation records, and file system operation backup execution.
[0047] The backup file system configuration refers to configuring hot backup rules and related environment configurations for a specified directory / file system when using a distributed file system hot backup.
[0048] The environment configuration includes: the backup cluster file system connection address and port number, the file system name used in the backup cluster and the path used for backup data, and the user name and key used when connecting to the backup cluster. The subsequent file system will connect to the primary and backup clusters based on these environment configurations and perform operations in the corresponding paths.
[0049] Backup rules are divided into synchronous update and asynchronous update. Synchronous update means that after receiving the request, the primary file system and the backup file system are written and then the write success is returned to the client. It is suitable for scenarios with high requirements for data reliability. Asynchronous update means that the modification operation is first recorded in the log, and after persistence, the operation success can be returned to the client. The subsequent background process is asynchronously updated to the primary file system and the backup file system.
[0050] For logging, you can choose a higher-speed local storage medium (such as SSD, NVMe), a high-performance storage pool, or other high-performance distributed file systems. This can optimize IO performance and avoid performance degradation due to adding backup functions.
[0051] Logging requires configuring the path of the logging file. Using logs to record client operations for persistence can prevent the loss of operation content due to abnormal client exit.
[0052] Setting properties can add configuration properties when mounting the file system or use the file system IOCTL interface to add corresponding configuration after mounting the file system.
[0053] Asynchronous updates require file system operation recording, and client operations are recorded in the specified log. Identify user file system operations, and if they are modification operations, record the operation content in the log file. The log record includes the operation type, operation parameters, operation object, and operation content. Based on the log record, the recorded operation can be replayed.
[0054] If it is a query operation, there is no need to record logs and the request is sent directly to the storage cluster for query according to the original process. In this way, the requirement of data backup between the two clusters is met.
[0055] File system operation backup execution refers to synchronizing the file system operations recorded in the log to the backup file system, which can be updated synchronously or asynchronously according to the backup rules.
[0056] In the case of synchronous updates, there is no need to rely on log records. After receiving the request, if it is a modification operation, it will directly send the request to the primary file system and the backup file system, and wait for the storage cluster to process and return the result to the client. If it is a query operation, it will forward the request to the primary file system and wait for the request to return.
[0057] When configured for asynchronous update, the operation is first serialized and recorded in the log file, and the write position in the log position information is updated to mark the current latest log position. At this time, the operation has been persisted and the client can be returned a successful operation. When the background process meets certain flushing conditions, the data is flushed. After the data is successfully written to the two file systems, the read position of the log information is updated to mark that the logs before this position have completed the data flush and can be safely deleted.
[0058] If the file size exceeds the preset single log file size, a new log file is created. The log file size is configured by the configuration item and is 64 MiB by default. Log location information. Including log write location, read location, persisted in a separate file, and persisted every time it is updated.
[0059] The log file naming format consists of two parts, connected by a hyphen (-). The first part is the client ID, and the second part is the file shard number, starting from 0000000. When the size of the previous file reaches the configured size and a new log file is created, the shard number increases by one.
[0060] The above file position records include write position, read position, and trim position. The write position identifies the latest position where the current log is written, including the log shard number and the log offset within the shard. The read position indicates that the content before the current position has completed the operation flush, that is, the operation request has been completed in the primary file system and the backup file system. The read position also includes the log shard number and the log offset within the shard. The trim position indicates the position where the current log is trimmed, including the log shard number and the log offset within the shard.
[0061] The background process flushing operation conditions can be controlled through configuration items. By configuring the number of operations for a single flush and the interval time for the flush, the operation data is updated to the backend storage cluster when the number of operations in the log exceeds the threshold or the last flush time exceeds the threshold. In addition, the update can also be performed by direct triggering, in which case the above conditions do not need to be met.
[0062] Add a scheduled task. The execution cycle is configured through the configuration item. The scheduled task is responsible for regularly trimming logs and trimming the operations that have been flushed to the backend main file system and backup file system. Prevent the log memory from storing too much content. In the scheduled task, according to the stored log position information, the logs between the trimming position and the reading position are trimmed.
[0063] When the client restarts, it needs to replay the log first. Starting from the log at the read position, the file system log is replayed one by one, and the request is sent to the primary cluster and the backup cluster. The replay ends when the log is replayed to the write position. Normal request processing is then performed.
[0064] When the primary file system fails and cannot process file system requests, the backup cluster's file system will process file system requests from clients normally. Write requests are recorded in logs, and read requests are redirected to the backup file system. At this time, log data cannot be flushed to both file systems, so log pruning will not be performed. After the file system is restored, the operations recorded in the logs are replayed in the primary file system to achieve data consistency between the two file systems.
[0065] When a problem occurs in the backup file system, read requests are still processed by the primary file system, and write modification operations use the same operations as when the primary file system fails, using log records and flushing data when the cluster recovers.
[0066] The above description is only a preferred embodiment of the present invention, which is only used to illustrate the technical solution of the present invention, and is not used to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.
Claims
1. A distributed file system hot backup method based on Linux operating system, It is characterized in that By configuring the backup cluster information, the client's file system operation log is recorded on the client, and after the data is persisted, the data is updated to the primary cluster file system and the backup cluster file system; It includes three parts: file system configuration backup, file system operation record backup, and file system operation backup execution. in Backing up file system configuration means configuring hot backup rules and related environment configuration for the specified directory / file system when using distributed file system hot backup; File system operation logging records all client operations into a specified log; File system operation backup execution refers to synchronizing the file system operations recorded in the log to the backup file system, which can be updated synchronously or asynchronously according to the backup rules; The environment configuration includes: the backup cluster file system connection address and port number, the file system name used in the backup cluster and the path used for backup data, and the user name and key used when connecting to the backup cluster; the subsequent file system connects to the primary and backup clusters according to these environment configurations and performs operations under the corresponding paths; The synchronous update, when receiving a request, directly sends the request to the primary file system and the backup file system, and waits for the storage cluster to process the returned result and return it to the client; The asynchronous update records the operating system logs and flushes the data to the file system of the active and standby clusters in the background process; Logging can choose local storage media, storage pools or other high-performance distributed file systems; Logging configures the path of the logging file; using logs to record client operations to achieve persistence can prevent the loss of operation content due to abnormal client exit; Add configuration attributes when mounting the file system by setting properties or use the file system IOCTL interface to add corresponding configuration after mounting the file system; The file system operation record identifies the user's file system operation. If it is a modification operation, the operation content is recorded in the log file; according to the log record, the recorded operation can be replayed; If it is a query operation, there is no need to record logs and the request can be sent directly to the storage cluster for query according to the original process; When the file system operation backup is performed, Synchronous updates do not rely on log records. After receiving a request, if it is a modification operation, it directly sends the request to the primary file system and the backup file system, and waits for the storage cluster to process the returned result and return it to the client; if it is a query operation, it forwards the request to the primary file system and waits for the request to be returned; During asynchronous updates, the operation is first serialized and recorded in the log file, and the write position in the log position information is updated to mark the current latest log position. At this time, the operation has been persisted and a successful operation is returned to the client. When the background process meets the set flushing conditions, data is flushed. After the data is successfully written to the two file systems, the read position of the log information is updated to mark that the logs before this position have completed data flushing and can be safely deleted. If the file size exceeds the preset single log file size, a new log file is created; the log file size is configured by the configuration item; the log location information is persisted in a separate file and persisted each time it is updated; The log file naming format consists of two parts, connected by a hyphen (-). The first part is the client ID, and the second part is the file shard number, starting from 0000000. When the size of the previous file reaches the configured size and a new log file is created, the shard number increases by one. The above file location records include write location, read location, and trim location; the write location indicates the latest location where the current log is written; the read location indicates that the content before the current location has been flushed, that is, the operation request has been completed in the primary file system and the backup file system; the trim location indicates the location where the current log is trimmed; The background process flushing operation conditions can be controlled through configuration items; by configuring the number of operations for a single flush and the interval between flushes, when the number of operations in the log exceeds the threshold or the last flush time exceeds the threshold, the operation data is updated to the backend storage cluster or updated by direct triggering.
2. The method according to claim 1, It is characterized in that Add a scheduled task. The execution cycle is configured through the configuration item. The scheduled task is responsible for regularly trimming logs and trimming the operations that have been flushed to the backend primary file system and backup file system. In the scheduled task, the logs between the trimming position and the reading position are trimmed according to the stored log position information.
3. The method according to claim 1 or 2, It is characterized in that When the client restarts, it first replays the operation from the log. It starts from the log at the read position, replays the file system log one by one, and sends the request to the primary cluster and the backup cluster. The replay ends when the log is replayed to the write position, and then normal request processing is performed; When the primary file system fails and cannot process file system requests, the backup cluster's file system will process file system requests sent by the client normally; Write requests are recorded through the log, while read requests are redirected to the backup file system; After the file system is restored, the operations recorded in the log are replayed in the primary file system to achieve data consistency between the two file systems. When a problem occurs in the backup file system, read requests are still processed by the primary file system, and write modification operations use the same operations as when the primary file system fails, using log records and flushing data when the cluster recovers.
