Disaster recovery backup method, device, equipment and storage medium
By determining the directories that need to be backed up in the primary cluster, regularly creating snapshots and asynchronously replicating them to the secondary cluster, the problem of data loss caused by file storage system failures is solved, data stability is improved, and the latest and historical data can be obtained in the event of a failure.
Patent Information
- Application Number
- CN202110875863.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-30
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2041-07-30
AI Technical Summary
In the existing technology, file storage system failures lead to data loss, data stability is poor, and disaster recovery and backup cannot be effectively realized.
By determining the directory that needs disaster recovery backup in the primary cluster, regularly creating snapshots, and asynchronously copying them to the corresponding designated files in the secondary cluster by overwriting the stored data, ensuring that the latest and historical snapshot data can be obtained when the primary cluster fails. .
Improves the stability of data, ensuring that the required snapshot data can be used normally when the main cluster fails, avoiding data loss.
Smart Images

Figure CN113672436B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data storage, and more specifically to a disaster recovery backup method, device, equipment and storage medium. Background Art
[0002] With the development of Internet technology and digital technology, data has become the core of operations of enterprises and institutions (such as banks, financial companies, etc.). In existing technologies, corresponding data is usually stored in a file system cluster. However, if the file storage system fails, the corresponding data will be lost, which will lead to poor data stability. Summary of the invention
[0003] The purpose of the present invention is to provide a disaster recovery backup method, device, equipment and storage medium, which can greatly improve data stability.
[0004] In order to achieve the above object, the present invention provides the following technical solutions:
[0005] A disaster recovery backup method, comprising:
[0006] Make sure that the directories that need to be backed up for disaster recovery in the primary cluster are all specified directories;
[0007] Creating snapshots in the designated directory at regular intervals to obtain snapshots to be backed up, and asynchronously copying the snapshots to be backed up to corresponding designated files in the slave cluster in a manner of overwriting stored data; wherein the designated files contained in a single slave cluster correspond one-to-one to the designated directories;
[0008] A snapshot is created under a designated file storing the snapshot to be backed up to obtain a backup snapshot for use when a failure occurs in the primary cluster.
[0009] Preferably, determining that the directories that need to be backed up for disaster recovery under the primary cluster are all designated directories includes:
[0010] Determine that all directories in the directory list under the main cluster are designated directories;
[0011] Correspondingly, the disaster recovery backup method further includes:
[0012] If there is a new directory that needs to be backed up for disaster recovery under the primary cluster, add the new directory to the directory list;
[0013] If there is a directory that does not need to be backed up for disaster recovery under the directory list, the directory that does not need to be backed up for disaster recovery is deleted from the directory list.
[0014] Preferably, determining a slave cluster that needs to store the snapshot to be backed up includes:
[0015] Determine that the slave cluster information stored under the master cluster corresponds to a slave cluster, which is the slave cluster that needs to store the snapshot to be backed up;
[0016] Correspondingly, the disaster recovery backup method further includes:
[0017] If there is a new slave cluster that needs to store the snapshot to be backed up, the slave cluster information of the new slave cluster is added to the master cluster;
[0018] If the slave cluster corresponding to the slave cluster that does not need to store the snapshot to be backed up exists under the master cluster, the slave cluster corresponding to the slave cluster that does not need to store the snapshot to be backed up is deleted from the master cluster.
[0019] Preferably, after adding the slave cluster information of the new slave cluster to the master cluster, the method further includes:
[0020] Connecting to the new slave cluster, performing a mount operation on the new slave cluster, and creating a data synchronization thread in the master cluster corresponding to the new slave cluster for implementing asynchronous replication of backup snapshots;
[0021] After deleting the slave cluster information corresponding to the slave cluster that does not need to store the snapshot to be backed up from the master cluster, the method further includes:
[0022] The data synchronization thread corresponding to the slave cluster that does not need to store the snapshot to be backed up is recovered, and a umount operation is performed on the slave cluster that does not need to store the snapshot to be backed up.
[0023] Preferably, it also includes:
[0024] If the disaster recovery backup function of the primary cluster is turned on, the step of determining that the directories under the primary cluster that need to be backed up for disaster recovery are all designated directories is executed; if the disaster recovery backup function of the primary cluster is turned off, it is determined that no disaster recovery backup is required for any directory under the primary cluster.
[0025] Preferably, enabling the disaster recovery backup function of the primary cluster includes:
[0026] Connect to the main cluster and perform a mount operation on the main cluster;
[0027] Disable the disaster recovery function of the primary cluster, including:
[0028] All data synchronization threads in the master cluster are recovered, a umount operation is performed on the slave clusters corresponding to all the slave cluster information under the master cluster, and all the slave cluster information under the master cluster is deleted.
[0029] Preferably, it also includes:
[0030] Periodically querying a local snapshot set in the master cluster for storing the snapshots to be backed up, and a remote snapshot set in the slave cluster that needs to store the snapshots to be backed up;
[0031] If the snapshot ID of any snapshot to be backed up does not exist in the local snapshot set but exists in the remote snapshot set, then the snapshot to be backed up is deleted from the remote snapshot set;
[0032] If the snapshot ID of any snapshot to be backed up exists in both the local snapshot set and the remote snapshot set but the snapshot names are different, the snapshot name of any snapshot to be backed up in the remote snapshot set is modified to be consistent with the corresponding snapshot name in the local snapshot set;
[0033] If the snapshot ID of any snapshot to be backed up exists in the local snapshot set but does not exist in the remote snapshot set, the snapshot to be backed up is copied to the remote snapshot set.
[0034] A disaster recovery backup device, comprising:
[0035] A determination module is used to: determine that the directory that needs to be backed up for disaster recovery under the main cluster is a designated directory;
[0036] The replication module is used to: regularly create snapshots in the specified directory to obtain snapshots to be backed up, and asynchronously copy the snapshots to be backed up to corresponding specified files in the slave cluster in a manner of overwriting stored data; wherein the specified files contained in a single slave cluster correspond to the specified directories one by one;
[0037] The snapshot module is used to create a snapshot under a designated file storing the snapshot to be backed up to obtain a backup snapshot for use when a failure occurs in the primary cluster.
[0038] A disaster recovery backup device, comprising:
[0039] Memory for storing computer programs;
[0040] A processor is used to implement the steps of the disaster recovery backup method as described in any one of the above items when executing the computer program.
[0041] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of any one of the above disaster recovery backup methods are implemented.
[0042] The present invention provides a disaster recovery backup method, device, equipment and storage medium, the method comprising: determining that the directory that needs to be backed up for disaster recovery under the main cluster is a designated directory; regularly creating snapshots under the designated directory to obtain snapshots to be backed up, and asynchronously copying the snapshots to be backed up to the corresponding designated files of the slave cluster in a manner of overwriting the stored data; creating snapshots under the designated files storing the snapshots to be backed up to obtain re-backup snapshots for use when the main cluster fails; wherein the designated files contained in a single slave cluster correspond one-to-one to the designated directories. For the directory that needs to be backed up for disaster recovery under the main cluster, the application regularly creates snapshots under the directory, and stores the created snapshots in the files corresponding to the directory in the slave cluster in a manner of overwriting the existing data, and creates snapshots under the files corresponding to the directory, so that when the main cluster fails, not only can the latest snapshot data of the corresponding directory be obtained through the above files, but also snapshot data at other times in the history of the corresponding directory can be obtained through the snapshots created under the above files, and then the required snapshot data can be used normally, thereby greatly improving data stability. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0044] Figure 1 A flowchart of a disaster recovery backup method provided by an embodiment of the present invention;
[0045] Figure 2 A schematic diagram of the structure of a disaster recovery backup device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0046] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0047] See also Figure 1 , which shows a flow chart of a disaster recovery backup method provided by an embodiment of the present invention, which may specifically include:
[0048] S11: Determine that the directory that needs to be backed up for disaster recovery in the primary cluster is a designated directory.
[0049] The execution subject of the disaster recovery backup method provided in the embodiment of the present invention can be a corresponding disaster recovery backup device, and the disaster recovery backup device can be set under the master cluster, so the execution subject of the disaster recovery backup method can be the master cluster, and the following is specifically described with the execution subject of the disaster recovery backup method being the master cluster. In addition, the master cluster and the slave cluster in the embodiment of the present application can both be file system clusters, and of course other settings performed according to actual needs are also within the protection scope of the present invention.
[0050] The main cluster may contain multiple directories, and the data in these directories may be relatively important and require disaster recovery backup, or may not be important and do not require disaster recovery backup; accordingly, in the embodiment of the present application, the directory that needs to be backed up for disaster recovery can be determined as a specified directory, and the number of specified directories can be one or more, and then only the data and metadata under the specified directory are backed up for disaster recovery, thereby ensuring that the data that is backed up for disaster recovery is relatively important data, avoiding useless implementation of disaster recovery backup.
[0051] S12: creating snapshots in a designated directory at regular intervals to obtain snapshots to be backed up, and asynchronously copying the snapshots to be backed up to corresponding designated files in the slave cluster in a manner of overwriting stored data; wherein, any designated file contained in any slave cluster corresponds one-to-one to the designated directory.
[0052] Create corresponding snapshots regularly, that is, create corresponding snapshots at time intervals set according to actual needs; in the embodiment of the present application, for each designated directory that needs to implement disaster recovery backup, a snapshot operation can be performed on the data and metadata under each designated directory to obtain a corresponding snapshot to be backed up, and a single snapshot to be backed up is obtained by performing a snapshot operation on the data and metadata under a single designated directory; then the snapshot to be backed up is asynchronously copied to a designated file in the slave cluster used to implement disaster recovery backup. Specifically, there may be multiple slave clusters corresponding to the main cluster. In the embodiment of the present application, only one or more slave clusters can be selected to implement disaster recovery backup, and each slave cluster used to implement disaster recovery backup has pre-created a specified file corresponding to each specified directory, that is, for a single slave cluster, the specified files contained in the single slave cluster are one-to-one corresponding to the specified directory, and then when the snapshot to be backed up is stored in any single slave cluster, the snapshot to be backed up can be stored in the specified file corresponding to the specified directory to which the snapshot to be backed up belongs in the any single slave cluster, and each time the snapshot to be backed up is stored in the corresponding specified file, if data already exists in the corresponding specified file, the snapshot to be backed up will overwrite the data already existing in the corresponding specified file, that is, only the latest snapshot created under the corresponding specified directory is saved in the specified file.
[0053] S13: Create a snapshot under the specified file storing the snapshot to be backed up to obtain a re-backup snapshot for use when the primary cluster fails.
[0054] In order to be able to query any snapshot, after the embodiment of the present application copies the snapshot to be backed up to the corresponding specified file, it will also perform a snapshot operation on all the data in the corresponding specified file to obtain a snapshot of the corresponding specified file at the current moment, and then when needed, not only can the latest snapshot data be obtained from the specified file, but also snapshot data at other times in history can be obtained through the snapshot of the specified file for use when a failure occurs in the main cluster.
[0055] The present invention provides a disaster recovery backup method, device, equipment and storage medium. The method comprises: determining that the directory to be backed up for disaster recovery under the main cluster is a designated directory; regularly creating snapshots under the designated directory to obtain the snapshots to be backed up, and asynchronously copying the snapshots to be backed up to the corresponding designated files of the slave cluster in a manner of overwriting the stored data; creating snapshots under the designated files storing the snapshots to be backed up to obtain the re-backup snapshots for use when the main cluster fails; wherein the designated files contained in a single slave cluster correspond one-to-one to the designated directories.
[0056] For the directory that needs disaster recovery backup under the main cluster, this application creates snapshots under the directory at regular intervals, and stores the created snapshots in the file corresponding to the directory in the slave cluster in a way of overwriting the existing data, and creates snapshots under the file corresponding to the directory. Therefore, when the main cluster fails, not only can the latest snapshot data of the corresponding directory be obtained through the above files, but also the snapshot data of other moments in the history of the corresponding directory can be obtained through the snapshots created under the above files, and then the required snapshot data can be used normally, thereby greatly improving data stability.
[0057] It should be noted that the main cluster in the embodiment of the present application can be provided with a mirror process, a mon module and an mgr module; the mirror process is responsible for implementing the disaster recovery backup method, and the mon module and the mgr module are responsible for respectively implementing snapshot-related functions and directory management-related functions under the call of the mirror process. The specific implementation method is described in detail in the following embodiments.
[0058] A disaster recovery backup method provided by an embodiment of the present invention determines that a directory to be backed up for disaster recovery in a primary cluster is a designated directory, which may include:
[0059] Make sure that all directories in the directory list under the main cluster are specified directories;
[0060] Accordingly, the disaster recovery backup method may also include:
[0061] If there is a new directory that needs to be backed up for disaster recovery in the primary cluster, add the new directory to the directory list;
[0062] If there is a directory that does not need to be backed up for disaster recovery under the directory list, the directory that does not need to be backed up for disaster recovery is deleted from the directory list.
[0063] In order to facilitate the management of directories under the main cluster, the embodiment of the present application can maintain a corresponding directory list under the main cluster, and then add all directories that need disaster recovery backup to the directory list; accordingly, if a new directory is added later and disaster recovery backup is required, the new directory is added to the directory list, and if any directory in the later directory list no longer needs disaster recovery backup, the arbitrary directory is deleted from the directory list. In view of the situation of using the mirror process, mon module and mgr module in the main cluster to implement disaster recovery backup, the mirror process can parse the directory management message sent by the mgr module to obtain the operation mode (acquire path addition operation, release path deletion operation) and path corresponding to the directory management message. When the operation mode is acquire path addition operation, the directory corresponding to the corresponding path is added to the directory list, and when the operation mode is release path deletion operation, the directory corresponding to the corresponding path is deleted from the directory list; of course, other settings made according to actual needs are also within the protection scope of the present invention.
[0064] An embodiment of the present invention provides a disaster recovery backup method, which determines a slave cluster that needs to store a snapshot to be backed up, and may include:
[0065] Determine that the slave cluster information stored under the master cluster corresponds to the slave cluster that needs to store the snapshot to be backed up;
[0066] Accordingly, the disaster recovery backup method may also include:
[0067] If there is a new slave cluster that needs to store the snapshot to be backed up, add the slave cluster information of the new slave cluster to the master cluster;
[0068] If there is slave cluster information corresponding to a slave cluster that does not need to store the snapshot to be backed up under the master cluster, the slave cluster information corresponding to the slave cluster that does not need to store the snapshot to be backed up is deleted from the master cluster.
[0069] In order to facilitate the management of the slave clusters corresponding to the main cluster, the present application can maintain the slave cluster information (such as the slave cluster identifier) used to implement disaster recovery backup in the main cluster. The slave cluster and the slave cluster information are one-to-one corresponding. Then, when disaster recovery backup is required, the slave cluster information corresponding to the slave cluster that needs disaster recovery backup is added to the main cluster. When the slave cluster corresponding to any slave cluster information in the main cluster no longer needs to implement disaster recovery backup, the arbitrary slave cluster information is deleted from the main cluster; wherein, the slave cluster information in the main cluster can also be maintained by using the information list; of course, other settings performed according to actual needs are also within the protection scope of the present invention.
[0070] A disaster recovery backup method provided by an embodiment of the present invention may further include:
[0071] Connect to the new slave cluster, perform a mount operation on the new slave cluster, and create a data synchronization thread in the master cluster corresponding to the new slave cluster to implement asynchronous replication of backup snapshots;
[0072] After deleting the slave cluster information corresponding to the slave cluster that does not need to store the snapshot to be backed up from the master cluster, the following steps may also be performed:
[0073] The data synchronization thread corresponding to the slave cluster that does not need to store the snapshot to be backed up is recovered, and a umount operation is performed on the slave cluster that does not need to store the snapshot to be backed up.
[0074] It should be noted that in order to effectively realize the asynchronous replication of snapshots under the specified directory of the main cluster to the corresponding slave cluster, the embodiment of the present application can connect to the slave cluster used for disaster recovery and backup, perform a mount operation on the slave cluster, and create a data synchronization thread corresponding to the slave cluster in the main cluster, so as to use the data synchronization thread to realize the asynchronous replication of snapshots in the main cluster to the slave cluster; and when the slave cluster is no longer needed for disaster recovery and backup, the data synchronization thread corresponding to the slave cluster in the main cluster can be recovered, and the umount operation can be performed on the slave cluster to avoid thread waste and the occurrence of useless asynchronous replication operations; wherein, the slave thread used for disaster recovery and backup corresponds to the data synchronization thread one by one, so that the asynchronous replication of the corresponding snapshot can be realized in parallel through multiple data synchronization threads, thereby improving the efficiency of disaster recovery and backup. In the case of realizing disaster recovery and backup using the mirror process, mon module and mgr module in the main cluster, the mon module can be triggered by sending a corresponding message, and the mirror process responds to the message to realize the above-mentioned slave cluster management and other operations.
[0075] A disaster recovery backup method provided by an embodiment of the present invention may further include:
[0076] If the disaster recovery backup function of the primary cluster is enabled, the step of determining that the directories in the primary cluster that need to be backed up for disaster recovery are all designated directories is performed. If the disaster recovery backup function of the primary cluster is disabled, it is determined that no disaster recovery backup is required for any directory in the primary cluster.
[0077] The embodiment of the present application can set the disaster recovery backup function of the main cluster to be turned on or off according to actual needs. If the data reliability required by the main cluster is low, the disaster recovery backup function of the main cluster can be turned on, and then the disaster recovery backup of the main cluster is implemented according to the disaster recovery backup method of the embodiment of the present application. Otherwise, the disaster recovery backup function of the main cluster is turned off, and then it is determined that there is no need to perform disaster recovery backup on the main cluster; thereby, the disaster recovery backup plan for the main cluster is consistent with actual needs and more flexible.
[0078] A disaster recovery backup method provided by an embodiment of the present invention enables a disaster recovery backup function of a primary cluster, which may include: connecting to the primary cluster and performing a mount operation on the primary cluster;
[0079] To disable the disaster recovery function of the active cluster, you can:
[0080] Recycle all data synchronization threads in the master cluster, perform umount operations on the slave clusters corresponding to all slave cluster information under the master cluster, and delete all slave cluster information under the master cluster.
[0081] In order to enable the disaster recovery and backup function of the master cluster, the embodiment of the present application can first connect to the master cluster and then perform a mount operation on the master cluster; in order to disable the disaster recovery and backup function of the master cluster, all data synchronization threads in the master cluster can be recovered, the information list of the slave cluster information that needs to be synchronized can be cleared, and the umount operation can be performed on all the slave clusters. In the case of using the mirror process, mon module and mgr module in the master cluster to achieve disaster recovery and backup, the mon module can be triggered by sending a corresponding message, and the mirror process responds to the message to achieve the above-mentioned management and other operations of the master cluster.
[0082] A disaster recovery backup method provided by an embodiment of the present invention may further include:
[0083] Regularly query the local snapshot collection in the master cluster used to store the snapshots to be backed up, and the remote snapshot collection in the slave cluster that needs to store the snapshots to be backed up;
[0084] If the snapshot ID of any snapshot to be backed up does not exist in the local snapshot set but exists in the remote snapshot set, then the snapshot to be backed up is deleted from the remote snapshot set;
[0085] If the snapshot ID of any snapshot to be backed up exists in both the local snapshot set and the remote snapshot set but the snapshot names are different, the snapshot name of any snapshot to be backed up in the remote snapshot set is modified to be consistent with the corresponding snapshot name in the local snapshot set;
[0086] If the snapshot ID of any snapshot to be backed up exists in the local snapshot set but does not exist in the remote snapshot set, the snapshot to be backed up is copied to the remote snapshot set.
[0087] In order to ensure data synchronization from the master cluster to the corresponding slave cluster, the present application may perform data synchronization from the master cluster to the slave cluster once every time interval set according to actual needs, or it may be implemented in accordance with the data synchronization method in the embodiment of the present application when the created snapshot is asynchronously copied to the corresponding slave cluster. Specifically, data synchronization for a single slave cluster may include: obtaining all snapshot names and corresponding snapshot metadata information (including snapshot ID) corresponding to the specified directory under the master cluster and the slave cluster used to implement disaster recovery backup; according to the snapshot name and snapshot metadata information, establishing a local snapshot set local_snap_map in the master cluster and a remote snapshot set remote_snap_map in the slave cluster; traversing the snapshot IDs of remote_snap_map, if the snapshot ID is not in l ocal_snap_map, then add the snapshot name to the delete set; if the snapshot name is not in local_snap_map but the snapshot ID is in local_snap_map, then add both the remote snapshot name and the local snapshot name to the rename set; perform a delete operation on the snapshot of the delete set in the slave cluster, and perform a rename operation on the snapshot of the rename set in the slave cluster, that is, change the snapshot name of the slave cluster to the snapshot name of the master cluster; if the contents of local_snap_map and remote_snap_map are the same, no synchronization is required; if the number of snapshots in local_snap_map is more than that in remote_snap_map, then it is necessary to synchronize the redundant snapshots in the master cluster to the slave cluster and create a snapshot. In addition, after any snapshot created under the master cluster is asynchronously copied to the corresponding slave cluster in the embodiment of the present application, the arbitrary snapshot can also be deleted from the master cluster to avoid wasting storage space.
[0088] It should be noted that, before using the mirror process, the embodiment of the present application can also initialize the mirror process, and then create, query and delete snapshots according to the preset strategy, add and delete the slave cluster for disaster recovery and backup, and turn on or off the disaster recovery and backup function of the main cluster. Specifically, the embodiment of the present application provides an mgr command control interface corresponding to the mgr module, and then when the interface is called by the outside world, the snapshot strategy can be specified on any directory of the main cluster, so that the mgr module automatically creates snapshots, queries snapshots, deletes expired snapshots, etc.; in addition, the mgr module sends information such as the creation, query and deletion of snapshots to the mirror process through messages so that it can be informed and processed accordingly. The embodiment of the present application can also provide a mon command control interface, and then when the interface is called by the outside world, the mon module can turn on the disaster recovery and backup function of the main cluster, turn off the disaster recovery and backup function of the main cluster, add the slave cluster information to the main cluster, and remove the slave cluster information from the main cluster; and the above four operations of the mon module are all sent to the mirror process through messages so that it can be informed and processed accordingly.
[0089] This application specifies a directory under the master cluster, creates snapshots under the directory at regular intervals, asynchronously copies the data under the snapshots to one or more slave clusters, and creates snapshots under the slave clusters to ensure that when the master cluster fails, the data in the slave clusters can be used normally, which greatly improves the stability of the product and increases the competitiveness of the product.
[0090] The embodiment of the present invention also provides a disaster recovery backup device, such as Figure 2 As shown, it may include:
[0091] The determination module 11 is used to: determine that the directory that needs to be backed up for disaster recovery under the main cluster is a designated directory;
[0092] The replication module 12 is used to: regularly create snapshots in a specified directory to obtain a snapshot to be backed up, and asynchronously copy the snapshot to be backed up to a corresponding specified file in the slave cluster in a manner of overwriting the stored data; wherein the specified files contained in a single slave cluster correspond to the specified directory one by one;
[0093] The snapshot module 13 is used to create a snapshot under a designated file storing the snapshot to be backed up to obtain a backup snapshot for use when a failure occurs in the primary cluster.
[0094] The embodiment of the present invention further provides a disaster recovery backup device, which may include:
[0095] Memory for storing computer programs;
[0096] A processor is used to implement the steps of any of the above disaster recovery backup methods when executing a computer program.
[0097] An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above disaster recovery backup methods can be implemented.
[0098] It should be noted that the description of the relevant parts of a disaster recovery backup device, equipment and storage medium provided by the embodiment of the present invention can be found in the detailed description of the corresponding parts in a disaster recovery backup method provided by the embodiment of the present invention, which will not be repeated here. In addition, the parts of the above technical solutions provided by the embodiment of the present invention that are consistent with the implementation principles of the corresponding technical solutions in the prior art are not described in detail to avoid excessive elaboration.
[0099] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A disaster recovery backup method, It is characterized in that include: Determine that the directories that need to be backed up for disaster recovery under the main cluster are all designated directories; wherein, disaster recovery backup is performed on the data and metadata under the designated directory; the main cluster is provided with a mirror process, a mon module and an mgr module; the mirror process is responsible for implementing the disaster recovery backup method, and the mon module and the mgr module are responsible for respectively implementing snapshot-related functions and directory management-related functions under the call of the mirror process; Creating snapshots in the designated directory at regular intervals to obtain snapshots to be backed up, and asynchronously copying the snapshots to be backed up to corresponding designated files in the slave cluster in a manner of overwriting stored data; wherein the designated files contained in a single slave cluster correspond one-to-one to the designated directories; each slave cluster used to implement disaster recovery backup has pre-created designated files corresponding to each designated directory, and when the snapshots to be backed up are stored in any single slave cluster, the snapshot data to be backed up are stored in designated files corresponding to the designated directories to which the snapshots to be backed up belong in any single slave cluster, and each time the snapshots to be backed up are stored in the corresponding designated files, if data already exists in the corresponding designated files, the snapshots to be backed up will overwrite the data already existing in the corresponding designated files; Creating a snapshot under a designated file storing the snapshot to be backed up to obtain a re-backup snapshot for use when a failure occurs in the primary cluster; Correspondingly, the directories that need to be backed up for disaster recovery in the primary cluster are determined to be designated directories, including: Determine that all directories in the directory list under the main cluster are designated directories; Correspondingly, the disaster recovery backup method further includes: If there is a new directory that needs to be backed up for disaster recovery under the primary cluster, add the new directory to the directory list; If there is a directory that does not need to be backed up for disaster recovery under the directory list, the directory that does not need to be backed up for disaster recovery is deleted from the directory list; Correspondingly, determining a slave cluster that needs to store the snapshot to be backed up includes: Determine that the slave cluster information stored under the master cluster corresponds to a slave cluster, which is the slave cluster that needs to store the snapshot to be backed up; Correspondingly, the disaster recovery backup method further includes: If there is a new slave cluster that needs to store the snapshot to be backed up, the slave cluster information of the new slave cluster is added to the master cluster; If there is slave cluster information corresponding to a slave cluster that does not need to store the snapshot to be backed up under the master cluster, the slave cluster information corresponding to the slave cluster that does not need to store the snapshot to be backed up is deleted from the master cluster; Correspondingly, after adding the slave cluster information of the new slave cluster to the master cluster, the method further includes: Connecting to the new slave cluster, performing a mount operation on the new slave cluster, and creating a data synchronization thread in the master cluster corresponding to the new slave cluster for implementing asynchronous replication of backup snapshots; After deleting the slave cluster information corresponding to the slave cluster that does not need to store the snapshot to be backed up from the master cluster, the method further includes: Reclaiming the data synchronization thread corresponding to the slave cluster that does not need to store the snapshot to be backed up, and performing a umount operation on the slave cluster that does not need to store the snapshot to be backed up; Correspondingly, it also includes: If the disaster recovery backup function of the primary cluster is turned on, the step of determining that the directories under the primary cluster that need to be backed up for disaster recovery are all designated directories is performed; if the disaster recovery backup function of the primary cluster is turned off, it is determined that no disaster recovery backup is required for any directory under the primary cluster; Correspondingly, the disaster recovery backup function of the main cluster is enabled, including: Connect to the main cluster and perform a mount operation on the main cluster; Disable the disaster recovery function of the primary cluster, including: All data synchronization threads in the master cluster are recovered, a umount operation is performed on the slave clusters corresponding to all the slave cluster information under the master cluster, and all the slave cluster information under the master cluster is deleted.
2. The method according to claim 1, It is characterized in that Also includes: Periodically querying a local snapshot set in the master cluster for storing the snapshots to be backed up, and a remote snapshot set in the slave cluster that needs to store the snapshots to be backed up; If the snapshot ID of any snapshot to be backed up does not exist in the local snapshot set but exists in the remote snapshot set, then the snapshot to be backed up is deleted from the remote snapshot set; If the snapshot ID of any snapshot to be backed up exists in both the local snapshot set and the remote snapshot set but the snapshot names are different, the snapshot name of any snapshot to be backed up in the remote snapshot set is modified to be consistent with the corresponding snapshot name in the local snapshot set; If the snapshot ID of any snapshot to be backed up exists in the local snapshot set but does not exist in the remote snapshot set, the snapshot to be backed up is copied to the remote snapshot set.
3. A disaster recovery backup device, It is characterized in that include: A determination module is used to: determine that the directory to be backed up for disaster recovery under the main cluster is a designated directory; wherein the data and metadata under the designated directory are backed up for disaster recovery; the main cluster is provided with a mirror process, a mon module and an mgr module; the mirror process is responsible for implementing the disaster recovery backup method, and the mon module and the mgr module are responsible for respectively implementing snapshot-related functions and directory management-related functions under the call of the mirror process; A replication module, used for: creating snapshots in the specified directory at regular intervals to obtain snapshots to be backed up, and asynchronously copying the snapshots to be backed up to corresponding specified files in the slave cluster in a manner of overwriting stored data; wherein the specified files contained in a single slave cluster correspond to the specified directories one by one; each slave cluster used to implement disaster recovery backup has pre-created specified files corresponding to each specified directory, and when the snapshots to be backed up are stored in any single slave cluster, the snapshot data to be backed up are stored in the specified files corresponding to the specified directories to which the snapshots to be backed up belong in any single slave cluster, and each time the snapshots to be backed up are stored in the corresponding specified files, if data already exists in the corresponding specified files, the snapshots to be backed up will overwrite the data already existing in the corresponding specified files; A snapshot module is used to: create a snapshot under a specified file storing the snapshot to be backed up to obtain a backup snapshot for use when a failure occurs in the primary cluster; Correspondingly, the directories that need to be backed up for disaster recovery in the primary cluster are determined to be designated directories, including: Determine that all directories in the directory list under the main cluster are designated directories; Correspondingly, the disaster recovery backup method further includes: If there is a new directory that needs to be backed up for disaster recovery under the primary cluster, add the new directory to the directory list; If there is a directory that does not need to be backed up for disaster recovery under the directory list, the directory that does not need to be backed up for disaster recovery is deleted from the directory list; Correspondingly, determining a slave cluster that needs to store the snapshot to be backed up includes: Determine that the slave cluster information stored under the master cluster corresponds to a slave cluster, which is the slave cluster that needs to store the snapshot to be backed up; Correspondingly, the disaster recovery backup method further includes: If there is a new slave cluster that needs to store the snapshot to be backed up, the slave cluster information of the new slave cluster is added to the master cluster; If there is slave cluster information corresponding to a slave cluster that does not need to store the snapshot to be backed up under the master cluster, the slave cluster information corresponding to the slave cluster that does not need to store the snapshot to be backed up is deleted from the master cluster; Correspondingly, after adding the slave cluster information of the new slave cluster to the master cluster, the method further includes: Connecting to the new slave cluster, performing a mount operation on the new slave cluster, and creating a data synchronization thread in the master cluster corresponding to the new slave cluster for implementing asynchronous replication of backup snapshots; After deleting the slave cluster information corresponding to the slave cluster that does not need to store the snapshot to be backed up from the master cluster, the method further includes: Reclaiming the data synchronization thread corresponding to the slave cluster that does not need to store the snapshot to be backed up, and performing a umount operation on the slave cluster that does not need to store the snapshot to be backed up; Correspondingly, it also includes: If the disaster recovery backup function of the primary cluster is turned on, the step of determining that the directories under the primary cluster that need to be backed up for disaster recovery are all designated directories is performed; if the disaster recovery backup function of the primary cluster is turned off, it is determined that no disaster recovery backup is required for any directory under the primary cluster; Correspondingly, the disaster recovery backup function of the main cluster is enabled, including: Connect to the main cluster and perform a mount operation on the main cluster; Disable the disaster recovery function of the primary cluster, including: All data synchronization threads in the master cluster are recovered, a umount operation is performed on the slave clusters corresponding to all the slave cluster information under the master cluster, and all the slave cluster information under the master cluster is deleted.
4. A disaster recovery backup device, It is characterized in that include: Memory for storing computer programs; A processor is used to implement the steps of the disaster recovery backup method as claimed in claim 1 or 2 when executing the computer program.
5. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by the processor, the steps of the disaster recovery backup method according to claim 1 or 2 are implemented.
Citation Information
Patent Citations
Replica-based dynamic metadata cluster system
CN102904949A
Method for assisting in backing-up and copying computer system in cluster
CN103793296A
Cross-regional disaster recovery method and device
CN108512693A
System, method and device for providing container services
CN109669637A
Snapshot data backup method, device and system
CN109753380A
