Disclosure of Invention
The invention aims to provide a data recovery method, a data recovery device, data recovery equipment and a data recovery medium. The total bandwidth of data recovery can be determined by determining the target recovery speed of each target disk, the cluster recovery speed is controlled according to the cluster scale, the total bandwidth of recovery data is reasonably set for clusters of different scales, the data recovery can be normally completed, meanwhile, the condition of performance waste or pressure on the front end can be avoided, and the requirements of users can be better met.
To solve the above technical problem, the present invention provides a data recovery method, including:
determining the number of target disks for completing data recovery;
determining the total bandwidth of data recovery according to the number and the preset target recovery speed of the target disk;
and setting the actual recovery speed of the target disk according to the total bandwidth so that the target disk performs data recovery according to the actual recovery speed.
Preferably, the setting, according to the total bandwidth, an actual recovery speed of the target disk so that the target disk performs data recovery according to the actual recovery speed specifically includes:
determining the proportion of the recovery data volume of each target disk to the total recovery volume;
and setting a numerical value obtained by multiplying the total bandwidth by the proportion as the actual recovery speed so as to enable the target disk to recover data according to the actual recovery speed.
Preferably, the determining the number of target disks used for completing data recovery specifically includes:
monitoring the current working state of each disk in the cluster;
and counting the number of the target disks of which the current working state is the data recovery state.
Preferably, the target recovery speed is a maximum speed of the target disk for data recovery.
Preferably, the current working state of each disk in the monitoring cluster specifically is:
and monitoring the current working state of each disk at regular time.
Preferably, the method further comprises the following steps:
judging whether each target disk completes data recovery within preset time;
and if not, performing alarm prompt.
Preferably, the method further comprises the following steps:
and updating the target recovery speed according to the received update information.
In order to solve the above technical problem, the present invention further provides a data recovery apparatus, including:
the first determining module is used for determining the number of target disks for completing data recovery;
a second determining module, configured to determine a total bandwidth of data recovery according to the number and a preset target recovery speed of the target disk;
and the setting module is used for setting the actual recovery speed of the target disk according to the total bandwidth so as to enable the target disk to recover data according to the actual recovery speed.
In order to solve the above technical problem, the present invention further provides a data recovery apparatus, including a memory for storing a computer program;
a processor for implementing the steps of the data recovery method as claimed in any one of the above when said computer program is executed.
To solve the above technical problem, the present invention further provides a computer-readable storage medium, having a computer program stored thereon, where the computer program is executed by a processor to implement the steps of the data recovery method according to any one of the above.
The invention provides a data recovery method, which comprises the following steps: determining the number of target disks for completing data recovery; determining the total bandwidth of data recovery according to the number and the preset target recovery speed of the target disk; and setting the actual recovery speed of the target disk according to the total bandwidth so that the target disk recovers data according to the actual recovery speed. Therefore, the total bandwidth of data recovery is determined by determining the target recovery speed of each target disk, the cluster recovery speed is controlled according to the cluster scale, and performance waste caused by a cluster with an overlarge scale and pressure on the front end caused by a cluster with a smaller scale are avoided. Therefore, the invention can reasonably set the total bandwidth of the recovery data for the clusters with different scales, can ensure that the data recovery is normally completed, can avoid the condition of performance waste or pressure on the front end, and better meets the requirements of users.
In addition, the data recovery device, the equipment and the medium provided by the invention correspond to the method and have the same beneficial effects.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present invention without any creative work belong to the protection scope of the present invention.
The core of the invention is to provide a data recovery method, a device, equipment and a medium. The total bandwidth of data recovery can be determined by determining the target recovery speed of each target disk, the cluster recovery speed is controlled according to the cluster scale, the total bandwidth of recovery data is reasonably set for clusters of different scales, the data recovery can be normally completed, meanwhile, the condition of performance waste or pressure on the front end can be avoided, and the requirements of users can be better met.
In order that those skilled in the art will better understand the disclosure, the invention will be described in further detail with reference to the accompanying drawings and specific embodiments.
Fig. 1 is a flowchart of a data recovery method according to an embodiment of the present invention; as shown in fig. 1, a data recovery method provided in an embodiment of the present invention includes steps S101 to S103:
step S101: determining the number of target disks for completing data recovery;
in one embodiment, the number of target disks of all disks of the cluster used to complete data recovery is first determined. The target disk provided by the invention refers to a disk for completing data recovery, and is distinguished from other disks through different names.
Specifically, determining the number of target disks for completing data recovery specifically includes:
monitoring the current working state of each disk in the cluster;
and counting the number of the target disks of which the current working state is the data recovery state.
In specific implementation, the current working state of the disks under each node in the cluster is monitored, all the disks are traversed, whether the current working state of the disks is the data recovery state is judged, if yes, the disks are determined to be target disks, one is added to the number of the counted target disks, and the number of the target disks is counted until all the disks are traversed.
In one embodiment, the current working state of each disk in the cluster can be monitored in a mode of regularly monitoring the current working state of each disk; the method can also be a mode for monitoring the current working state of each disk in real time. For clusters with frequent structural changes, the method is more suitable for real-time monitoring, and is convenient for updating the current state of the disk in time; and for the cluster with a more stable cluster structure, the method is more suitable for a timing monitoring mode. It should be noted that, a person skilled in the art may determine the monitoring mode according to the actual application situation, and the embodiment of the present invention is not limited.
Step S102: determining the total bandwidth of data recovery according to the number and the preset target recovery speed of the target disk;
in one embodiment, the total bandwidth for data recovery may be determined based on the counted number of target disks and a preset target recovery speed. Specifically, the sum of the target recovery speeds of the target disks is the total bandwidth of data recovery, that is, the total bandwidth is obtained by multiplying the number of the target disks by the target recovery speed. In a specific implementation, the preset target recovery speed may be a maximum speed of the target disk for data recovery, so as to provide resources for data recovery as much as possible on the premise of not affecting front-end access to the disk. It should be noted that, a person skilled in the art may preset the target recovery speed according to the actual application situation, and the embodiment of the present invention is not limited.
Step S103: and setting the actual recovery speed of the target disk according to the total bandwidth so that the target disk recovers data according to the actual recovery speed.
In one embodiment, the actual recovery speed of the target disk may be set according to the calculated total bandwidth of the cluster recovery data.
Further, setting the actual recovery speed of the target disk according to the total bandwidth so that the target disk performs data recovery according to the actual recovery speed specifically includes:
determining the proportion of the recovery data volume of each target disk to the total recovery volume;
and setting the value obtained by multiplying the total bandwidth by the proportion as the actual recovery speed so that the target disk performs data recovery according to the actual recovery speed.
It can be understood that the recovery data amount of the target disk is specifically preset, and a ratio of the recovery data amount of each target disk to the total recovery amount of the cluster that needs to recover the data is calculated. The total bandwidth is allocated to each target disk according to the ratio. And setting a numerical value obtained by multiplying the total bandwidth by the proportion as an actual recovery speed, and enabling each target disk to recover data according to the respective set actual recovery speed. Therefore, the actual recovery speed is proportionally distributed according to the data recovery amounts of different target disks, so that the target disks with different data recovery amounts can simultaneously complete the data recovery task, the situation that the recovery time of the whole cluster is prolonged due to the fact that the data recovery amounts of part of the target disks are large is avoided, and time resources are greatly saved.
The invention provides a data recovery method, which comprises the following steps: determining the number of target disks for completing data recovery; determining the total bandwidth of data recovery according to the number and the preset target recovery speed of the target disk; and setting the actual recovery speed of the target disk according to the total bandwidth so that the target disk recovers data according to the actual recovery speed. Therefore, the total bandwidth of data recovery is determined by determining the target recovery speed of each target disk, the cluster recovery speed is controlled according to the cluster scale, and performance waste caused by a cluster with an overlarge scale and pressure on the front end caused by a cluster with a smaller scale are avoided. Therefore, the invention can reasonably set the total bandwidth of the recovery data for the clusters with different scales, can ensure that the data recovery is normally completed, can avoid the condition of performance waste or pressure on the front end, and better meets the requirements of users.
In an embodiment, the data recovery method provided in the embodiment of the present invention further includes:
judging whether each target disk completes data recovery within preset time;
and if not, performing alarm prompt.
Specifically, in order to prevent a part of the disks from failing to recover data normally due to failure, whether each target disk completes data recovery within a preset time can be judged; that is, when the preset time is over, whether each target disk is still in the data recovery state is judged, if yes, the data recovery is not completed, it can be determined that the target disk has abnormal recovery data, an alarm prompt can be performed accordingly, and the abnormal condition is timely notified to the staff, so that the staff can conveniently process the data, and the data recovery work is prevented from being influenced. It should be noted that the preset time provided in the embodiment of the present invention is specifically the recovery time required by the target disk in the cluster to complete the same data recovery amount under a general condition, and a person skilled in the art may correspondingly determine the preset time according to an actual application condition, which is not limited in the embodiment of the present invention.
In an embodiment, the data recovery method provided in the embodiment of the present invention further includes:
and updating the target recovery speed according to the received update information.
Specifically, when the cluster structure changes in expansion or contraction, the set target recovery rate needs to be changed accordingly. The target recovery speed can be correspondingly updated according to the received update information, so that the set target recovery speed is adaptive to the current cluster structure, and the adaptability of the data recovery method provided by the embodiment of the invention is improved.
The invention also provides a data recovery device and a corresponding embodiment of data recovery equipment. It should be noted that the present invention describes the embodiments from two perspectives, one is based on the functional module, and the other is based on the hardware.
Fig. 2 is a structural diagram of a data recovery apparatus according to an embodiment of the present invention; as shown in fig. 2, a data recovery apparatus provided in an embodiment of the present invention includes:
a first determining module 10, configured to determine the number of target disks for completing data recovery;
a second determining module 11, configured to determine a total bandwidth of data recovery according to the number and a preset target recovery speed of the target disk;
and a setting module 12, configured to set an actual recovery speed of the target disk according to the total bandwidth, so that the target disk performs data recovery according to the actual recovery speed.
The data recovery device provided by the embodiment of the invention further comprises:
the judging module is used for judging whether each target disk completes data recovery within preset time; and if not, performing alarm prompt.
And the updating module is used for updating the target recovery speed according to the received updating information.
Since the embodiments of this section correspond to the embodiments of the method section, reference is made to the description of the embodiments of the method section for the embodiments of this section, and details are not repeated here.
The invention provides a data recovery device, comprising: determining the number of target disks for completing data recovery; determining the total bandwidth of data recovery according to the number and the preset target recovery speed of the target disk; and setting the actual recovery speed of the target disk according to the total bandwidth so that the target disk recovers data according to the actual recovery speed. Therefore, the total bandwidth of data recovery is determined by determining the target recovery speed of each target disk, the cluster recovery speed is controlled according to the cluster scale, and performance waste caused by a cluster with an overlarge scale and pressure on the front end caused by a cluster with a smaller scale are avoided. Therefore, the invention can reasonably set the total bandwidth of the recovery data for the clusters with different scales, can ensure that the data recovery is normally completed, can avoid the condition of performance waste or pressure on the front end, and better meets the requirements of users.
Fig. 3 is a structural diagram of a data recovery apparatus according to an embodiment of the present invention; as shown in fig. 3, a data recovery apparatus according to an embodiment of the present invention includes a memory 20 for storing a computer program;
a processor 21 for implementing the steps of the data recovery method as described in any one of the above when executing the computer program.
The processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and the like. The processor 21 may be implemented in at least one hardware form of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), and a PLA (Programmable Logic Array). The processor 21 may also include a main processor and a coprocessor, where the main processor is a processor for processing data in an awake state, and is also called a Central Processing Unit (CPU); a coprocessor is a low power processor for processing data in a standby state. In some embodiments, the processor 21 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content required to be displayed on the display screen. In some embodiments, the processor 21 may further include an AI (Artificial Intelligence) processor for processing a calculation operation related to machine learning.
The memory 20 may include one or more computer-readable storage media, which may be non-transitory. Memory 20 may also include high speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In this embodiment, the memory 20 is at least used for storing the following computer program 201, wherein after being loaded and executed by the processor 21, the computer program can implement the relevant steps in the data recovery method disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 20 may also include an operating system 202, data 203, and the like, and the storage manner may be a transient storage manner or a permanent storage manner. Operating system 202 may include, among others, Windows, Unix, Linux, and the like.
In some embodiments, the data recovery device may further include an input/output interface 22, a communication interface 23, a power supply 24, and a communication bus 25.
Those skilled in the art will appreciate that the configuration shown in FIG. 3 does not constitute a limitation of a data recovery device and may include more or fewer components than those shown.
Since the embodiments of this section correspond to the embodiments of the method section, reference is made to the description of the embodiments of the method section for the embodiments of this section, and details are not repeated here. In some embodiments of the invention, the processor and memory may be connected by a bus or other means.
The data recovery device provided by the invention can realize the following method: determining the number of target disks for completing data recovery; determining the total bandwidth of data recovery according to the number and the preset target recovery speed of the target disk; and setting the actual recovery speed of the target disk according to the total bandwidth so that the target disk recovers data according to the actual recovery speed. Therefore, the total bandwidth of data recovery is determined by determining the target recovery speed of each target disk, the cluster recovery speed is controlled according to the cluster scale, and performance waste caused by a cluster with an overlarge scale and pressure on the front end caused by a cluster with a smaller scale are avoided. Therefore, the invention can reasonably set the total bandwidth of the recovery data for the clusters with different scales, can ensure that the data recovery is normally completed, can avoid the condition of performance waste or pressure on the front end, and better meets the requirements of users.
Finally, the invention also provides a corresponding embodiment of the computer readable storage medium. The computer-readable storage medium has stored thereon a computer program which, when being executed by a processor, carries out the steps as set forth in the above-mentioned method embodiments.
It is to be understood that if the method in the above embodiments is implemented in the form of software functional units and sold or used as a stand-alone product, it can be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and performs all or part of the steps of the methods according to the embodiments of the present invention, or all or part of the technical solution. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The data recovery method, apparatus, device and medium provided by the present invention are described in detail above. The embodiments are described in a progressive manner in the specification, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description. It should be noted that, for those skilled in the art, it is possible to make various improvements and modifications to the present invention without departing from the principle of the present invention, and those improvements and modifications also fall within the scope of the claims of the present invention.
It is further noted that, in the present specification, relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.