CN105302671A - Automatic backup and rollback method and device - Google Patents
Automatic backup and rollback method and device Download PDFInfo
- Publication number
- CN105302671A CN105302671A CN201510766304.3A CN201510766304A CN105302671A CN 105302671 A CN105302671 A CN 105302671A CN 201510766304 A CN201510766304 A CN 201510766304A CN 105302671 A CN105302671 A CN 105302671A
- Authority
- CN
- China
- Prior art keywords
- file
- backup
- restored
- backed
- path
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention provides an application program backup and rollback method and device. An executive user only needs to set an input parameter set in advance. In the actual backup and rollback processes, the executive user only needs to issue an application program backup or rollback instruction, and other processes do not need to be executed. All the backup or rollback processes are automatically executed, and accordingly rollback accuracy and backup efficiency can be improved.
Description
Technical field
The application relates to networking technology area, particularly relates to robotization backup, backing method and device.
Background technology
Data backup is very important for the O&M of data center, has applied various product at present and can realize system-level data backup, as: operating system backup, DB Backup etc.These backup modes to ensure data center data security, realize fast failure recover play vital effect.
But, these traditional system level data backup modes at present, the Application Backup of more flexile, the fine-grained application layer of the demand that cannot be applied to.Also do not have corresponding application layer to back up and rollback instrument at present, so the system operation maintenance personnel of data center generally adopts manual fill order mode at present, carry out Application Backup and rollback.
But adopt manual fill order mode, automaticity is not high, be limited to the knowledge hierarchy of operator and on-the-spot adaptability to changes, execution efficiency is lower.When version rollback, the emergent requirement of resuming production fast cannot be met, in addition, too increase manually-operated risk to a certain extent.
Therefore, a kind of method realizing general application program robotization backup and rollback is needed now, to improve accuracy rate and the efficiency of Application Backup and rollback.
Summary of the invention
This application provides robotization backup, backing method and device, use the application can improve the accuracy rate of Application Backup and rollback, efficiency and security.
To achieve these goals, this application provides following technological means:
A kind of robotization backup method, comprising:
Receive Application Backup instruction, generate BACKUP TIME stamp;
Under the target backup path that input parameter set comprises, create in file name the backup file folder comprising described BACKUP TIME stamp;
According to one or two listed files that described input parameter set comprises, determine set of paths to be backed up; Wherein, described set of paths to be backed up comprises the absolute path of each file to be backed up, the corresponding file to be backed up of each absolute path;
By the file to be backed up in described set of paths to be backed up corresponding to each absolute path, be copied in described backup file folder.
Preferably, also comprise:
Compress described backup file folder and obtain backup file folder compressed package, and will the file name of described BACKUP TIME stamp be comprised by default name form, be defined as the title of described backup file folder compressed package.
Preferably, also comprise:
Under the preset path reaching file server is wrapped in the contracting of described backup file cramping; Wherein, described input parameter set comprises described folder service device IP, port and described preset path.
Preferably, also comprise:
According to the half-cooked one-tenth check code of described backup file;
By one or two listed files described, the size summation of all files to be backed up, described BACKUP TIME stamp and described check code, be stored in verification file; Wherein, the Folder Name of described verification file is consistent with the Folder Name that described backup file presss from both sides compressed package.
Preferably, also comprise:
Under described verification file being uploaded to the preset path of file server; Wherein, described input parameter set comprises described folder service device IP and described preset path.
Preferably, comprise backup file list in described input parameter set, do not comprise get rid of listed files, described one or two listed files comprised according to described input parameter set determines set of paths to be backed up, specifically comprise: by all absolute path in described backup file list, be defined as described set of paths to be backed up;
When described input parameter set not only comprised backup file list but also comprise get rid of listed files, described one or two listed files comprised according to described input parameter set determines set of paths to be backed up, specifically comprise: by all absolute path of described backup file list, remove the residue absolute path after all absolute path of described eliminating listed files, be defined as described set of paths to be backed up.
Preferably, before the instruction of reception Application Backup, also comprise:
Check the legitimacy of described input parameter set.
Preferably, for the target backup path of described input parameter set, described in check that the legitimacy of described input parameter set specifically comprises: check whether described target backup path exists, if do not exist, reports an error; Check whether the execution user issuing Application Backup instruction possesses the authority reading described target backup path, if do not exist, reports an error; Check space utilization rate and the remaining space of described target backup path place file system, if space utilization rate exceedes preset ratio or remaining space is less than default value, report an error;
For the described backup file list of described input parameter set, described in check that the legitimacy of described input parameter set specifically comprises: check that in described backup file list, whether each absolute path exists, if do not exist, reports an error; Check whether the execution user issuing Application Backup instruction possesses the authority of each absolute path in the described backup file list of read-write, if do not have, reports an error;
For the described eliminating listed files of described input parameter set, describedly check that the legitimacy of described input parameter set specifically comprises: check the file that in described eliminating listed files, each absolute path is corresponding, the son file of a file to be backed up whether corresponding to described backup file list, if not then report an error; Calculate the size summation of all files to be backed up according to described backup file list and described eliminating listed files, if the size summation of all files to be backed up is greater than described remaining space, then report an error.
Preferably, described by the file to be backed up in described set of paths to be backed up corresponding to each absolute path, be copied in described backup file folder, comprise:
By file to be backed up corresponding for each absolute path in described set of paths to be backed up, to remove the mode of the relative path of root directory, be copied in described backup file folder.
A kind of robotization backing method, comprising:
Receive application program back-off instruction, generate Backoff time stamp;
Under the target backup path that input parameter set comprises, create the back space file folder that file name comprises described Backoff time stamp;
According to described application program back-off instruction, determine timestamp to be restored;
According to described timestamp to be restored, search and obtain the to be restored file set corresponding with timestamp to be restored;
Described file set to be restored meet pre-conditioned under, described file set to be restored is stored to described back space file folder in;
By the file each to be restored in described file set to be restored, under one_to_one corresponding is copied to the absolute path in backup file list.
Preferably, describedly determine timestamp to be restored according to described application program back-off instruction, comprising:
If comprise a BACKUP TIME stamp in described application program back-off instruction, then this BACKUP TIME stamp is defined as described timestamp to be restored;
If described application program back-off instruction does not comprise a BACKUP TIME stamp, then will perform the BACKUP TIME stamp of backup operation for the last time, be defined as described timestamp to be restored.
Preferably, described according to described timestamp to be restored, search and obtain the to be restored file set corresponding with timestamp to be restored, comprising:
Utilizing described timestamp to be restored, building by presetting name form the file name that backup file presss from both sides compressed package;
Under described target backup path, search the backup file corresponding with described file name press from both sides compressed package;
If find, then by this backup file folder compressed package, be defined as described file set to be restored;
If do not find, then under the absolute path of folder service device, search the backup file corresponding with described file name press from both sides compressed package;
If find, then by this backup file folder compressed package, be defined as described file set to be restored.
Preferably, also comprise:
Obtain the verification file corresponding with timestamp to be restored;
Then described file set to be restored meets pre-conditioned deterministic process and comprises:
Utilize described verification file, verify that whether described file set to be restored is correct;
If file set to be restored is correct, then determine to meet pre-conditioned.
Preferably, by the file each to be restored in described file set to be restored, one_to_one corresponding also comprises before being copied under the absolute path in backup file list:
According to the backup file list that described input parameter set comprises, one by one by the file to be covered corresponding to absolute path each in backup file list, move in described back space file folder.
A kind of robotization back-up device, comprising:
First receiving element, for receiving Application Backup instruction, generates BACKUP TIME stamp;
First creating unit, under the target backup path that comprises in input parameter set, creates in file name the backup file folder comprising described BACKUP TIME stamp;
First determining unit, for one or two listed files comprised according to described input parameter set, determines set of paths to be backed up; Wherein, described set of paths to be backed up comprises the absolute path of each file to be backed up, the corresponding file to be backed up of each absolute path;
First copy cell, for by the file to be backed up in described set of paths to be backed up corresponding to each absolute path, is copied in described backup file folder.
A kind of robotization backspace mechanism, comprising:
Second receiving element, receives application program back-off instruction, generates Backoff time stamp;
Second creating unit, under the target backup path that comprises in input parameter set, creates the back space file folder that file name comprises described Backoff time stamp;
Second determining unit, for according to described application program back-off instruction, determines timestamp to be restored;
Search unit, for according to described timestamp to be restored, search and obtain the to be restored file set corresponding with timestamp to be restored;
Storage unit, for meet at described file set to be restored pre-conditioned under, described file set to be restored is stored to described back space file folder in;
Second copy cell, for by the file each to be restored in described file set to be restored, under one_to_one corresponding is copied to the absolute path in backup file list.
From above technology contents, can find out that the application has following beneficial effect:
The application can realize the Application Backup of application layer, and, robotization backup and robotization rollback can be realized, back up relative to manually realizing and for rollback, greatly can improve accuracy rate and the efficiency of Application Backup and rollback.
Accompanying drawing explanation
In order to be illustrated more clearly in the embodiment of the present application or technical scheme of the prior art, be briefly described to the accompanying drawing used required in embodiment or description of the prior art below, apparently, accompanying drawing in the following describes is only some embodiments of the application, for those of ordinary skill in the art, under the prerequisite not paying creative work, other accompanying drawing can also be obtained according to these accompanying drawings.
The structural representation of Fig. 1 a kind of application program system disclosed in the embodiment of the present application;
The process flow diagram of Fig. 2 a kind of robotization backup method disclosed in the embodiment of the present application;
The process flow diagram of Fig. 3 a kind of robotization backing method disclosed in the embodiment of the present application;
The structural representation of Fig. 4 a kind of robotization back-up device disclosed in the embodiment of the present application;
The structural representation of Fig. 5 a kind of robotization backspace mechanism disclosed in the embodiment of the present application.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present application, be clearly and completely described the technical scheme in the embodiment of the present application, obviously, described embodiment is only some embodiments of the present application, instead of whole embodiments.Based on the embodiment in the application, those of ordinary skill in the art are not making the every other embodiment obtained under creative work prerequisite, all belong to the scope of the application's protection.
As shown in Figure 1, this application provides a kind of application program system, comprising multiple main frame 100, the file server 200 be connected with described multiple main frame.Each main frame 100 runs and has diversified application program.The object of the application is for the application program on main frame, realizes backup and the rollback of application program.
Each main frame can have multiple execution user, and different execution users has different operating rights.Such as, some perform user and have the authority reading certain some file, and other perform user and do not have the authority reading some file.The object of the application is the backup and the rollback that realize application program on main frame.
The process each main frame performing application backup and rollback is all consistent, so the application is only described in detail with the backup of a main frame in multiple main frame and back off procedure; The executive utility backup of other main frame and the process of rollback, consistent with the mode that the application provides, do not repeat them here.
After Application Backup, can the rollback of executive utility.Therefore, the implementation of Application Backup is first introduced.
Before Application Backup, first perform initialization procedure.Need to determine input parameter set in initialization procedure, and check the legitimacy of input parameter set.
First the process determining input parameter set is introduced:
A, determine the target backup path of backup result file set.
The process of Application Backup is: by all file copy to be backed up under target backup path, and the file to be backed up after copying is called backup result file.
B, determine all files to be backed up, and using the absolute path of all files to be backed up as backup file list.
Perform user and can determine all files to be backed up in main frame, and by the absolute path of all files to be backed up, be stored in backup file list.So, the corresponding file to be backed up of each absolute path in backup file list.
C, determine get rid of listed files
The discarded record (as: daily record, temporary file) that application system has, if backup discarded record, then causes the wasting of resources.Therefore, eliminating listed files can being set, for getting rid of the discarded record comprised in backup file list, to reduce, non-essential file being backed up.
Get rid of that listed files mainly carries out arranging for backup file list, therefore, get rid of the eliminating listed files set in listed files, a son file being decided to be file to be backed up, otherwise nonsensical.For the robustness of guarantee procedure, if be provided with the file that non-existent file or backup file list do not comprise, then program can carry out the prompting that reports an error, but does not affect program and normally perform.
D, enactment document server ip address, port and preset path
After completion of the back-up, can obtain backup result file, main frame can storage backup destination file in this locality.If backup result file is too much, main frame can upload backup result file to file server, so that backup result file is deposited in strange land on file server.
Upload at main frame in the process of backup result file, main frame can pass through port, by the files passe to be backed up file server corresponding with IP address, and under being stored in the preset path of file server.Therefore, the IP address of file server, port, backup path can be set in input parameter.
Be understandable that, the object of Application Backup is: by all files to be backed up, stores from a path copies to another path, to realize the object backed up.So target backup path, backup file list are mandatory parameters in input parameter set, eliminating listed files and file server IP address, port and preset path are optional parameter.
Introduce the process of checking the legitimacy of input parameter set below:
A, validity checking for target backup path
For target backup path, perform the inspection of three aspects below:
The first, check whether target backup path exists, if do not exist, reports an error.
Target backup path is the position for storage backup destination file performing user's selection, if target backup path does not exist, illustrates that road sign backup path fills in mistake, therefore reports an error, and performs ownership goal backup path mistake to remind.If exist, then allow to perform user and continue to perform subsequent process.
The second, check that whether perform user possesses the authority reading described target backup path, if do not exist, reports an error.
Main frame has different execution users, the authority of different execution user is inconsistent.Therefore, main frame can check the execution user that executive utility backs up, and whether has the authority reading target backup path, if do not have, then cannot the process of executive utility backup, and therefore, program reports an error.If have, then allow to perform user and continue to perform subsequent process.
3rd, check space utilization rate and the remaining space of described target backup path place file system, if space utilization rate exceedes preset ratio or remaining space is less than default value, report an error.
When the control utilization rate of target backup path place file system is less than preset ratio, or remaining space is less than default value, then now surplus resources is less to represent file system, and for ensureing the robustness of program, program reports an error and exits.
In actual applications, preset ratio can be 75%, and default value can be 2G.Certainly, the detailed process of preset ratio and default value can be determined as the case may be, does not limit at this.
B, validity checking for backup file list.
For backup file list, perform the inspection of three aspects below:
The first, check that in described backup file list, whether each absolute path exists, if do not exist, reports an error.
Main frame checks whether each absolute path of backup file list exists item by item, if do not exist, represents that this absolute path goes wrong, therefore reports an error; If all exist, then illustrate that each absolute path is correct, therefore, can continue to perform subsequent process.
The second, check and perform the authority whether user possesses each absolute path in the described backup file list of read-write, if do not have, report an error.
Main frame checks whether perform user has access limit to each absolute path that backup file list has one by one, if do not had, then cannot executive utility backup procedure, and therefore report an error; If have, then subsequent process can be performed.
C, the validity checking got rid of in listed files.
Following two inspections are performed for eliminating listed files:
The first, check the file that in described eliminating listed files, each absolute path is corresponding, the son file of a file to be backed up whether corresponding to described backup file list, if not then report an error.
Owing to getting rid of acting as of listed files, discarded record in backup file list is got rid of, so the file that in eliminating listed files, each absolute path is corresponding should be the son file of a file to be backed up.Therefore, each absolute path is corresponding in listed files the file whether son file of file to be backed up listed by backup file list is got rid of in main frame inspection, if not, represent that getting rid of listed files does not meet code requirement, therefore report an error prompting, but do not affect subsequent step execution.
The second, calculate the size summation of file to be backed up, check whether the size summation of file to be backed up is less than the remaining space in file destination path.
Because eliminating listed files is optional parameter, therefore, when performing user and not setting eliminating listed files, the file that in backup file list, each absolute path is corresponding, is all files to be backed up.Now directly calculate the size of the file to be backed up that all absolute path are corresponding in backup file list, after the size addition of each file to be backed up, obtain the size summation of all files to be backed up.
After execution user selects to get rid of listed files, by file corresponding for target backup file, after removal eliminating listed files is corresponding, remaining file is defined as file to be backed up.By the size summation of all files to be backed up, as the size summation of file to be backed up.
Be understandable that, target backup path must have sufficient space can store all files to be backed up; So the remaining space of target backup path place file system must be greater than the size summation of all files to be backed up, and like this, all files to be backed up then can be stored in target backup path; Otherwise target backup path then cannot store all files to be backed up.
After execution backup initialization process, introduce the detailed process of Application Backup below.As shown in Figure 2, specifically comprise:
Step S201: receive Application Backup instruction, generates BACKUP TIME stamp.
Perform user and can send Application Backup instruction to main frame, main frame can obtain current time, and stab as BACKUP TIME using current time after receiving Application Backup instruction.
The form of BACKUP TIME stamp can be: yyyymmddHHMMSS.Wherein, the yyyy expression of years (as 2015), mm represents month (as October), and dd represents the date (as 01 day), and HHMMSS represents Hour Minute Second (as 120000 represent 12:00:00).
Due to may to the carrying out of identical file repeatedly, but certainly, the time of repeatedly backing up be inconsistent certainly.So the application is to back up timestamp, distinguish the backup result file in multiple backup procedure.
Step S202: under the target backup path that input parameter set comprises, creates in file name the backup file folder comprising described BACKUP TIME stamp.
Comprise target backup path in input parameter set, target backup path is used for storage backup destination file, and backup result file is the file to be backed up after copying.In order to distinguish the backup result file in multiple backup procedure, build the file name of backup file folder with the BACKUP TIME stamp in step S201.
Such as, can adopt programbak and BACKUP TIME stab both combination, as backup file folder title.Wherein, programbak represents the meaning of Application Backup, and BACKUP TIME stamp represents with yyyymmddHHMMSS.So, the file name of backup file folder can be: programbak_yyyymmddHHMMSS.
Step S203: one or two listed files comprised according to described input parameter set, determines set of paths to be backed up; Wherein, described set of paths to be backed up comprises the absolute path of each file to be backed up, the corresponding file to be backed up of each absolute path.
This step can have Liang Zhong branch:
First branch: comprise backup file list in described input parameter set, do not comprise get rid of listed files, by all absolute path in described backup file list, be defined as described set of paths to be backed up.
When not getting rid of listed files, the file that in backup file list, each absolute path is corresponding is file to be backed up.Therefore, absolute path all in backup file list are defined as set of paths to be backed up.
Second branch: when described input parameter set not only comprised backup file list but also comprise get rid of listed files, by in all absolute path corresponding for described backup file list, remove the residue absolute path after all absolute path corresponding to described eliminating listed files, be defined as described set of paths to be backed up.
When input parameter set comprises eliminating listed files, namely illustrate that the file that in backup file list, some absolute path is corresponding is not file to be backed up.Therefore, in all absolute path of backup file list, remove and get rid of all absolute path of listed files, file corresponding to remaining absolute path is file to be backed up.Therefore, by all absolute path corresponding for described backup file list, remove the residue absolute path after all absolute path corresponding to described eliminating listed files, be defined as described set of paths to be backed up.
Step S204: by the file to be backed up in described set of paths to be backed up corresponding to each absolute path, is copied in described backup file folder.
After determining set of paths to be backed up, by file to be backed up corresponding for absolute path each in set of paths to be backed up, be all copied in backup file folder, thus realize the object of application programs backup.The file to be backed up be copied in backup file folder is called backup result file.
If backup result file is to store with root directory (i.e. absolute path) in backup file folder, then, when rollback backup result file, there is the risk covering original file to be backed up by absolute path.And overlapping operation is as deletion action, be can not rollback, very risky; Therefore, backup file folder in backup result file can adopt remove root directory "/" mode, by relative path be stored in backup file folder in.
Because backup result file generally takies larger space, in order to reduce the storage space of backup result file, generally backup file being clamped and shortening compressed package into, utilizing the form of compressed package to be stored on main frame.Namely main frame both can to have backed up the form storage backup destination file of file, can also to back up the form storage backup destination file of file compressed package.
Along with the increase of backup number of times, the backup file that main frame stores folder is more and more.This can have a strong impact on travelling speed and the efficiency of main frame, and after main frame damages, backup file folder also can disappear thereupon, and this also can have an impact to the security of backup file folder.For this reason, the backup file folder on main frame regularly can be uploaded to file server, to realize the object of strange land storage backup file by the application.
Because file server is connected with each main frame, in order to distinguish the backup file folder on each main frame, can on main frame, name for each backup file presss from both sides with Hostname and BACKUP TIME stamp, to be uploaded to after on file server, file server can be distinguished the backup file folder of each main frame.In like manner, on folder service device, also can store with the form backing up file compressed package.
By above introduction, the application's storage backup destination file can be found out, following four kinds of modes can be adopted:
First kind of way: store in the mode backing up file in main frame this locality, at least comprises BACKUP TIME stamp in file name.
The second way: store in the mode of main frame local backup file compressed package, at least comprises BACKUP TIME stamp in file name.
In first kind of way and the second way, backup result file only stores in main frame this locality, and namely all on this main frame backup result files, are all stored in main frame this locality.So, at least comprise BACKUP TIME stamp in backup file folder or backup file folder compressed package.Main frame can be backup file folder or the name of backup file folder compressed package according to default name form.
Such as, presetting name form can be: because there is multiple execution user this ground of main frame, therefore, and the file name of backup file folder and backup file folder compressed package can adopt: the combination of programbak, username and BACKUP TIME stamp represents.Such as, file name can be programbak_username_yyyymmddHHMMSS.Wherein, programbak, represents the meaning of Application Backup; Username, represents and performs user, for distinguishing different user on same main frame; YyyymmddHHMMSS, represents BACKUP TIME stamp, can be as accurate as second.
The third mode: store in the mode backing up file at file server, at least comprises Hostname and BACKUP TIME stamp in file name.
4th kind of mode: store in the mode backing up file compressed package at file server, at least comprises Hostname and BACKUP TIME stamp in file name.
In the third mode and the 4th kind of mode, backup result file, after main frame stores, regularly can be uploaded to file server.In order to distinguish the backup file folder on each main frame on file server, so at least comprise Hostname and BACKUP TIME stamp in file name.Main frame can be backup file folder or the name of backup file folder compressed package according to default name form.
Such as, presetting name form can be: owing to main frame having multiple execution user, performs user to distinguish each further, and the combination of programbak, hostname, username and BACKUP TIME stamp can be adopted to represent.As programbak_hostname_username_yyyymmddHHMMSS.Wherein, programbak, represents the meaning of Application Backup; Hostname, represents Hostname, for distinguishing the backup file folder on different main frame; Username, represents and performs user, for distinguishing different user on same main frame; YyyymmddHHMMSS, represents BACKUP TIME stamp, can be as accurate as second.
Described folder service device IP, port and preset path is comprised in input parameter set.Main frame uploads the concrete implementation of backup file folder compressed package (or backup file folder) to file server, can be: main frame is that file server performed in input parameter set connects by port and IP address, then, backup file is pressed from both sides compressed package (or backup file folder) to be uploaded on file server, and under being stored in the preset path of file server.
Can find out that the application has following beneficial effect from above technology contents:
Perform user in the application only to need to pre-set input parameter set, in actual backup procedure, performing user only needs to issue Application Backup instruction.Without the need to performing other process, all backup procedures are all automated executions, therefore can improve backup accuracy rate and backup efficiency.
In order to carry out legitimacy verification to backup result file, and provide necessary authorization information for rollback operation; After backup operation completes, can according to the half-cooked one-tenth check code of backup file, such as, MD5 code.
Then by described one or two listed files (backup file list, or, backup file list and get rid of listed files), the size summation of backup result file, described BACKUP TIME stamp and described check code, be stored in verification file as check information; Wherein, the Folder Name of described verification file is consistent with the Folder Name that described backup file presss from both sides compressed package (or backup file folder).
When comprising eliminating listed files in input parameter set, one or two listing file is backup file list and gets rid of listed files; When not comprising eliminating listed files in input parameter set, one or two listing file is backup file list.
Such as, see in the step explanation of step S204, when the file name of backup file folder compressed package (or backup file folder) is: during programbak_hostname_username_yyyymmddHHMMSS, the name of verification file is called: programbak_hostname_username_yyyymmddHHMMSS.Just, the suffix of verification file is .cfg, for representing that verification file is a kind of configuration file.
The object that verification file and backup file press from both sides the file name of compressed package consistent is, using the related information of identical file name as both, so that machine can identify that the verification file that same backup file presss from both sides and backup file press from both sides compressed package.
In addition, main frame is accumulated at local file system to prevent useless journal file, can clear up according to cleaning cycle cleaning to execution journal backup result file, intermediate file; To clear up the memory headroom of main frame.
Foregoing is the detailed process that main frame realizes Application Backup, introduces the concrete implementation of application program rollback below.The back off procedure that the application provides, for based on based on the backup procedure performed shown in above-mentioned Fig. 2, after pressing the backup of the step executive utility shown in Fig. 2, the application program rollback that can perform according to following process.
As shown in Figure 3, this application provides a kind of robotization backing method, specifically comprise the following steps:
Step S301: receive application program back-off instruction, generates Backoff time stamp.
Perform user and can send application program back-off instruction to main frame, main frame can obtain current time, and stab as Backoff time using current time after receiving application program back-off instruction.
It is consistent that the form that Backoff time stabs and BACKUP TIME stab form, do not repeat them here.
Step S302: under the target backup path that input parameter set comprises, creates the back space file folder that file name comprises described Backoff time stamp.
In order to distinguish in multiple back off procedure, build file name with the Backoff time stamp in step S301; And create back space file folder with the file name comprising Backoff time stamp.
Such as, the combination that programrec and Backoff time stab can be adopted, as the file name of back space file folder.Wherein, programrec represents the meaning of application program rollback, and Backoff time stamp represents with yyyymmddHHMMSS.So, the file name of back space file folder can be: programbak_yyyymmddHHMMSS.
Step S303: determine timestamp to be restored according to described application program back-off instruction.
The object of rollback for: by the backup result file of process backup pressed shown in Fig. 2, be back in absolute path corresponding to original file to be backed up by same path.Such as, file A from absolute path A, is obtained file B by backup procedure under copying to absolute path B; So, back off procedure is the file B under absolute path B, then under copying to absolute path A.
The application, on main frame this locality and file server, stores and presss from both sides compressed package (or backup file folder) with multiple backup file; Each backup file folder compressed package (or backup file folder) is the backup result file under different BACKUP TIME stamp.
User can be pressed from both sides compressed package (or backup file folder) at multiple backup files that multiple backup file folder compressed package (or backup file folder) middle selection one appointment BACKUP TIME stamp is corresponding and perform back off procedure, to be pressed from both sides by the plurality of backup file in the backup result file rollback absolute path that extremely file to be backed up is corresponding in compressed package (or backup file folder); User can not also select BACKUP TIME to stab, and directly uses the BACKUP TIME stamp of main frame acquiescence to perform back off procedure.
Therefore, the process You Liangge branch of timestamp to be restored is determined:
First branch: if comprise a BACKUP TIME stamp in described application program back-off instruction, then this BACKUP TIME stamp is defined as described timestamp to be restored.
Backup file folder compressed package (or backup file folder) that multiple BACKUP TIME stamp is corresponding is stored in main frame this locality or file server, user can be stabbed by BACKUP TIME, selects that backup file of rollback to press from both sides compressed package (or backup file folder).
If have BACKUP TIME stamp in application program back-off instruction, then direct this BACKUP TIME to be stabbed, be defined as timestamp to be restored.Distinguishing to stab with the Backoff time in step S301, utilizing timestamp to be restored to represent the timestamp performing back off procedure herein.
Second branch: if described application program back-off instruction does not comprise a BACKUP TIME stamp, then will perform the BACKUP TIME stamp of backup operation for the last time, be defined as described timestamp to be restored.
If do not have BACKUP TIME stamp in application program back-off instruction, then represent that user does not specify BACKUP TIME to stab.Therefore, main frame can select the BACKUP TIME stamp performing backup operation for the last time.Because in theory in back off procedure, user wishes that application program return back to nearest state in most cases.
Step S304: according to described timestamp to be restored, searches and obtains the to be restored file set corresponding with timestamp to be restored.
Known by foregoing, have the mode of four kinds of storage backup destination files in the application, according to different storage modes, the mode obtaining file set to be restored in this step is also not quite similar.Introduce one by one below:
The first searches mode: search the backup file corresponding with timestamp to be restored press from both sides or, search the backup file corresponding with timestamp to be restored and press from both sides compressed package.
The first search mode with the first kind of way of storage backup destination file and the second way corresponding.Backup file folder or backup file folder compressed package in first kind of way and the second way, store in the local file name generated to press the first default name form of main frame.
So main frame according to timestamp to be restored, can preset name form by same first, generates the file name of backup file folder or backup file folder compressed package.Such as, preset by first the file name that name form programbak_username_yyyymmddHHMMSS generates backup file folder and backup compressed package.
Then, main frame is according to the file name presetting the generation of name form with timestamp to be restored by first, the backup file folder consistent with file name or backup file folder compressed package is searched in main frame this locality, as found, then this backup file is pressed from both sides as file set to be restored, or by the backup file folder compressed package after decompress(ion), as file set to be restored.
The second searches mode: search the backup file corresponding with timestamp to be restored and Hostname at file server and main frame this locality and press from both sides.
The second search the third mode of mode and storage backup destination file and the 4th kind of mode corresponding.In the third mode and fourth way, main frame this locality and file server store the file name presetting the generation of name form by second, the backup file folder of storage or backup file press from both sides compressed package.
Therefore, main frame can preset name form foundation Hostname and timestamp spanned file title to be restored by second, then on main frame this locality or file server, according to the file name presetting the generation of name form by second, searches.If the backup file folder that locating file title is consistent or backup file folder compressed package, then press from both sides compressed package as file set to be restored using this backup file folder or backup file.
Press from both sides or backup file folder compressed package because main frame this locality generally stores one or two backup file be not uploaded on file server, so when searching file set to be restored, first search in main frame this locality, if main frame this locality does not find file set to be restored, then on folder service device, search file set to be restored.
There is step in the embodiment shown in Figure 2 that generate verification file, then after step S304 obtains file set to be restored, verification file is utilized to verify the correctness of file set to be restored, if correct, continue to perform step S305, otherwise, illustrate that file to be restored combines and occur mistake, can not continue to perform.
Introduce described file set to be restored below to meet pre-conditioned deterministic process and comprise: utilize described verification file, verify that whether described file set to be restored is correct; If file set to be restored is correct, then determine to meet pre-conditioned.
Mainly comprise in verification file, BACKUP TIME stamp, the size summation of backup result file, backup file list and get rid of listed files.So proof procedure can be: host verification verification file BACKUP TIME stamp and the BACKUP TIME of file set to be restored stab whether consistance, if consistent, continue other content of checking.If inconsistent, then represent that mistake appears in file set to be restored.
The size summation of the backup result file in checking verification file, whether consistent with the file size of file set to be restored, if consistent, continue other content of checking.If inconsistent, then represent that mistake appears in file set to be restored.
Whether the check code MD5 of checking verification file is consistent with the check code of file set to be restored, if consistent, continues other content of checking.If inconsistent, then represent that mistake appears in file set to be restored.
Whether in checking verification file, listed files is got rid of in backup file list, consistent with the actual backup result file of file set to be restored, if unanimously, then represents that file set to be restored is correct, if inconsistent, then represents that mistake appears in file set to be restored.
Checking file set to be restored meet pre-conditioned under, continue perform step S305.
Step S305: described file set to be restored meet pre-conditioned under, described file set to be restored is stored to described back space file folder in.
The file set to be restored obtained is stored in the back space file folder set up in step S302.
Step S306: by the file each to be restored in described file set to be restored, under being copied to the absolute path of each file to be restored in backup file list.
In the list of backup file folder, have the absolute path of each file to be covered, main frame, according to file set to be restored, under each file to be restored is copied to corresponding absolute path one by one, covers file to be covered under absolute path.
In order to prevent occurring mistake in back off procedure, file to be covered can be moved in back space file folder, and storing with relative path.Like this in step S306, only by file copy to be restored under corresponding absolute path.
Can find out that the application has following beneficial effect from above technology contents:
Perform user in the application only to need to pre-set input parameter set, in actual back off procedure, performing user only needs to issue application program back-off instruction.Without the need to performing other process, all back off procedure are all automated executions, therefore can improve accuracy rate and the backup efficiency of rollback.
As shown in Figure 4, this application provides a kind of robotization back-up device, comprising:
First receiving element 41, for receiving Application Backup instruction, generates BACKUP TIME stamp;
First creating unit 42, under the target backup path that comprises in input parameter set, creates in file name the backup file folder comprising described BACKUP TIME stamp;
First determining unit 43, for one or two listed files comprised according to described input parameter set, determines set of paths to be backed up; Wherein, described set of paths to be backed up comprises the absolute path of each file to be backed up, the corresponding file to be backed up of each absolute path;
First copy cell 44, for by the file to be backed up in described set of paths to be backed up corresponding to each absolute path, is copied in described backup file folder.
As shown in Figure 5, this application provides a kind of robotization backspace mechanism, comprising:
Second receiving element 51, receives application program back-off instruction, generates Backoff time stamp;
Second creating unit 52, under the target backup path that comprises in input parameter set, creates the back space file folder that file name comprises described Backoff time stamp;
Second determining unit 53, for according to described application program back-off instruction, determines timestamp to be restored;
Search unit 54, for according to described timestamp to be restored, search and obtain the to be restored file set corresponding with timestamp to be restored;
Storage unit 55, for meet at described file set to be restored pre-conditioned under, described file set to be restored is stored to described back space file folder in;
Second copy cell 56, for by the file each to be restored in described file set to be restored, under one_to_one corresponding is copied to the absolute path in backup file list.
Perform user in the application only to need to pre-set input parameter set, in reality backup and back off procedure, performing user only needs to issue Application Backup or back-off instruction.Without the need to performing other process, all backups or back off procedure are all automated executions, therefore can improve accuracy rate and the backup efficiency of rollback.
If the function described in the present embodiment method using the form of SFU software functional unit realize and as independently production marketing or use time, can be stored in a computing equipment read/write memory medium.Based on such understanding, the part of the part that the embodiment of the present application contributes to prior art or this technical scheme can embody with the form of software product, this software product is stored in a storage medium, comprising some instructions in order to make a computing equipment (can be personal computer, server, mobile computing device or the network equipment etc.) perform all or part of step of method described in each embodiment of the application.And aforesaid storage medium comprises: USB flash disk, portable hard drive, ROM (read-only memory) (ROM, Read-OnlyMemory), random access memory (RAM, RandomAccessMemory), magnetic disc or CD etc. various can be program code stored medium.
In this instructions, each embodiment adopts the mode of going forward one by one to describe, and what each embodiment stressed is the difference with other embodiment, between each embodiment same or similar part mutually see.
To the above-mentioned explanation of the disclosed embodiments, professional and technical personnel in the field are realized or uses the application.To be apparent for those skilled in the art to the multiple amendment of these embodiments, General Principle as defined herein when not departing from the spirit or scope of the application, can realize in other embodiments.Therefore, the application can not be restricted to these embodiments shown in this article, but will meet the widest scope consistent with principle disclosed herein and features of novelty.
Claims (16)
1. a robotization backup method, is characterized in that, comprising:
Receive Application Backup instruction, generate BACKUP TIME stamp;
Under the target backup path that input parameter set comprises, create in file name the backup file folder comprising described BACKUP TIME stamp;
According to one or two listed files that described input parameter set comprises, determine set of paths to be backed up; Wherein, described set of paths to be backed up comprises the absolute path of each file to be backed up, the corresponding file to be backed up of each absolute path;
By the file to be backed up in described set of paths to be backed up corresponding to each absolute path, be copied in described backup file folder.
2. the method for claim 1, is characterized in that, also comprises:
Compress described backup file folder and obtain backup file folder compressed package, and will the file name of described BACKUP TIME stamp be comprised by default name form, be defined as the title of described backup file folder compressed package.
3. method as claimed in claim 2, is characterized in that, also comprise:
Under the preset path reaching file server is wrapped in the contracting of described backup file cramping; Wherein, described input parameter set comprises described folder service device IP, port and described preset path.
4. the method for claim 1, is characterized in that, also comprises:
According to the half-cooked one-tenth check code of described backup file;
By one or two listed files described, the size summation of all files to be backed up, described BACKUP TIME stamp and described check code, be stored in verification file; Wherein, the Folder Name of described verification file is consistent with the Folder Name that described backup file presss from both sides compressed package.
5. method as claimed in claim 4, is characterized in that, also comprise:
Under described verification file being uploaded to the preset path of file server; Wherein, described input parameter set comprises described folder service device IP and described preset path.
6. the method for claim 1, is characterized in that,
Comprise backup file list in described input parameter set, do not comprise get rid of listed files, described one or two listed files comprised according to described input parameter set determines set of paths to be backed up, specifically comprise: by all absolute path in described backup file list, be defined as described set of paths to be backed up;
When described input parameter set not only comprised backup file list but also comprise get rid of listed files, described one or two listed files comprised according to described input parameter set determines set of paths to be backed up, specifically comprise: by all absolute path of described backup file list, remove the residue absolute path after all absolute path of described eliminating listed files, be defined as described set of paths to be backed up.
7. method as claimed in claim 6, is characterized in that, before the instruction of reception Application Backup, also comprises:
Check the legitimacy of described input parameter set.
8. method as claimed in claim 7, is characterized in that,
For the target backup path of described input parameter set, described in check that the legitimacy of described input parameter set specifically comprises: check whether described target backup path exists, if do not exist, reports an error; Check whether the execution user issuing Application Backup instruction possesses the authority reading described target backup path, if do not exist, reports an error; Check space utilization rate and the remaining space of described target backup path place file system, if space utilization rate exceedes preset ratio or remaining space is less than default value, report an error;
For the described backup file list of described input parameter set, described in check that the legitimacy of described input parameter set specifically comprises: check that in described backup file list, whether each absolute path exists, if do not exist, reports an error; Check whether the execution user issuing Application Backup instruction possesses the authority of each absolute path in the described backup file list of read-write, if do not have, reports an error;
For the described eliminating listed files of described input parameter set, describedly check that the legitimacy of described input parameter set specifically comprises: check the file that in described eliminating listed files, each absolute path is corresponding, the son file of a file to be backed up whether corresponding to described backup file list, if not then report an error; Calculate the size summation of all files to be backed up according to described backup file list and described eliminating listed files, if the size summation of all files to be backed up is greater than described remaining space, then report an error.
9. the method for claim 1, is characterized in that, described by the file to be backed up in described set of paths to be backed up corresponding to each absolute path, is copied in described backup file folder, comprises:
By file to be backed up corresponding for each absolute path in described set of paths to be backed up, to remove the mode of the relative path of root directory, be copied in described backup file folder.
10. a robotization backing method, is characterized in that, comprising:
Receive application program back-off instruction, generate Backoff time stamp;
Under the target backup path that input parameter set comprises, create the back space file folder that file name comprises described Backoff time stamp;
According to described application program back-off instruction, determine timestamp to be restored;
According to described timestamp to be restored, search and obtain the to be restored file set corresponding with timestamp to be restored;
Described file set to be restored meet pre-conditioned under, described file set to be restored is stored to described back space file folder in;
By the file each to be restored in described file set to be restored, under one_to_one corresponding is copied to the absolute path in backup file list.
11. methods as claimed in claim 10, is characterized in that, describedly determine timestamp to be restored according to described application program back-off instruction, comprising:
If comprise a BACKUP TIME stamp in described application program back-off instruction, then this BACKUP TIME stamp is defined as described timestamp to be restored;
If described application program back-off instruction does not comprise a BACKUP TIME stamp, then will perform the BACKUP TIME stamp of backup operation for the last time, be defined as described timestamp to be restored.
12. methods as described in claim 10 or 11, is characterized in that, described according to described timestamp to be restored, search and obtain the to be restored file set corresponding with timestamp to be restored, comprising:
Utilizing described timestamp to be restored, building by presetting name form the file name that backup file presss from both sides compressed package;
Under described target backup path, search the backup file corresponding with described file name press from both sides compressed package;
If find, then by this backup file folder compressed package, be defined as described file set to be restored;
If do not find, then under the absolute path of folder service device, search the backup file corresponding with described file name press from both sides compressed package;
If find, then by this backup file folder compressed package, be defined as described file set to be restored.
13. methods as described in claim 10 or 11, is characterized in that, also comprise:
Obtain the verification file corresponding with timestamp to be restored;
Then described file set to be restored meets pre-conditioned deterministic process and comprises:
Utilize described verification file, verify that whether described file set to be restored is correct;
If file set to be restored is correct, then determine to meet pre-conditioned.
14. methods as claimed in claim 11, is characterized in that, by the file each to be restored in described file set to be restored, one_to_one corresponding also comprises before being copied under the absolute path in backup file list:
According to the backup file list that described input parameter set comprises, one by one by the file to be covered corresponding to absolute path each in backup file list, move in described back space file folder.
15. 1 kinds of robotization back-up devices, is characterized in that, comprising:
First receiving element, for receiving Application Backup instruction, generates BACKUP TIME stamp;
First creating unit, under the target backup path that comprises in input parameter set, creates in file name the backup file folder comprising described BACKUP TIME stamp;
First determining unit, for one or two listed files comprised according to described input parameter set, determines set of paths to be backed up; Wherein, described set of paths to be backed up comprises the absolute path of each file to be backed up, the corresponding file to be backed up of each absolute path;
First copy cell, for by the file to be backed up in described set of paths to be backed up corresponding to each absolute path, is copied in described backup file folder.
16. 1 kinds of robotization backspace mechanisms, is characterized in that, comprising:
Second receiving element, receives application program back-off instruction, generates Backoff time stamp;
Second creating unit, under the target backup path that comprises in input parameter set, creates the back space file folder that file name comprises described Backoff time stamp;
Second determining unit, for according to described application program back-off instruction, determines timestamp to be restored;
Search unit, for according to described timestamp to be restored, search and obtain the to be restored file set corresponding with timestamp to be restored;
Storage unit, for meet at described file set to be restored pre-conditioned under, described file set to be restored is stored to described back space file folder in;
Second copy cell, for by the file each to be restored in described file set to be restored, under one_to_one corresponding is copied to the absolute path in backup file list.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510766304.3A CN105302671A (en) | 2015-11-11 | 2015-11-11 | Automatic backup and rollback method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510766304.3A CN105302671A (en) | 2015-11-11 | 2015-11-11 | Automatic backup and rollback method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN105302671A true CN105302671A (en) | 2016-02-03 |
Family
ID=55199963
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510766304.3A Pending CN105302671A (en) | 2015-11-11 | 2015-11-11 | Automatic backup and rollback method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105302671A (en) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107580050A (en) * | 2017-09-05 | 2018-01-12 | 成都知道创宇信息技术有限公司 | A kind of server rolls back method during generation server 500 |
CN109144786A (en) * | 2018-08-28 | 2019-01-04 | 天阳宏业科技股份有限公司 | The restoration methods and recovery system of small documents in packaging file |
CN110059061A (en) * | 2019-03-22 | 2019-07-26 | 厦门快商通信息咨询有限公司 | The backup method and back-up device and storage medium of a kind of voice print database |
CN110851305A (en) * | 2019-11-20 | 2020-02-28 | 东北石油大学 | Backup storage method and device for science and technology project files |
CN111400105A (en) * | 2020-03-27 | 2020-07-10 | 北京拓世寰宇网络技术有限公司 | Database backup method and device |
CN111625396A (en) * | 2019-02-27 | 2020-09-04 | 阿里巴巴集团控股有限公司 | Backup data verification method, server and storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2009009921A1 (en) * | 2007-07-13 | 2009-01-22 | Intel Corporation | Key based hidden partition system |
CN101470645A (en) * | 2007-12-29 | 2009-07-01 | 华为技术有限公司 | High-speed cache data recovery method and apparatus |
CN101826042A (en) * | 2010-01-25 | 2010-09-08 | 宇龙计算机通信科技(深圳)有限公司 | Method of data backup and mobile terminal |
CN104063294A (en) * | 2014-07-07 | 2014-09-24 | 国家电网公司 | Linux system backup and restoring method |
-
2015
- 2015-11-11 CN CN201510766304.3A patent/CN105302671A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2009009921A1 (en) * | 2007-07-13 | 2009-01-22 | Intel Corporation | Key based hidden partition system |
CN101470645A (en) * | 2007-12-29 | 2009-07-01 | 华为技术有限公司 | High-speed cache data recovery method and apparatus |
CN101826042A (en) * | 2010-01-25 | 2010-09-08 | 宇龙计算机通信科技(深圳)有限公司 | Method of data backup and mobile terminal |
CN104063294A (en) * | 2014-07-07 | 2014-09-24 | 国家电网公司 | Linux system backup and restoring method |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107580050A (en) * | 2017-09-05 | 2018-01-12 | 成都知道创宇信息技术有限公司 | A kind of server rolls back method during generation server 500 |
CN109144786A (en) * | 2018-08-28 | 2019-01-04 | 天阳宏业科技股份有限公司 | The restoration methods and recovery system of small documents in packaging file |
CN109144786B (en) * | 2018-08-28 | 2021-05-28 | 天阳宏业科技股份有限公司 | Recovery method and recovery system for small files in packed file |
CN111625396A (en) * | 2019-02-27 | 2020-09-04 | 阿里巴巴集团控股有限公司 | Backup data verification method, server and storage medium |
CN111625396B (en) * | 2019-02-27 | 2023-05-26 | 阿里云计算有限公司 | Backup data verification method, server and storage medium |
CN110059061A (en) * | 2019-03-22 | 2019-07-26 | 厦门快商通信息咨询有限公司 | The backup method and back-up device and storage medium of a kind of voice print database |
CN110851305A (en) * | 2019-11-20 | 2020-02-28 | 东北石油大学 | Backup storage method and device for science and technology project files |
CN111400105A (en) * | 2020-03-27 | 2020-07-10 | 北京拓世寰宇网络技术有限公司 | Database backup method and device |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105302671A (en) | Automatic backup and rollback method and device | |
US10162714B2 (en) | Methods and systems for restoring data containers in a storage system | |
CN106951345A (en) | A kind of conformance test method and device of magnetic disk of virtual machine data | |
US9063894B2 (en) | Cascade ordering | |
EP3499358B1 (en) | Method and device for deleting cascade snapshot | |
CN105718354A (en) | Fault information reproducing method and device | |
CN103778030B (en) | Daily record subsystem wiring method, error tracking method and processor | |
JP2011039805A (en) | Hierarchical management storage system, and storage system operating method | |
CN103473277A (en) | Snapshot method and device for file systems | |
EP3474143B1 (en) | Method and apparatus for incremental recovery of data | |
CN102193841B (en) | Backup method and device of Subversion configuration database | |
CN105022678A (en) | Data backup method and apparatus for virtual machine | |
CN104321756A (en) | Source cleaning cascaded volumes | |
CN105224422A (en) | A kind of data back up method and equipment | |
CN105677509A (en) | Method and apparatus for recovering data in database | |
CN104484240A (en) | Method and device for storing terminal data | |
CN110633101A (en) | Program code management method, device and equipment and readable storage medium | |
WO2021169163A1 (en) | File data access method and apparatus, and computer-readable storage medium | |
CN113190531A (en) | Database migration method, device, equipment and storage medium | |
CN106354587A (en) | Mirror image server and method for exporting mirror image files of virtual machine | |
CN107992268A (en) | A kind of method and relevant apparatus of bad block mark | |
CN105608150A (en) | Business data processing method and system | |
CN110213100A (en) | A kind of disaster recovery method of configuration data, device, equipment and readable storage medium storing program for executing | |
TW201516655A (en) | System and method for recovering distributed file system | |
CN111858164B (en) | Continuous data protection method, device and equipment and readable storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20160203 |