A Backup Method and System for Linux System Text Files
Through the automated processing of configuration services and backup services, combined with storage services, the problem of complex and inefficient backup configuration of Linux system text file is solved, and unified backup content management and efficient automated backup are realized, which is suitable for multiple Linux devices in enterprises.
Patent Information
- Application Number
- CN202310291391.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-23
- Publication Date
- 2025-07-22
- Estimated Expiration
- 2043-03-23
AI Technical Summary
In Linux systems, text file backup configuration is complex and inefficient, making it difficult to meet the backup needs of enterprises for a large number of online servers.
The configuration service is used to configure the backup target and parameters, and the backup service is used to automatically process it, and the storage service is used to achieve unified backup content management, including the relationship between global and custom groupings, perform backup operations regularly, and provide text file retrieval and query functions.
It realizes a unified backup content configuration center, simplifies the backup configuration process, supports automated timed batch backups, reduces management complexity, and improves backup efficiency, which is suitable for enterprises' backup needs for a large number of servers.
Smart Images

Figure CN116302705B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of data backup, and particularly relates to a method and system for backing up text files in a Linux system. Background Art
[0002] Data backup is the basis for disaster tolerance in computer applications. It refers to copying all or part of the data content from the application host to other computers for storage in case of system failures caused by various factors or data loss due to human operation errors, so as to be used for querying and restoring the required content when needed. It is one of the important preventive measures against computer system failures.
[0003] In the existing Linux system, when backing up text files on the Linux system, there are problems of complex backup configuration and low backup efficiency. Summary of the Invention
[0004] In view of the defects existing in the prior art, the present invention provides a method and system for backing up text files in a Linux system, which can effectively solve the above problems.
[0005] The technical solution adopted by the present invention is as follows:
[0006] The present invention provides a method for backing up text files in a Linux system, which is applied to a system including a configuration service, a backup service, a backup target, and a storage service. The method for backing up text files in the Linux system includes the following steps:
[0007] Step 1, configuring the backup target and backup parameters through the configuration service; wherein, the backup target is described by the association relationship of a Linux host address, a text file path, and a configuration group; the configuration group includes two types, namely: a global group and a custom group; the global group automatically associates all Linux host addresses and any specified text file paths; the custom group is used to customarily associate any specified Linux host addresses and any specified text file paths; the Linux host address and the text file path with an association relationship form a complete backup object unit; the backup parameters include a backup timing time.
[0008] Step 2, whenever the backup timing time is reached, the configuration service automatically starts the backup service; the backup service reads the backup target configured by the configuration service, and automatically aggregates the association relationship description of the Linux host address, the text file path, and the configuration group into a backup list including a plurality of the complete backup object units.
[0009] Then, the backup service sequentially performs backup operations on each of the complete backup object units in the backup list. The specific method is as follows: for each complete backup object unit, connect to the Linux host corresponding to the corresponding Linux host address. In the Linux host, find the corresponding text file according to the corresponding text file path, and then back up the found text file to the storage service;
[0010] Step 3, the storage service saves the text files backed up by the backup service and provides functions for text file retrieval and viewing.
[0011] Preferably, in the description of the association relationship between the Linux host address, text file path, and configuration group, one Linux host address is associated with any number of text file paths; one Linux host address belongs to any number of global groups and / or custom groups;
[0012] One text file path is associated with any number of Linux host addresses; one text file path belongs to any number of global groups and / or custom groups;
[0013] One global group is associated with any number of Linux host addresses; one custom group is associated with any number of Linux host addresses;
[0014] One global group is associated with any number of text file paths; one custom group is associated with any number of text file paths.
[0015] The present invention also provides a backup system for Linux system text files, including a configuration service component, a backup operation execution component, a local cache file directory, a backup component, a backup task component, and a backup save component;
[0016] The configuration service component is used to configure backup targets and backup parameters; among them, the backup target is described by the association relationship between the Linux host address, text file path, and configuration group; the configuration group includes two categories, namely: global group and custom group; the global group automatically associates all Linux host addresses and any specified text file paths; the custom group is used to customarily associate any specified Linux host addresses and any specified text file paths; the Linux host address and text file path with an association relationship form a complete backup object unit; the backup parameters include the backup timing time;
[0017] The configuration service component is also used to automatically control the startup and operation of the backup operation execution component when the backup timing time is reached;
[0018] The backup task component is installed on each Linux host and serves as the proxy program of the Linux host;
[0019] The backup operation execution component is used to execute the backup operation after being started by the configuration service component. Specifically, after the backup operation execution component is started, it establishes a connection with the backup task component of the corresponding Linux host and sends a text file backup operation instruction to the backup task component of the corresponding Linux host. Among them, the operation instruction carries the path of the text file to be backed up. After receiving the operation instruction, the backup task component locates the text file according to the path of the text file to be backed up and saves the text file to the local cache file directory of the host where the backup operation execution component is located. The naming format of the text file saved in the local cache file directory is: Linux host address / text file path / text file name;
[0020] The backup component is used to execute the storage task regularly, including: archiving, marking time and version of the text files saved in the local cache file directory, and finally uploading them to the backup storage component for storage;
[0021] The backup storage component is used to centrally store the text files uploaded by the backup component, manage the text files uploaded at each time point, and provide query function and visualization display function for the text files.
[0022] A method and system for backing up text files in a Linux system provided by the present invention have the following advantages:
[0023] (1) It has a unified backup content configuration center, which can conveniently and flexibly change the backup configuration and is convenient for management. And for newly added Linux hosts, it has default backup settings, which simplifies the configuration process.
[0024] (2) It has an automated processing function for backing up regularly, in batches and efficiently. And it can flexibly implement the combined deployment of backup schemes, and the implementation difficulty of the schemes is low, which better meets the backup requirements of enterprises for a large number of online servers.
[0025] (3) It is convenient to directly query and obtain the content of the backup files, which is convenient for management personnel to use and greatly reduces the process and operation of restoring files. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 is a schematic flow chart of a method for backing up text files in a Linux system provided by the present invention;
[0027] Figure 2 is an architecture flow chart of a system for backing up text files in a Linux system provided by the present invention;
[0028] Figure 3 It is a configuration content association relationship diagram of the configuration service provided by the present invention. Detailed implementation manners
[0029] In order to make the objectives, technical solutions and advantages of the present invention more clear and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0030] The present invention provides a method and system for backing up text files in a Linux system, which can perform regular automatic batch backup of text files in the Linux system. Especially in the case of multiple Linux devices, it can flexibly and efficiently perform regular automatic batch backup of text files in multiple Linux devices, thus facilitating server administrators to retrieve and restore backup files.
[0031] Reference Figure 1 , the present invention provides a method for backing up text files in a Linux system, which is applied to a system including a configuration service, a backup service, a backup target and a storage service. The method for backing up text files in the Linux system includes the following steps:
[0032] Step 1, configure the backup target and backup parameters through the configuration service; wherein, the backup target is described by the association relationship of a Linux host address, a text file path and a configuration group; the configuration group includes two categories, namely: a global group and a custom group; the global group automatically associates all Linux host addresses and any specified text file paths; the custom group is used to customarily associate any specified Linux host addresses and any specified text file paths; the Linux host address and text file path with an association relationship form a complete backup object unit; the backup parameters include the backup timing time.
[0033] Specifically, in combination with Figure 3 , in the description of the association relationship of the Linux host address, the text file path and the configuration group, one Linux host address is associated with any number of text file paths; one Linux host address belongs to any number of global groups and / or custom groups;
[0034] One text file path is associated with any number of Linux host addresses; one text file path belongs to any number of global groups and / or custom groups;
[0035] A global group, associated with any number of Linux host addresses; a custom group, associated with any number of Linux host addresses;
[0036] A global group, associated with any number of text file paths; a custom group, associated with any number of text file paths.
[0037] Step 2, whenever the backup timing time is reached, the configuration service automatically starts the backup service; the backup service reads the backup target configured by the configuration service, and automatically aggregates the association relationships of the Linux host addresses, text file paths, and configuration groups into a backup list including multiple complete backup object units;
[0038] Then, the backup service sequentially performs backup operations on each complete backup object unit in the backup list. The specific method is as follows: for each complete backup object unit, connect to the Linux host corresponding to the corresponding Linux host address. In the Linux host, find the corresponding text file according to the corresponding text file path, and then back up the found text file to the storage service;
[0039] Step 3, the storage service saves the text files backed up by the backup service and provides functions for text file retrieval and viewing.
[0040] The present invention also provides a backup system for text files in a Linux system, including a configuration service component, a backup operation execution component, a local cache file directory, a backup component, a backup task component, and a backup save component; each component can specifically adopt the following components: a fireserver configuration service component, a salt-master backup operation execution component, a salt-local-cache-files local cache file directory, a firebackup backup component, a salt-minon backup task component, a gitlab-store backup save component;
[0041] The configuration service component is used to configure backup targets and backup parameters; wherein, the backup target is described by the association relationship of Linux host addresses, text file paths, and configuration groups; the configuration groups include two types, namely: a global group and a custom group; the global group automatically associates all Linux host addresses and any specified text file paths; the custom group is used to customarily associate any specified Linux host addresses and any specified text file paths; the Linux host addresses and text file paths with an association relationship form a complete backup object unit; the backup parameters include the backup timing time;
[0042] The configuration service component is further configured to automatically control the startup and operation of the backup operation execution component when the backup timing time is reached;
[0043] The backup task component is installed on each Linux host and acts as an agent program for the Linux host;
[0044] The backup operation execution component is used to perform backup operations after being started by the configuration service component. Specifically, after the backup operation execution component is started, it establishes a connection with the backup task component of the corresponding Linux host and sends a text file backup operation instruction to the backup task component of the corresponding Linux host. Among them, the operation instruction carries the path of the text file to be backed up. After receiving the operation instruction, the backup task component locates the text file according to the path of the text file to be backed up and saves the text file to the local cache file directory of the host where the backup operation execution component is located. The naming format of the text file saved in the local cache file directory is: Linux host address / text file path / text file name;
[0045] The backup component is used to perform storage tasks regularly, including: archiving, marking time and version of the text files saved in the local cache file directory, and finally uploading them to the backup storage component for storage;
[0046] The backup storage component is used to centrally store the text files uploaded by the backup component, manage the text files uploaded at each time point, and provide query functions and visualization display functions for the text files.
[0047] The following introduces a specific embodiment:
[0048] As Figure 1 shown, the present invention provides a method for backing up text files in a Linux system, including a configuration service, a backup service, a backup target, and a storage service.
[0049] The configuration service is mainly used for an administrator to configure backup targets that need to be backed up, as well as a program that can manage and control the backup service. Among them, configuring backup targets that need to be backed up includes a configuration list of Linux host addresses that need to be backed up and text file paths of the Linux system. The program that can manage and control the backup service mainly includes managing the timing setting and running status of the backup service.
[0050] The backup service is mainly used to perform specific backup operations on the backup target. Specifically, according to the settings of the configuration service, it connects to the corresponding target Linux host to perform backup operations on the text files of the corresponding text file path, and finally saves them to the storage service.
[0051] Backup target mainly refers to the backup object to be backed up and the backup target extension function. Among them, the backup object is the backup target required by the configuration service to be backed up, including multiple backup object units. A backup object unit refers to a Linux host address and a text file path of a Linux system. Optionally, the backup target extension function means that if required by the backup program, there should be a corresponding client program at the backup target for the backup service to perform backup operations and communication functions.
[0052] The storage service is mainly used to save the text files backed up from the Linux system and provide the ability to retrieve and view them.
[0053] The specific process is as follows:
[0054] (1) The administrator configures the backup target containing the Linux host address and text file path that needs to be backed up through the configuration service, and can set the backup execution time and start running on the program.
[0055] (2) After that, the backup service starts and runs specific backup operations regularly according to the configuration and settings of the configuration service. Specifically: save the backup target and transfer it to the storage service for saving. Then the administrator can query and use the backup content in the storage service.
[0056] For the above method, due to the associated interaction characteristics between various services, in the design of the solution implementation, various services can be flexibly combined with programs and deployment methods and applied to the implementation solution.
[0057] Among them, for the configuration content of the configuration service, the Figure 3 associated relationship configuration method shown is adopted. The file configuration contains the associated relationship of Linux host address - text file path - configuration group. Its implementation relationship is:
[0058] With the configuration group as the core, the configuration group contains a global group and multiple custom groups.
[0059] First, the global group must be automatically associated with all Linux host addresses, and the custom group is configured by the administrator to associate the Linux host addresses. A configuration group can be associated with multiple text file paths, thus naturally forming a complete relationship chain of Linux host address - configuration group - text file path.
[0060] Second, the text file path supports the format of path + wildcard to match multiple text files to meet the needs of more configuration scenarios.
[0061] Finally, when backing up the execution list, fireserver will automatically aggregate all the association relationships of this configuration into a target content configuration table formed by Linux host address - text file path for the content to be backed up, which is used to perform the backup operation.
[0062] According to the above backup method, the present invention provides a backup system for Linux system text files, and its implementation includes the following components: fireserver, salt-master, salt-local-cache-files, firebackup, salt-minon, gitlab-store. The functions of each component are as follows:
[0063] The fireserver component provides the following functions:
[0064] 1. Provide configuration services for backing up Linux system files, including configuring the association relationships of Linux host address - text file path - configuration group. The association relationships are described as follows.
[0065] Multiple text file paths can be set for one Linux host address;
[0066] One Linux host address can belong to multiple configuration groups;
[0067] One text file path can exist in multiple Linux host addresses;
[0068] One text file path can belong to multiple configuration groups;
[0069] Multiple Linux host addresses can be set for one configuration group;
[0070] Multiple text file paths can be set for one configuration group.
[0071] Among them, the text file path supports the format of path + wildcard to match multiple text files, so as to implement the fuzzy matching rule based on directory files to meet the requirements of a wide range of file backup scenarios; the configuration groups are divided into global groups and custom groups. The global group can only configure text file paths to automatically apply to the backup operations of all Linux host addresses, and the custom group can be flexibly configured by the administrator for the Linux host addresses and text file paths to be backed up. The main function of the configuration group is to facilitate the administrator to manage the backup configuration.
[0072] Finally, when backing up the execution list, fireserver will automatically aggregate according to all the configuration relationships into a target content configuration table formed by Linux host address - text file path for the content to be backed up, which is used to perform the backup operation.
[0073] 2. Provide the function of starting the salt-master component at a scheduled time and performing backup operations. This includes controlling the execution of the salt-master component.
[0074] The salt-master component is used to perform backup operations on each Linux system text file. By controlling the salt-minion component of each Linux host, the target content is saved to the salt-local-cache-files directory. The naming format of the text files saved in the salt-local-cache-files directory is: Linux host address / Linux backup path / text file name.
[0075] The salt-minon component, as a Linux host proxy program, is deployed in each Linux host and is used to execute the instructions sent by the salt-master and transmit the target content to the salt-master for backup.
[0076] The firebackup component is used to perform storage tasks at a scheduled time, archive the files in the salt-local-cache-files directory, mark the time and version, and finally upload them to gitlab-store for storage.
[0077] The gitlab-store component mainly has the following functions:
[0078] 1. Centralize the storage of the content of the text file paths of the Linux systems saved by the backup operations to achieve the backup effect.
[0079] 2. Manage the time and version of the content of the text file paths of the Linux systems uploaded at each time point.
[0080] 3. Directly provide the function of querying and reading the content of these text file backups, and there is a page visualization for administrators to use.
[0081] The processing flow of the above components and the backup system is as follows:
[0082] (1) Managers configure the backup targets that need to be backed up, including the Linux host address and text file path, through firebackup to form a backup list, and set the scheduled execution time and start running.
[0083] (2) After that, the fireserver performs backup operations on its own according to the configuration settings. The specific process is:
[0084] Control the salt-master to execute each specific backup process. The salt-master performs backup operations by connecting to the salt-minion of the corresponding Linux host and saves the target files to the local salt-local-cache-files directory. This process processes the text file formed by all configured Linux host addresses and text file paths that need to be backed up.
[0085] (3) After the backup operation is completed, firebackup schedules tasks to archive, mark the time and version of the files in the salt-local-cache-files directory, integrate the directory and files, and finally upload them to gitlab-store for storage after processing.
[0086] (4) Finally, the administrator can directly view and use the backup files on gitlab-store. A method and system for backing up text files in a Linux system provided by the present invention have the following advantages:
[0087] (1) It has a unified backup content configuration center, which can conveniently and flexibly change the backup configuration and is convenient for management. And for newly added Linux hosts, it has default backup settings, which simplifies the configuration process.
[0088] (2) It has an automated processing function for performing backups regularly and in batches efficiently, and can flexibly implement the combined deployment of backup schemes, and the implementation difficulty of the scheme is low, which better meets the backup needs of enterprises for a large number of online servers.
[0089] (3) It is convenient to directly query and obtain the content of the backup files, which is convenient for the administrator to use and greatly reduces the process and operation of restoring files.
[0090] The above are only the preferred embodiments of the present invention. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present invention, several improvements and refinements can still be made, and these improvements and refinements should also be regarded as the protection scope of the present invention.
Claims
1. A backup method for Linux system text files, characterized in that, Applied to a system including a configuration service, a backup service, a backup target, and a storage service, the method for backing up the Linux system text file includes the following steps: Step 1, configure the backup target and backup parameters through the configuration service; wherein, the backup target is described by the association relationship of the Linux host address, the text file path, and the configuration group; the configuration group includes two categories, namely: the global group and the custom group; the global group automatically associates all Linux host addresses and any specified text file paths; the custom group is used to custom-associate any specified Linux host address and any specified text file path; the Linux host address and the text file path with an association relationship form a complete backup object unit; the backup parameters include the backup timing time. Step 2, whenever the backup timing time is reached, the configuration service automatically starts the backup service; the backup service reads the backup target configured by the configuration service, and automatically aggregates the association relationship description of the Linux host address, the text file path, and the configuration group into a backup list including multiple complete backup object units. Then, the backup service sequentially performs backup operations on each complete backup object unit in the backup list. The specific method is: for each complete backup object unit, connect to the Linux host corresponding to the corresponding Linux host address, in the Linux host, find the corresponding text file according to the corresponding text file path, and then back up the found text file to the storage service. Step 3, the storage service saves the text file backed up by the backup service and provides functions for text file retrieval and viewing.
2. The backup method of a Linux system text file according to claim 1, characterized in that, In the association relationship description of the Linux host address, the text file path, and the configuration group, one Linux host address is associated with any number of text file paths; one Linux host address belongs to any number of global groups and / or custom groups; One text file path is associated with any number of Linux host addresses; one text file path belongs to any number of global groups and / or custom groups; One global group is associated with any number of Linux host addresses; one custom group is associated with any number of Linux host addresses; One global group is associated with any number of text file paths; one custom group is associated with any number of text file paths.
3. A backup system for Linux system text files, characterized in that, Including a configuration service component, a backup operation execution component, a local cache file directory, a backup component, a backup task component, and a backup save component; The configuration service component is used to configure backup targets and backup parameters; among them, the backup target is described by the association relationship of the Linux host address, the text file path, and the configuration group; the configuration group includes two categories, namely: the global group and the custom group; the global group automatically associates all Linux host addresses and any specified text file path; the custom group is used to customly associate any specified Linux host address and any specified text file path; the Linux host address and the text file path with an association relationship form a complete backup object unit; the backup parameters include the backup timing time. The configuration service component is also used to automatically control the startup and operation of the backup operation execution component when the backup timing time is reached. The backup task component is installed on each Linux host and acts as an agent program for the Linux host. The backup operation execution component is used to execute backup operations after being started by the configuration service component. Specifically, after the backup operation execution component is started, it establishes a connection with the backup task component of the corresponding Linux host and sends a text file backup operation instruction to the backup task component of the corresponding Linux host; among them, the operation instruction carries the text file path to be backed up; after receiving the operation instruction, the backup task component locates the text file according to the text file path to be backed up and saves the text file to the local cache file directory of the host where the backup operation execution component is located. The naming form of the text file saved in the local cache file directory is: Linux host address / text file path / text file name. The backup component is used to periodically execute storage tasks, including: archiving, marking time and version of the text files saved in the local cache file directory, and finally uploading them to the backup storage component for storage. The backup storage component is used to centrally store the text files uploaded by the backup component, manage the text files uploaded at each time point, and provide query functions and visualization display functions for the text files.
Citation Information
Patent Citations
Linux-based data processing method, device and system
CN106557384A
Client based backups and backup indexing
US9659021B1