Data recovery method, device, equipment, medium and program product
By responding to the recovery configuration instructions, the address information and data of the target recovery node are determined and copied, which solves the problem of shared storage data recovery in distributed systems, realizes efficient and reusable automatic data recovery, and avoids the economic consequences of long-term system paralysis. loss.
Patent Information
- Application Number
- CN202110286501.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-17
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2041-03-17
AI Technical Summary
When faced with centralized data bursts or hacker attacks involving large volumes of data and business, existing technologies are difficult to quickly restore shared storage data in distributed systems, leading to system paralysis or collapse, resulting in economic losses.
Provides a data recovery method that responds to recovery configuration instructions, determines the address information and recovery method of the target recovery node, and copies the target recovery data and node operation tools to the target recovery node to achieve data recovery. This method supports multiple recovery methods and scenarios, including recovery of backup data and normal operating data.
It realizes the rapid recovery of shared storage data in distributed systems, saves manpower and material resources, and avoids economic losses caused by the system being unable to be restored for a long time.
Smart Images

Figure CN113064755B
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer data shared storage, and in particular to a data recovery method, device, equipment, medium and program product. Background Art
[0002] With the continuous development of Internet technology, multi-node distributed systems have become the main solution in the field of Internet backend services. However, all distributed systems must face the problem of data sharing between multiple nodes. For example, the identity information of each node, the coordination information of the order of tasks completed by each node, etc. Therefore, distributed systems generally solve this problem in two ways: one is to synchronize information through a reliable search engine (such as Elasticsearch), and the other is to rely on or integrate a reliable shared storage service.
[0003] Therefore, the security of shared storage in distributed systems has become an issue that must be considered when ensuring the security of distributed systems. The existing technology generally ensures the security of shared storage by providing backup shared storage, such as introducing the Elasticsearch search engine and establishing a shared storage service.
[0004] However, the existing technology still cannot avoid the technical problem of key-value shared storage loss when facing the outbreak of large-scale and large-business centralized data, or intentional attacks by hackers or viruses. Once the key value is lost, the entire distributed system will fall into the embarrassing situation of paralysis or collapse, and the background maintenance personnel will need to rebuild the system connection. For small systems, the impact is not very serious, but for complex large systems, this will inevitably lead to a very serious impact and cause huge economic losses. Therefore, how to quickly restore the shared storage data of the distributed system has become a technical problem that needs to be solved urgently. Summary of the invention
[0005] The present application provides a data recovery method, apparatus, device, medium and program product to solve the technical problem of how to quickly recover shared storage data in a distributed system.
[0006] In a first aspect, the present application provides a data recovery method, which is applied to a shared storage service cluster, wherein the shared storage service cluster includes at least one shared storage node, and the method includes:
[0007] In response to the recovery configuration instruction, determine address information and recovery mode information of a target recovery node, wherein the target recovery node includes some or all of the shared storage nodes in the shared storage service cluster, and the recovery mode information includes at least one recovery mode;
[0008] Determining target recovery data corresponding to the recovery method information;
[0009] The target recovery data and the node operation tool are copied to the target recovery node according to the address information, so that the target recovery node completes data recovery.
[0010] In a possible design, the recovery mode information includes: a first recovery mode, and the target recovery data corresponding to the first recovery mode includes: backup data backed up at a first preset time.
[0011] Optionally, the backup data includes: first shared data automatically backed up at a preset time, and second shared data manually backed up by a user at any time.
[0012] In one possible design, the recovery method information includes: a second recovery method, and the target recovery data corresponding to the second recovery method includes: normal operating data stored in the shared storage service cluster at a second preset time.
[0013] Optionally, the second preset moment includes: the last moment when the shared storage service cluster operates normally.
[0014] Optionally, the normal operation data includes: shared data stored in real time by at least one of the shared storage nodes during normal operation.
[0015] In a possible design, the shared storage service cluster includes: a first cluster that has failed, and the step of determining address information and recovery mode information of a target recovery node in response to a recovery configuration instruction includes:
[0016] Determining whether the configuration instruction indicates to perform data recovery on the first cluster;
[0017] If so, at least one node to be restored on the first cluster is used as the target restoration node, and the address code and corresponding user information of the target restoration node are determined, and the node to be restored is the shared storage node that has failed;
[0018] Determine the directory information of the target recovery data according to the recovery mode information indicated by the configuration instruction;
[0019] The address information includes: the address code and the user information, and the recovery method information includes: the recovery method and the directory information.
[0020] In a possible design, the shared storage service cluster further includes: a second cluster where no failure occurs, and after determining whether the configuration instruction indicates to perform data recovery on the first cluster, further includes:
[0021] If not, at least one shared storage node on the second cluster is used as the target recovery node, and the address code of the target recovery node and the corresponding user information are determined.
[0022] Optionally, before taking at least one shared storage node on the second cluster as the target recovery node, the method further includes:
[0023] Determining whether the second cluster has been built;
[0024] If not, creating the second cluster through a preset management tool;
[0025] If so, correspondingly, at least one shared storage node on the second cluster is used as the target recovery node, and the address code of the target recovery node and the corresponding user information are determined.
[0026] Optionally, the preset management tool includes: a containerized management tool, and the creating the second cluster by using the preset management tool includes:
[0027] The connection information and resource information of the container management tool are configured so that the container management tool creates and starts the second cluster according to the connection information and the resource information.
[0028] In a possible design, the recovery mode information includes: a first recovery mode and a second recovery mode, the first recovery mode is to perform data recovery using backup data, and the second recovery mode is to perform data recovery using normal operating data stored in the shared storage service cluster, and the determination of directory information of the target recovery data according to the recovery mode information indicated by the configuration instruction includes:
[0029] If the recovery mode is the first recovery mode, determining the first directory information of the backup data;
[0030] If the recovery mode is the second recovery mode, the second directory information of the normal operation data is determined.
[0031] In a possible design, if the recovery mode is the first recovery mode, copying the target recovery data and the node operation tool to the target recovery node according to the address information so that the target recovery node completes data recovery includes:
[0032] Copying the backup data and the node operation tool to each of the target recovery nodes according to each of the address information of each of the target recovery nodes and the first directory information corresponding to each of the target recovery nodes;
[0033] Using the node operation tool on each target recovery node, executing a node restoration task according to the backup data;
[0034] Restart each of the target recovery nodes to complete data recovery.
[0035] In a possible design, if the recovery mode is the second recovery mode, copying the target recovery data and the node operation tool to the target recovery node according to the address information so that the target recovery node completes data recovery includes:
[0036] Copying the second directory information and the operation tool to a target node according to the address information, the target recovery node including the target node;
[0037] Starting the target node, and using the node operation tool on the target node to perform a node update task according to the second directory information, so that the target node is updated to restore the original node;
[0038] The node operation tool is used to cyclically execute the task of adding new nodes according to the second directory information, and the newly added shared storage node is started to execute the node update task until the data recovery of the shared storage service cluster is completed.
[0039] In a second aspect, the present application provides a data recovery device, comprising:
[0040] An acquisition module is used to obtain a recovery configuration instruction;
[0041] a configuration module, configured to determine, in response to the recovery configuration instruction, address information and recovery mode information of a target recovery node, wherein the target recovery node includes some or all of the shared storage nodes in the shared storage service cluster, and the recovery mode information includes at least one recovery mode;
[0042] A recovery module, used for determining target recovery data corresponding to the recovery mode information;
[0043] The recovery module is further used to copy the target recovery data and the node operation tool to the target recovery node according to the address information, so that the target recovery node completes data recovery.
[0044] In a possible design, the recovery mode information includes: a first recovery mode, and the target recovery data corresponding to the first recovery mode includes: backup data backed up at a first preset time.
[0045] Optionally, the backup data includes: first shared data automatically backed up at a preset time, and second shared data manually backed up by a user at any time.
[0046] In one possible design, the recovery method information includes: a second recovery method, and the target recovery data corresponding to the second recovery method includes: normal operating data stored in the shared storage service cluster at a second preset time.
[0047] Optionally, the second preset moment includes: the last moment when the shared storage service cluster operates normally.
[0048] Optionally, the normal operation data includes: shared data stored in real time by at least one of the shared storage nodes during normal operation.
[0049] In a possible design, the shared storage service cluster includes: a first cluster that has failed, and the configuration module is specifically used to:
[0050] Determining whether the configuration instruction indicates to perform data recovery on the first cluster;
[0051] If so, at least one node to be restored on the first cluster is used as the target restoration node, and the address code and corresponding user information of the target restoration node are determined, and the node to be restored is the shared storage node that has failed;
[0052] Determine the directory information of the target recovery data according to the recovery mode information indicated by the configuration instruction;
[0053] The address information includes: the address code and the user information, and the recovery method information includes: the recovery method and the directory information.
[0054] In a possible design, the shared storage service cluster further includes: a second cluster in which no failure occurs, and the configuration module is further used to:
[0055] Determining whether the configuration instruction indicates to perform data recovery on the first cluster;
[0056] If not, taking at least one shared storage node on the second cluster as the target recovery node, and determining the address code of the target recovery node and the corresponding user information;
[0057] Optionally, the configuration module is further used to:
[0058] Determining whether the second cluster has been built;
[0059] If not, creating the second cluster through a preset management tool;
[0060] If so, correspondingly, at least one shared storage node on the second cluster is used as the target recovery node, and the address code of the target recovery node and the corresponding user information are determined.
[0061] Optionally, the preset management tool includes: a containerized management tool, and the configuration module is further used to:
[0062] The connection information and resource information of the container management tool are configured so that the container management tool creates and starts the second cluster according to the connection information and the resource information.
[0063] In a possible design, the recovery mode information includes: a first recovery mode and a second recovery mode, wherein the first recovery mode is to recover data using backup data, and the second recovery mode is to recover data using normal operating data stored in the shared storage service cluster, and the recovery module is specifically used to:
[0064] If the recovery mode is the first recovery mode, determining the first directory information of the backup data;
[0065] If the recovery mode is the second recovery mode, the second directory information of the normal operation data is determined.
[0066] In a possible design, if the recovery mode is the first recovery mode, the recovery module is further used to:
[0067] Copying the backup data and the node operation tool to each of the target recovery nodes according to each of the address information of each of the target recovery nodes and the first directory information corresponding to each of the target recovery nodes;
[0068] Using the node operation tool on each of the target recovery nodes, executing a node restoration task according to the backup data;
[0069] Restart each of the target recovery nodes to complete data recovery.
[0070] In a possible design, if the recovery mode is the second recovery mode, the recovery module is further used to:
[0071] Copying the second directory information and the operation tool to a target node according to the address information, the target recovery node including the target node;
[0072] Starting the target node, and using the node operation tool on the target node to perform a node update task according to the second directory information, so that the target node is updated to restore the original node;
[0073] The node operation tool is used to cyclically execute the task of adding new nodes according to the second directory information, and the newly added shared storage node is started to execute the node update task until the data recovery of the shared storage service cluster is completed.
[0074] In a third aspect, the present application provides an electronic device, including:
[0075] A memory for storing program instructions;
[0076] The processor is used to call and execute the program instructions in the memory to perform any possible data recovery method provided by the first aspect.
[0077] In a fourth aspect, the present application provides a storage medium, wherein the readable storage medium stores a computer program, and the computer program is used to execute any possible data recovery method provided in the first aspect.
[0078] In a fifth aspect, the present application also provides a computer program product, including a computer program, which, when executed by a processor, implements any possible data recovery method provided in the first aspect.
[0079] The present application provides a data recovery method, apparatus, device, medium and program product, which determines the address information and recovery mode information of the target recovery node in response to the recovery configuration instruction, and then determines the target recovery data corresponding to the recovery mode information, and then copies the target recovery data and the node operation tool to the target recovery node according to the address information, so that the target recovery node completes the data recovery. The technical problem of how to quickly restore the shared storage data of the distributed system is solved. The technical effect of efficient and highly reused automatic data recovery applicable to multiple recovery modes or recovery scenarios is achieved, which saves manpower and material resources, and avoids the system from being unable to be restored for a long time and causing greater economic losses. BRIEF DESCRIPTION OF THE DRAWINGS
[0080] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0081] Figure 1 A schematic diagram of an application scenario of the ETCD shared storage cluster provided in an embodiment of the present application;
[0082] Figure 2 A flowchart of a data recovery method provided in an embodiment of the present application;
[0083] Figure 3A flowchart of another data recovery method provided for the implementation of this application;
[0084] Figure 4 A schematic diagram of the structure of a data recovery device provided in an embodiment of the present application;
[0085] Figure 5 A schematic diagram of the structure of an electronic device provided in this application.
[0086] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0087] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work, including but not limited to the combination of multiple embodiments, belong to the scope of protection of this application.
[0088] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein, for example. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0089] Distributed systems have become the mainstream construction mode of current Internet service systems, but all distributed systems must face the problem of data sharing between multiple nodes. For example, the identity information of each node, the coordination information of the order of tasks completed by each node, etc. Therefore, distributed systems generally solve this problem in two ways: one is to synchronize information through a reliable search engine (such as Elasticsearch), and the other is to rely on or integrate a reliable shared storage service.
[0090] As the online cluster environment of distributed systems becomes more and more complex and the number of access requests increases, system servers are easily overwhelmed by a large number of highly concurrent data accesses, or due to a series of force majeure situations such as server hardware failure, power outages in the computer room, and network outages, the security of shared storage in distributed systems has received more and more attention, and a series of complex operating procedures have been developed to guide operation and maintenance personnel to recover data when shared storage services fail.
[0091] However, the inventor of the present application found that this also leads to an increase in the cost of system construction and operation and maintenance. In addition, the operation and maintenance personnel perform manual emergency repairs on the shared storage service, namely data recovery. There are many recovery methods corresponding to different distributed systems, or the same distributed system also corresponds to a variety of different recovery methods when facing different faults. This makes it impossible for the operation and maintenance personnel to quickly and accurately complete data recovery. Each time the data is restored, the operation and maintenance personnel need to analyze and manually edit the recovery parameters and recovery configuration files, which is time-consuming and labor-intensive, and is extremely easy to cause misoperation, resulting in logical errors, leading to secondary paralysis of the system, or triggering subsequent chain reactions, resulting in greater economic losses.
[0092] In order to solve the above technical problems, the invention concept of this application is:
[0093] The operation and maintenance personnel simply select or enter the required recovery method and recovery parameters on the data recovery interface, and the system will automatically configure various recovery files and match the recovery data. By providing system services that can support multiple recovery methods, data can be quickly restored, solving the high time cost problem of manual recovery by operation and maintenance personnel in the event of a failure, avoiding the risk of operational errors caused by complicated steps during manual operation, and supporting different recovery methods in different scenarios in a diversified manner. A single tool covers multiple situations of recovery operations, eliminating the need for step references in multiple situations required for manual operation, and more unified and simple operations, ensuring efficient and stable recovery execution.
[0094] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0095] For ease of understanding, the following embodiments are introduced based on the ETCD shared storage service cluster, but the data recovery method provided in this application can not only be used for ETCD, but also can be used for similar systems, such as Zookeeper, Consul, etc. Technical personnel in this field can select the specific carrier or specific implementation method of the data recovery method provided in this application according to the specific application scenario, and this application does not limit it.
[0096] The following is a basic introduction to ETCD.
[0097] ETCD is a distributed, highly available, and highly consistent shared storage database in the form of key-value data. It is implemented in the Go language and is mainly used for shared configuration and service discovery.
[0098] As projects such as CoreOS and Kubernetes become increasingly popular in the open source community, the ETCD component used in these projects, as a highly available and highly consistent service discovery storage warehouse, has gradually attracted the attention of developers. In the era of cloud computing, how to quickly and transparently connect services to computing clusters, how to quickly make shared configuration information discovered by all machines in the cluster, and more importantly, how to build such a highly available, secure, easy-to-deploy and fast-response service cluster have become urgent problems that need to be solved, and ETCD has brought good news to solving such problems.
[0099] ETCD can be used in a variety of application scenarios, including service discovery, message publishing and subscription, load balancing, distributed notification and coordination, distributed locks, distributed queues, cluster monitoring, and LEADER master node election.
[0100] In these scenarios, the core role of ETCD is the shared storage of key-value data.
[0101] Figure 1 A schematic diagram of an application scenario of the ETCD shared storage cluster provided in the embodiment of the present application. Figure 1 As shown, the distributed system includes a first service part 20 and a second service part 30. When performing certain services, an ETCD shared storage service cluster 10 is required to perform shared storage and configuration of service-related parameters. The ETCD shared storage service cluster 10 includes multiple shared storage nodes, which are used to provide shared storage services for different services or different services of the same business, such as data storage services in the form of Key Value.
[0102] The data recovery method provided in this application can perform various forms of data recovery on any one or more shared storage nodes in the ETCD shared storage service cluster 10.
[0103] Figure 2 A flowchart of a data recovery method provided in an embodiment of the present application is shown in FIG. Figure 2 As shown, the specific steps of the data recovery method include:
[0104] S201. In response to a recovery configuration instruction, determine address information and recovery mode information of a target recovery node.
[0105] In this step, the target recovery node includes some or all of the shared storage nodes in the shared storage service cluster, and the recovery mode information includes at least one recovery mode.
[0106] In this embodiment, the user inputs or selects a recovery method in the control interface, such as backup file recovery or local data recovery, and sets some related configuration parameters. The distributed system automatically completes the remaining configuration parameters to form a configuration file that meets the preset requirements, that is, the recovery configuration instructions.
[0107] The distributed system obtains the recovery configuration instruction and extracts the address information of the ETCD node that needs to perform data recovery, that is, the target recovery node, such as the IP address. At the same time, the user-specified recovery method is determined according to the recovery configuration instruction.
[0108] It should be noted that the data recovery method provided in this embodiment is applied to a shared storage service cluster, which includes at least one shared storage node. Optionally, the data stored in the shared storage service cluster is in the form of Key-Value.
[0109] S202: Determine target recovery data corresponding to the recovery method information.
[0110] In this step, different recovery methods correspond to different recovery data. For example, when restoring with backup files, the target recovery data is the backup data file backed up by the system in advance; when restoring with data stored locally in a shared storage node, the target recovery data is the data recorded when the shared storage node is operating normally.
[0111] In a possible design, the recovery method information includes: a first recovery method; and target recovery data corresponding to the first recovery method includes: backup data backed up at a first preset time.
[0112] Optionally, the backup data includes: first shared data automatically backed up at a preset time, and second shared data manually backed up by a user at any time.
[0113] It should be noted that the preset moments include: periodic moments at fixed time intervals and moments at non-fixed time intervals. Periodic moments can be understood as the distributed system where the shared storage service cluster is located periodically backing up data for all shared storage nodes; and moments at non-fixed time intervals can be understood as the distributed system presetting backup conditions, and when the operating status of the distributed system reaches the preset backup conditions, the backup can be triggered. For example, the distributed system can back up once every hour, or it can trigger automatic backup when the business access load rate reaches a preset threshold, such as 70%.
[0114] It is understandable that users can also manually back up some or all shared storage nodes of the shared storage service cluster in the distributed system at any time according to their own needs.
[0115] In another possible design, the recovery method information also includes: a second recovery method; the target recovery data corresponding to the second recovery method includes: normal operating data stored in the shared storage service cluster at the second preset time.
[0116] The normal operating data, in this embodiment, includes: shared data stored in real time by at least one shared storage node during normal operation.
[0117] It should be noted that, optionally, the second preset moment may be the same as or different from the first preset moment. In this embodiment, the second preset moment has no binding relationship with the first preset moment. Of course, it is understandable that those skilled in the art may also establish a corresponding relationship between the first preset moment and the second preset moment according to actual scene requirements, and the specific corresponding manner is not limited by this application.
[0118] In a possible implementation, the second preset time includes: the last time when the shared storage service cluster operates normally, that is, when the shared storage service cluster fails to operate normally due to a certain fault in the distributed system, the data running at the last time of the shared storage service cluster is automatically stored and backed up.
[0119] In a possible implementation manner, the second preset time includes: any time between two backup cycle times, such as a midpoint time between two backup cycle times.
[0120] S203: Copy the target recovery data and the node operation tool to the target recovery node according to the address information, so that the target recovery node completes data recovery.
[0121] In this embodiment, the node operation tool includes: an operation program file and a program configuration file.
[0122] Different data recovery methods require different numbers of target recovery nodes, or the same data recovery method can also use different numbers of target recovery nodes to perform data recovery.
[0123] For example, a shared storage service cluster contains three shared storage nodes. When the distributed system fails for some reason, one of the nodes may lose data, two of the nodes may lose data, or all three nodes may lose data.
[0124] At this time, if the user chooses to restore data in the first recovery method, that is, to restore data in the form of backup files, a possible design is to restore data to the shared storage node regardless of whether the shared storage node has lost data, that is, the three shared storage nodes will copy the backup data to the node, and then the operating program file calls the program configuration file to start the restore command, that is, to execute the node restoration task, and restore the three shared storage nodes to the first preset time corresponding to the backup data, and the state of the shared storage service cluster, that is, the ETCD cluster.
[0125] In another possible design, it is also possible to first check and identify whether the shared storage nodes have data loss or data errors, and only repair the abnormal shared storage nodes. It is understandable that in this case, one or some shared storage nodes may not be able to complete recovery in a short time, such as power outage in the computer room or server hardware failure. At this time, the nodes that cannot be restored can be replaced by executing the new node task on some normal shared storage nodes, copying the backup data to these new nodes, and starting the new nodes to complete data recovery. Or first repair one or some abnormal shared storage nodes, and then start the repaired shared storage nodes, execute the new node task, replace the nodes that cannot be restored, and complete data recovery. In this way, the distributed system can complete data recovery as soon as possible, thereby resuming service provision and reducing or avoiding economic losses caused by system paralysis.
[0126] After completing the data recovery, you can also perform a cyclic status check on the entire shared data cluster to ensure that there are no problems with each shared storage node in the shared data cluster, or that the data will not conflict directly due to data recovery, and then confirm that the recovery is successful and return a recovery success log, otherwise return an error log of recovery failure and related steps.
[0127] This embodiment provides a data recovery method, which determines the address information and recovery mode information of the target recovery node in response to the recovery configuration instruction, then determines the target recovery data corresponding to the recovery mode information, and then copies the target recovery data and the node operation tool to the target recovery node according to the address information, so that the target recovery node completes the data recovery. The technical problem of how to quickly recover the shared storage data of the distributed system is solved. The technical effect of efficient and highly reused automatic data recovery applicable to multiple recovery modes or recovery scenarios is achieved, which saves manpower and material resources and avoids the system from being unable to be restored for a long time and causing greater economic losses.
[0128] Figure 3 A flow chart of another data recovery method provided for the implementation of this application. Figure 3 As shown, the specific steps of the data recovery method include:
[0129] S301: Determine whether the obtained configuration instruction indicates to perform data recovery on the first cluster.
[0130] The data recovery method provided in this embodiment is applied to a shared storage service cluster, and the shared storage service cluster includes at least one shared storage node.
[0131] In this embodiment, the shared storage service cluster includes: a first cluster in which a fault has occurred.
[0132] The user first enters or selects the recovery method in the control interface, and sets the configuration parameters that need to be manually set or selected, and then the distributed system automatically completes the remaining configuration parameters to form a configuration file that meets the preset requirements, that is, the recovery configuration instructions.
[0133] If the user chooses to perform data recovery on the failed cluster, that is, to perform data recovery on the first cluster, step S302 is executed; otherwise, step S304 is executed.
[0134] S302: Take at least one node to be restored in the first cluster as a target restoration node, and determine an address code of the target restoration node and corresponding user information.
[0135] In this step, the node to be restored is a shared storage node that has failed, the user information includes: account name (or account number) and account password, and the address code includes: MAC address or IP address.
[0136] Specifically, for example, in the current application scenario, the user chooses to restore on the original cluster (ie, the first cluster) node, then the user chooses or the distributed system automatically fills in the node IP of the original cluster and related user name and password information into the configuration file.
[0137] In a possible design, the target recovery nodes include all nodes to be recovered, or only some of the nodes to be recovered. In some cases, due to objective reasons, some nodes to be recovered cannot complete data recovery in a short time, such as power outages in the computer room, network outages, server hardware damage and other force majeure factors, which make some shared storage nodes unable to be recovered immediately.
[0138] S303: Determine directory information of target recovery data according to the recovery method information indicated by the configuration instruction.
[0139] In this embodiment, the recovery method information includes: a first recovery method and a second recovery method. The first recovery method is to recover data using backup data, and the second recovery method is to recover data using normal operation data stored in the shared storage service cluster.
[0140] In this step, if the recovery mode is the first recovery mode, the first directory information of the backup data is determined; if the recovery mode is the second recovery mode, the second directory information of the normal operation data is determined.
[0141] In a possible design, after determining the directory information of the target recovery data, the following is further included:
[0142] A verification tool is used to verify the correctness of each recovery parameter determined according to the configuration instructions. If the recovery parameter is correct, such as there is no logical error or value error in the recovery parameter, step S307 is executed to start data recovery; if there is an error in the recovery parameter, an error identifier and related error steps or error locations are returned to form an error report log, which is returned to the distributed system for user analysis and processing.
[0143] S304, determining whether the second cluster has been constructed;
[0144] In this embodiment, the shared storage service cluster further includes: a second cluster in which no failure occurs.
[0145] If yes, execute step S305, if no, execute step S306.
[0146] It should be noted that the second cluster can be a standby cluster or a newly created cluster, or it can be another running cluster, which can temporarily replace the failed first cluster through temporary secondment, and then switch back after the first cluster recovers.
[0147] S305 takes at least one shared storage node on the second cluster as a target recovery node, and determines an address code of the target recovery node and corresponding user information.
[0148] In this step, when the required new shared storage cluster, ie, the second cluster, already exists, at least one shared storage node on the second cluster is selected as a target recovery node.
[0149] Optionally, when the number of selected target recovery nodes is consistent with the number of nodes to be recovered, one-to-one replication recovery can be implemented for each node to be recovered, so that fast switching recovery can be achieved.
[0150] Optionally, when the number of target recovery nodes selected is less than the number of nodes to be recovered, you can choose to restore the more critical shared storage nodes first, such as restoring the data of the leader node in the cluster first, and then restore or replace the remaining nodes to be restored by automatically generating new nodes through the leader node. The advantage of this is that it can follow the master-slave relationship of the cluster, and the recovery method is simple and easy. You only need to restore the initial node, and then you can use the recovery mechanism of the distributed system itself, without the need for external recovery services to complete all data recovery.
[0151] It should be noted that after completing this step, continue to execute step S303.
[0152] S306: Create a second cluster using a preset management tool.
[0153] In this step, the preset management tools include: containerized management tools.
[0154] Specifically, the connection information and resource information of the container management tool are configured so that the container management tool creates and starts the second cluster according to the connection information and the resource information.
[0155] In this embodiment, the container management tool includes: kubernetes, by configuring the connection information and resource information related to kubernetes, calling kubernetes to enable a new shared storage cluster.
[0156] It should be noted that after completing this step, continue to execute step S305.
[0157] S307: Execute corresponding data recovery steps according to the recovery method information indicated by the configuration instruction.
[0158] In this embodiment, the recovery method information includes at least: a first recovery method and a second recovery method. The first recovery method is to recover data using backup data, and the second recovery method is to recover data using normal operating data stored in the shared storage service cluster.
[0159] If data recovery is performed in the first recovery mode, steps S308-S310 are executed;
[0160] If data recovery is performed in the second recovery mode, steps S311 - S314 are executed.
[0161] It should be noted that, in a possible manner, in order to ensure that the target recovery node is an available node when performing data recovery, before executing this step, the following steps are also included:
[0162] Using a connectivity verification tool, based on the address information, a connectivity verification is performed on the target recovery node;
[0163] If the target recovery node is connectable, continue to execute this step, i.e., determine and identify the recovery mode information in the configuration instruction;
[0164] If the target recovery node cannot be connected, an error identifier and related error steps or error locations are returned to form an error report log, which is returned to the distributed system for analysis and processing by the user.
[0165] S308. Copy the backup data and the node operation tool to each target recovery node according to each address information of each target recovery node and the first directory information corresponding to each target recovery node.
[0166] In this step, the node operation tool includes: an operation program file and a program configuration file, and the address information includes: an IP address and / or a MAC address.
[0167] For ease of understanding, this embodiment is described using the ETCD shared storage service cluster as an example.
[0168] In this embodiment, the node operation tool includes: an ETCD service program and an ETCD configuration file.
[0169] Specifically, first, a new ETCD configuration file is generated locally, i.e., in the distributed system, and then, the backup data and related ETCD binary files (i.e., ETCD service programs) and ETCD configuration files are copied to each target node via IP addresses and / or MAC addresses.
[0170] S309: Using a node operation tool on each target recovery node, execute a node restoration task according to the backup data.
[0171] In this embodiment, specifically, the snapshot restore command is executed on each node according to the backup data through the ETCD binary file and the ETCD configuration file, that is, the restore task is executed.
[0172] S310. Restart each target recovery node to complete data recovery.
[0173] In this embodiment, after the restoration task is completed, the ETCD service of each target recovery node is started, that is, data recovery is completed, so that the node returns to a normal service state.
[0174] S311. Copy the second directory information and the operation tool to a target node according to the address information of the target recovery node.
[0175] In this step, the target recovery node includes the target node.
[0176] S312: Start the target node, and use a node operation tool on the target node to perform a node update task according to the second directory information, so that the target node is updated to restore the original node.
[0177] S313: Use the node operation tool to execute the task of adding a new node according to the second directory information.
[0178] S314: Start the newly added shared storage node to execute the node update task.
[0179] It should be noted that S313-S314 are executed in a loop until the data recovery of the shared storage service cluster is completed, that is, the number of newly created nodes reaches the preset number of nodes. Optionally, the preset number of nodes ranges from 1 to the total number of nodes in the failed shared storage service cluster. Optionally, the preset number of nodes is the number of failed nodes or the number of nodes to be recovered.
[0180] In this embodiment, specifically, a new ETCD configuration file is generated locally (i.e., a distributed system), and then the original data directory file (i.e., the second directory information) and related ETCD binary files and ETCD configuration files are copied to a node (i.e., the target node), and then the copied data (i.e., the second directory information, the ETCD binary file and the ETCD configuration file) are used to start the ETCD service program of this single node, and then the metadata information of this single node is changed through member update (i.e., the node update task) to distinguish it from the original faulty node (i.e., the node to be recovered), and then the new node information is added through member add (i.e., the new node task), and the new node is started; for more nodes, member add and the new ETCD node startup are repeated in sequence.
[0181] It should also be noted that after completing step S310 or step S314, in order to ensure that the execution of data recovery is effective and there are no logical errors or logical conflicts, and to avoid the occurrence of secondary system crashes, a cluster status self-check operation is performed before the distributed system resumes service. Optionally, a check is performed cyclically at intervals until it is confirmed that the formal recovery is completed; if the recovery is successful, a success log is returned; if the recovery fails, a failure and related step error log are returned.
[0182] This embodiment provides a data recovery method, which determines the address information and recovery mode information of the target recovery node in response to the recovery configuration instruction, then determines the target recovery data corresponding to the recovery mode information, and then copies the target recovery data and the node operation tool to the target recovery node according to the address information, so that the target recovery node completes the data recovery. The technical problem of how to quickly recover the shared storage data of the distributed system is solved. The technical effect of efficient and highly reused automatic data recovery applicable to multiple recovery modes or recovery scenarios is achieved, which saves manpower and material resources and avoids the system from being unable to be restored for a long time and causing greater economic losses.
[0183] Figure 4 The data recovery device 400 is a schematic diagram of a data recovery device provided in an embodiment of the present application. The data recovery device 400 can be implemented by software, hardware or a combination of both.
[0184] like Figure 4 As shown, the data recovery device 400 includes:
[0185] The acquisition module 401 is used to acquire the restoration configuration instruction;
[0186] A configuration module 402 is used to determine, in response to the recovery configuration instruction, address information and recovery mode information of a target recovery node, wherein the target recovery node includes some or all of the shared storage nodes in the shared storage service cluster, and the recovery mode information includes at least one recovery mode;
[0187] A recovery module 403, used to determine target recovery data corresponding to the recovery mode information;
[0188] The recovery module 403 is further configured to copy the target recovery data and the node operation tool to the target recovery node according to the address information, so that the target recovery node completes data recovery.
[0189] In a possible design, the recovery mode information includes: a first recovery mode, and the target recovery data corresponding to the first recovery mode includes: backup data backed up at a first preset time.
[0190] Optionally, the backup data includes: first shared data automatically backed up at a preset time, and second shared data manually backed up by a user at any time.
[0191] In one possible design, the recovery method information includes: a second recovery method, and the target recovery data corresponding to the second recovery method includes: normal operating data stored in the shared storage service cluster at a second preset time.
[0192] Optionally, the second preset moment includes: the last moment when the shared storage service cluster operates normally.
[0193] Optionally, the normal operation data includes: shared data stored in real time by at least one of the shared storage nodes during normal operation.
[0194] In a possible design, the shared storage service cluster includes: a first cluster that has failed, and the configuration module 402 is specifically configured to:
[0195] Determining whether the configuration instruction indicates to perform data recovery on the first cluster;
[0196] If so, at least one node to be restored on the first cluster is used as the target restoration node, and the address code and corresponding user information of the target restoration node are determined, and the node to be restored is the shared storage node that has failed;
[0197] Determine the directory information of the target recovery data according to the recovery mode information indicated by the configuration instruction;
[0198] The address information includes: the address code and the user information, and the recovery method information includes: the recovery method and the directory information.
[0199] In a possible design, the shared storage service cluster further includes: a second cluster in which no failure occurs, and the configuration module 402 is further used to:
[0200] Determining whether the configuration instruction indicates to perform data recovery on the first cluster;
[0201] If not, taking at least one shared storage node on the second cluster as the target recovery node, and determining the address code of the target recovery node and the corresponding user information;
[0202] Optionally, the configuration module 402 is further configured to:
[0203] Determining whether the second cluster has been built;
[0204] If not, creating the second cluster through a preset management tool;
[0205] If so, correspondingly, at least one shared storage node on the second cluster is used as the target recovery node, and the address code of the target recovery node and the corresponding user information are determined.
[0206] Optionally, the preset management tool includes: a containerized management tool, and the configuration module 402 is further used to:
[0207] The connection information and resource information of the container management tool are configured so that the container management tool creates and starts the second cluster according to the connection information and the resource information.
[0208] In a possible design, the recovery mode information includes: a first recovery mode and a second recovery mode, wherein the first recovery mode is to recover data using backup data, and the second recovery mode is to recover data using normal operating data stored in the shared storage service cluster, and the recovery module 403 is specifically used to:
[0209] If the recovery mode is the first recovery mode, determining the first directory information of the backup data;
[0210] If the recovery mode is the second recovery mode, the second directory information of the normal operation data is determined.
[0211] In a possible design, if the recovery mode is the first recovery mode, the recovery module 403 is further used to:
[0212] Copying the backup data and the node operation tool to each of the target recovery nodes according to each of the address information of each of the target recovery nodes and the first directory information corresponding to each of the target recovery nodes;
[0213] Using the node operation tool on each of the target recovery nodes, executing a node restoration task according to the backup data;
[0214] Restart each of the target recovery nodes to complete data recovery.
[0215] In a possible design, if the recovery mode is the second recovery mode, the recovery module 403 is further used to:
[0216] Copying the second directory information and the operation tool to a target node according to the address information, the target recovery node including the target node;
[0217] Starting the target node, and using the node operation tool on the target node to perform a node update task according to the second directory information, so that the target node is updated to restore the original node;
[0218] The node operation tool is used to cyclically execute the task of adding new nodes according to the second directory information, and the newly added shared storage node is started to execute the node update task until the data recovery of the shared storage service cluster is completed.
[0219] It is worth mentioning that Figure 4The device provided in the illustrated embodiment can execute the method provided in any of the above method embodiments. Its specific implementation principles, technical features, professional terminology explanations and technical effects are similar and will not be repeated here.
[0220] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 5 As shown, the electronic device 500 may include: at least one processor 501 and a memory 502 . Figure 5 An electronic device is shown using a processor as an example.
[0221] The memory 502 is used to store programs. Specifically, the programs may include program codes, and the program codes include computer operation instructions.
[0222] The memory 502 may include a high-speed RAM memory, and may also include a non-volatile memory, such as at least one disk memory.
[0223] The processor 501 is used to execute the computer-executable instructions stored in the memory 502 to implement the methods described in the above method embodiments.
[0224] The processor 501 may be a central processing unit (CPU), an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application.
[0225] Optionally, the memory 502 may be independent or integrated with the processor 501. When the memory 502 is a device independent of the processor 501, the electronic device 500 may further include:
[0226] The bus 503 is used to connect the processor 501 and the memory 502. The bus may be an industry standard architecture (ISA) bus, a peripheral component interconnect (PCI) bus, or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc., but it does not mean that there is only one bus or one type of bus.
[0227] Optionally, in a specific implementation, if the memory 502 and the processor 501 are integrated on a chip, the memory 502 and the processor 501 can communicate through an internal interface.
[0228] An embodiment of the present application also provides a computer-readable storage medium, which may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, and other media that can store program codes. Specifically, the computer-readable storage medium stores program instructions, and the program instructions are used for the methods in the above-mentioned method embodiments.
[0229] An embodiment of the present application further provides a computer program product, including a computer program, which implements the methods in the above-mentioned method embodiments when executed by a processor.
[0230] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the claims of the present application.
[0231] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
[0232] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A data recovery method, characterized in that: Applied to a shared storage service cluster, the shared storage service cluster includes at least one shared storage node, the method includes: In response to the recovery configuration instruction, determine the address information and recovery mode information of the target recovery node, the target recovery node includes some or all of the shared storage nodes in the shared storage service cluster, the recovery mode information includes at least one recovery mode, the recovery configuration instruction is that after the user inputs or selects the recovery mode in the control interface and sets some related configuration parameters, the distributed system automatically completes the remaining configuration parameters to form a configuration file that meets the preset requirements, and the recovery mode includes backup file recovery or local data recovery; Determining target recovery data corresponding to the recovery method information; The target recovery data and the node operation tool are copied to the target recovery node according to the address information, so that the target recovery node completes data recovery.
2. The data recovery method according to claim 1, characterized in that: The recovery mode information includes: a first recovery mode, and the target recovery data corresponding to the first recovery mode includes: backup data backed up at a first preset time.
3. The data recovery method according to claim 2, characterized in that: The backup data includes: first shared data automatically backed up at a preset time, and second shared data manually backed up by a user at any time.
4. The data recovery method according to any one of claims 1 to 3, characterized in that: The recovery mode information includes: a second recovery mode, and the target recovery data corresponding to the second recovery mode includes: normal operating data stored in the shared storage service cluster at a second preset time.
5. The data recovery method according to claim 4, characterized in that: The second preset moment includes: the last moment when the shared storage service cluster operates normally.
6. The data recovery method according to claim 4, characterized in that: The normal operating data includes: shared data stored in real time by at least one of the shared storage nodes during normal operation.
7. The data recovery method according to claim 4, characterized in that: The shared storage service cluster includes: a first cluster that has failed, and the step of determining address information and recovery mode information of a target recovery node in response to a recovery configuration instruction includes: Determining whether the configuration instruction indicates to perform data recovery on the first cluster; If so, at least one node to be restored on the first cluster is used as the target restoration node, and the address code and corresponding user information of the target restoration node are determined, and the node to be restored is the shared storage node that has failed; Determine the directory information of the target recovery data according to the recovery mode information indicated by the configuration instruction; The address information includes: the address code and the user information, and the recovery method information includes: the recovery method and the directory information.
8. The data recovery method according to claim 7, characterized in that: The shared storage service cluster further includes: a second cluster where no failure occurs, and after determining whether the configuration instruction indicates to perform data recovery on the first cluster, further includes: If not, at least one shared storage node on the second cluster is used as the target recovery node, and the address code of the target recovery node and the corresponding user information are determined.
9. The data recovery method according to claim 8, characterized in that: Before taking at least one shared storage node on the second cluster as the target recovery node, the method further includes: Determining whether the second cluster has been built; If not, creating the second cluster through a preset management tool; If so, correspondingly, at least one shared storage node on the second cluster is used as the target recovery node, and the address code of the target recovery node and the corresponding user information are determined.
10. The data recovery method according to claim 9, characterized in that: The preset management tool includes: a containerized management tool, and the creating the second cluster by using the preset management tool includes: The connection information and resource information of the container management tool are configured so that the container management tool creates and starts the second cluster according to the connection information and the resource information.
11. The data recovery method according to claim 7, characterized in that: The recovery mode information includes: a first recovery mode and a second recovery mode, wherein the first recovery mode is to recover data using backup data, and the second recovery mode is to recover data using normal operating data stored in the shared storage service cluster, and the directory information of the target recovery data is determined according to the recovery mode information indicated by the configuration instruction, including: If the recovery mode is the first recovery mode, determining the first directory information of the backup data; If the recovery mode is the second recovery mode, the second directory information of the normal operation data is determined.
12. The data recovery method according to claim 11, characterized in that: If the recovery mode is the first recovery mode, copying the target recovery data and the node operation tool to the target recovery node according to the address information so that the target recovery node completes data recovery includes: Copying the backup data and the node operation tool to each of the target recovery nodes according to each of the address information of each of the target recovery nodes and the first directory information corresponding to each of the target recovery nodes; Using the node operation tool on each of the target recovery nodes, executing a node restoration task according to the backup data; Restart each of the target recovery nodes to complete data recovery.
13. The data recovery method according to claim 11, characterized in that: If the recovery mode is the second recovery mode, copying the target recovery data and the node operation tool to the target recovery node according to the address information so that the target recovery node completes data recovery includes: Copying the second directory information and the operation tool to a target node according to the address information, the target recovery node including the target node; Starting the target node, and using the node operation tool on the target node to perform a node update task according to the second directory information, so that the target node is updated to restore the original node; The node operation tool is used to cyclically execute the task of adding new nodes according to the second directory information, and the newly added shared storage node is started to execute the node update task until the data recovery of the shared storage service cluster is completed.
14. A data recovery device, characterized in that: include: An acquisition module is used to obtain a recovery configuration instruction; a configuration module, configured to determine, in response to the recovery configuration instruction, address information and recovery mode information of a target recovery node, wherein the target recovery node includes some or all of the shared storage nodes in the shared storage service cluster, and the recovery mode information includes at least one recovery mode; A recovery module, used for determining target recovery data corresponding to the recovery mode information; The recovery module is also used to copy the target recovery data and node operation tools to the target recovery node according to the address information so that the target recovery node completes data recovery. The recovery configuration instruction is input by the user in the control interface or selects the recovery method, and after setting some related configuration parameters, the distributed system automatically completes the remaining configuration parameters to form a configuration file that meets the preset requirements. The recovery method includes backup file recovery or local data recovery.
15. An electronic device, characterized in that: include: processor and memory; wherein, The memory is used to store a computer program of the processor; The processor is configured to perform the data recovery method according to any one of claims 1 to 13 by executing the computer program.
16. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the data recovery method according to any one of claims 1 to 13 is implemented.
17. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the data recovery method according to any one of claims 1 to 13 is implemented.
Citation Information
Patent Citations
Method, apparatus and device for controlling data recovery speed
CN108958975A
Recovery method using extendible hashing-based cluster logs in shared-nothing spatial database cluster
US20060259525A1
Restoring computing environments, such as autorecovery of file systems at certain points in time
US20120254119A1
Displaying a suggested query completion within a web browser window
US8782538B1
