A big data backup system and method based on distributed copy

Through the interaction between the HADOOP cluster and the disaster recovery machine and the distribution of MAPPER tasks, big data can be backed up to any file system that can run the JAVA virtual machine without affecting the operation of the HDFS application business, solving the existing technology problems. It can only back up to HDFS, which improves the flexibility and applicability of backup.

CN113934575BActive Publication Date: 2024-10-29INFORMATION2 SOFTWARE SHANGHAI
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111224865.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-21
Publication Date
2024-10-29
Estimated Expiration
2041-10-21

AI Technical Summary

Technical Problem

Existing distributed copy technology can only back up to the HDFS file system and cannot back up to other basic OS file systems such as Linux or Windows that can run JAVA virtual machines, and it may affect HDFS-based applications when performing big data HDFS backup. Business running.

Method used

A big data backup system and method based on distributed copy is designed. By deploying the HJOB module in the HADOOP cluster and interacting with the disaster recovery machine to obtain the file status master table, generate a file status list to be backed up, start the MAPPER task to maintain load balancing, and Send backup files to the disaster recovery machine through the MAPPER task; when receiving the recovery command, generate a status list of files to be restored, start the MAPPER task to maintain load balancing, send file reading instructions to the disaster recovery machine, and write the HDFS source file. This system is suitable for file systems of any basic OS such as Linux and Windows, and can be backed up without affecting the operation of HDFS application services.

Benefits of technology

It realizes the backup of big data to any file system that can run JAVA virtual machine without affecting the operation of HDFS application business, breaking through the limitations of traditional distributed copy and improving the flexibility and applicability of backup.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113934575B_ABST
    Figure CN113934575B_ABST
Patent Text Reader

Abstract

The present invention discloses a big data backup system and method based on distributed copy, which comprises: a HADOOP cluster, an HJOB module is deployed, a file status master table is obtained through the HJOB module in interaction with a disaster recovery machine, a file status list to be backed up / to be restored is generated according to the file status master table when a backup / restore instruction is received, a MAPPER task is started and divided, and a corresponding backup file or file reading instruction is sent to the disaster recovery machine through the MAPPER task according to the file items in the input file status list to be backed up / to be restored; and a disaster recovery machine, a Node module is deployed, after receiving the file stream data of the file to be backed up transmitted by the HADOOP cluster node, the file stream is processed by a second File module and written into the disaster recovery machine, and when a file reading instruction is received, the file stream is read by the second File module and sent to the HADOOP cluster node.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of computer disaster recovery and backup, and in particular to a large data backup system and method based on distributed copy. Background Art

[0002] DistCp (Distributed Copy) is a high-performance copy tool for large-scale clusters or between clusters. It has the same effect as executing cp (copy) and scp (secure copy) on Linux. The difference is that cp (copy) copies files and directories on the local machine to other places on the local machine, scp (secure copy) can copy files or directories of machine A to machine B, and Distcp distributed copy can copy data from cluster A (hdfs) to cluster B (hdfs), where hdfs refers to the Hadoop distributed file system. Distributed copy enables the DN nodes of cluster A to send data to the DN nodes of cluster B at the same time when copying data, breaking through the network card rate limit of single-machine copying and making the copying more efficient. At the same time, Distcp copying uses Map / Reduce tasks to implement file distribution, error handling and recovery, and report generation. It takes the list of files and directories as the input of the map task, and each task will complete the copying of some files in the source list (in fact, Distcp distributed copy only uses map, not reduce).

[0003] However, currently distributed copy can only be backed up to the cluster HDFS file system, that is, its target file system can only be HDFS, and cannot be the file system of any basic OS that can run JAVA virtual machine such as Linux, Windows, etc. Summary of the invention

[0004] In order to overcome the shortcomings of the above-mentioned prior art, the purpose of the present invention is to provide a big data backup system and method based on distributed copy, so that the target file system for its backup can be any basic OS file system such as Linux, Windows, etc. that can run JAVA virtual machine, and the big data HDFS backup task can be performed without affecting the operation of HDFS-based application business.

[0005] To achieve the above object, the present invention proposes a large data backup system based on distributed copy, comprising:

[0006] HADOOP cluster, deploy HJOB module, interact with the disaster recovery machine through the HJOB module to obtain the file status master table, generate a list of file status to be backed up according to the file status master table when receiving a backup instruction, start and divide the MAPPER task to maintain the load balance of the HADOOP cluster, and send the corresponding backup file to the disaster recovery machine through the MAPPER task according to the file items in the input file status list to be backed up; when receiving a recovery instruction, generate a list of file status to be restored according to the file status master table, start and divide the MAPPER task to maintain the load balance of the HADOOP cluster, send a file read instruction to the disaster recovery machine, and write the HDFS source file after receiving the file data sent by the disaster recovery machine;

[0007] The disaster recovery machine deploys the Node module, and after receiving the file stream data of the file to be backed up transmitted by the HADOOP cluster node, processes the file stream through the second File module and writes it into the disaster recovery machine; when receiving a file read instruction, reads the file stream through the second File module and sends it to the HADOOP cluster node.

[0008] Preferably, the HJOB module further comprises:

[0009] A file status master table acquisition module, used to acquire the file status master table through the first Net module interacting with the disaster recovery machine;

[0010] A file status list generation module is used to compare the files in the directory to be backed up / restored with the acquired file status master table to generate a to-be-backed-up file status list / to-be-restored file status list when receiving a backup / restore instruction;

[0011] A MAPPER start module is used to divide the files to be backed up / to be restored into MAPPER tasks according to the status list of files to be backed up / to be restored and to start the MAPPER tasks;

[0012] The first File module is used to obtain the file stream of the file to be backed up under the control of the Mapper task and send it to the disaster recovery machine through the first Net module; after receiving the file data sent by the disaster recovery machine through the first Net module, the received file data is written into the HDFS source file;

[0013] The file reading instruction sending module is used to send file reading instructions to the disaster recovery machine through the MAPPER task;

[0014] The first Net module is used to implement network transmission between the HADOOP cluster node and the disaster recovery machine.

[0015] Preferably, the MAPPER startup module divides the files to be backed up / restored by text lines, where one line represents one file, and one file corresponds to one mapper task for data transmission.

[0016] Preferably, the disaster recovery machine further comprises:

[0017] The Node module is used to provide an entry to the disaster recovery machine, receive the file stream data of the file to be backed up transmitted by the HADOOP cluster node, and when receiving the file reading instruction, start the second File module to read the corresponding file stream, so as to send it to the HADOOP cluster node through the second Net module;

[0018] The second File module is used to query the disk status of the disaster recovery machine when the Node module receives the file stream of the file to be backed up transmitted by the HADOOP cluster node, and write it to the disaster recovery machine according to the query result; when the Node module receives the file read instruction, read the corresponding file stream according to the file read instruction, and send it to the HADOOP cluster node through the second Net module;

[0019] The second Net module is used to realize the network transmission between the HADOOP cluster node and the disaster recovery machine;

[0020] The Data module is used to record disk space, backup file status, and backup records.

[0021] Preferably, the Node module integrates an RPC framework for interacting with the control machine and a TIMER scheduled task framework, and sends backup and recovery instructions to the HJOB module of the HADOOP cluster node through the scheduled task.

[0022] Preferably, when the second File module receives the file stream of the file to be backed up transmitted by the HADOOP cluster node, it calls the Data module, checks the free space size of the disaster recovery machine disk through the Data module, and writes the received file data to the disaster recovery machine disk according to the query result.

[0023] Preferably, the system further comprises a control machine, which is used to interact with the Node module of the disaster recovery machine, provide registration of each disaster recovery machine data node, and issue backup rules to each disaster recovery machine data node.

[0024] To achieve the above object, the present invention also provides a large data backup method based on distributed copy, comprising the following steps:

[0025] Step S1, deploying an HJOB module on a HADOOP cluster node, and obtaining a file status master table through interaction between the HJOB module and the disaster recovery machine master node;

[0026] Step S2, when receiving the backup instruction, the HJOB module generates a list of file statuses to be backed up according to the file status master table, starts and divides the MAPPER task to maintain the load balance of the HADOOP cluster, and sends the corresponding backup files to the disaster recovery machine according to the file items in the input list of file statuses to be backed up through the MAPPER task;

[0027] Step S3, when receiving the recovery instruction, the HJOB module generates a list of file status to be restored according to the file status master table, starts and divides the MAPPER task to maintain the load balance of the HADOOP cluster, sends a file read instruction to the disaster recovery machine, and writes the HDFS source file after receiving the file data sent by the disaster recovery machine.

[0028] Preferably, step S2 further comprises:

[0029] Step S200, when a backup instruction is received, the files in the directory to be backed up are compared with the file status master table obtained from the disaster recovery machine to generate a list of file statuses to be backed up;

[0030] Step S201, divide the backup files into Mapper tasks and start the Mapper tasks;

[0031] Step S202: under the control of the Mapper task, the corresponding backup file is sent to the disaster recovery machine data node according to the file item in the input to-be-backed-up file status list.

[0032] Preferably, step S3 further comprises:

[0033] Step S300, when receiving the backup recovery instruction, compare the files in the directory to be restored with the file status master table obtained from the disaster recovery machine to generate a list of file statuses to be restored;

[0034] Step S301, dividing the to-be-recovered files in the to-be-recovered file status list into Mapper tasks, and starting the Mapper tasks;

[0035] Step S302, sending a file read instruction to the disaster recovery machine through a Mapper task;

[0036] Step S303, after the HJOB module receives the file data sent by the disaster recovery machine through the first Net module, the received file data is written into the HDFS source file through the first File module.

[0037] Compared with the prior art, the big data backup system and method based on distributed copy of the present invention improves the distributed copy DistCp to realize a new copy mode between DistCp and scp. The target file system for its backup can be a file system of any basic OS such as Linux and Windows that can run JAVA virtual machine. The present invention can perform big data HDFS backup tasks without affecting the operation of application business based on HDFS. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 This is a system architecture diagram of a big data backup system based on distributed copy according to the present invention;

[0039] Figure 2 This is a flow chart of the steps of a large data backup method based on distributed copy of the present invention;

[0040] Figure 3 The figure is a flowchart of big data backup and recovery based on distributed copy in an embodiment of the present invention. DETAILED DESCRIPTION

[0041] The following describes the implementation of the present invention through specific examples and in conjunction with the accompanying drawings. Those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific examples, and the details in this specification can also be modified and changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention.

[0042] Before introducing the present invention, several concepts involved in the present invention are first explained:

[0043] BIO: Synchronous blocking IO. The server implementation mode is one thread per connection. That is, when the client has a connection request, the server needs to start a thread to process it. If this connection does not do anything, it will cause unnecessary thread overhead. Of course, it can be improved through the thread pool mechanism.

[0044] NIO: Synchronous non-blocking IO. The server implementation mode is one thread per request. That is, the connection requests sent by the client will be registered on the multiplexer. When the multiplexer polls the connection for an I / O request, it will start a thread for processing.

[0045] Java Timer: Timer is a timer tool used to schedule a specified task in a background thread. It can schedule a task to be executed "once" or "many times" at regular intervals.

[0046] Figure 1This is a system architecture diagram of a large data backup system based on distributed copy in the present invention. Figure 1 As shown, the present invention provides a large data backup system based on distributed copy, including:

[0047] HADOOP cluster 10, deploys HJOB module, generates file status master table through interaction between HJOB module and disaster recovery machine, generates file status list filelist.seq to be backed up according to file status master table when receiving backup instruction, divides MAPPER task to maintain load balance of HADOOP cluster, starts MAPPER task to run, sends corresponding backup file to disaster recovery machine through MAPPER task according to file item in input file status list to be backed up; when receiving recovery instruction, generates file status list recovery.seq to be recovered according to file status master table, divides MAPPER task to maintain load balance of HADOOP cluster, starts MAPPER task to run, sends file read instruction to disaster recovery machine, and writes HDFS source file through first File module after receiving file data sent by disaster recovery machine. In the present invention, HJOB module only needs to be deployed once in any node in the cluster, because jar package will be automatically copied to node that executes mapreduce operation when MAPPER is distributed. It should be noted that both backup instruction and recovery instruction are sent by control machine to Node module of disaster recovery machine, and then sent by Node module to HJOB module.

[0048] That is to say, any node in the HADOOP cluster deploys an HJOB module, which is a Hadoop task program. The HJOB module interacts with the disaster recovery machine to generate a file status list (i.e., a file status list to be backed up filelist.seq or a file status list to be recovered recovery.seq) to provide input to MAPPER, and divides MAPPER tasks to maintain the load balance of the HADOOP cluster. This file status list is a file list that needs to be updated after the HJOB module obtains the status of the big data file and compares it with the file status master table generated on the disaster recovery machine (the latest modification time or the file MD5 value). This update represents backup or recovery. Specifically, the HJob module further includes:

[0049] The file status master table generation module 101 is used to interact with the disaster recovery machine through the first Net module to obtain the file status master table. The file status master table stores the file status of the last backup, which is stored in the sqlite database of the disaster recovery machine. That is to say, during the backup, the HJob module will obtain the objects of all files to be backed up according to the API of the HDFS file system, obtain the corresponding file number, path, latest modification date, size, file MD5 value and other specific file information and send it to the disaster recovery machine 20, thereby generating the file status master table, which is stored in the disaster recovery machine database DB (sqlite database installed in the disaster recovery machine), and before each backup, the file status master table generation module 101 obtains the file status master table through the first Net module.

[0050] The file status list generation module 102 is used to compare the files in the directory to be backed up or restored with the file status master table from the disaster recovery machine when receiving the backup / restore instruction (incremental backup and recovery only back up / restore the changed files) to generate a file status list to be backed up filelist.seq or a file status list to be restored recovery.seq, wherein the file status list to be backed up filelist.seq includes a list of files to be backed up, and the file status list to be restored recovery.seq includes a list of files to be restored. Of course, when the received instruction is a full backup instruction, there is no need to compare, and the file status list to be backed up filelist.seq can be directly generated.

[0051] Specifically, when the user issues a backup / restore instruction through the control machine (the backup / restore instruction is issued by the control machine to the disaster recovery machine Node module, and then by the disaster recovery machine Node module to the Hjob module), when the HJob module receives the backup or restore instruction, its file status list generation unit 102 compares the files in the directory to be backed up or restored with the file status master table in the DB according to the backup or restore instruction to generate a file status list to be backed up filelist.seq or a file status list to be restored recovery.seq.

[0052] The MAPPER starting module 103 is used to divide the files to be backed up or the files to be recovered into MAPPER tasks according to the file status list to be backed up filelist.seq or the file status list to be recovered recovery.seq, and start MAPPER.

[0053] Specifically, start the MAPPER task. The input of the MAPPER task is the file status list to be backed up filelist.seq or the file status list to be recovered recovery.seq. The file item is a single HDFS file. The specific information includes file number, path, latest modification date, size, file MD5 value, etc. Each line of the text file (that is, representing a file to be backed up or to be recovered) is split. One file corresponds to one MAPPER task for data transmission, that is, one line of the HDFS file corresponds to one MAPPER task.

[0054] The first File module 104 is used for file management and access, and is used to obtain the file stream of the file to be backed up under the control of the Mapper task and send it to the disaster recovery machine through the first Net module; when the file data sent by the disaster recovery machine is received through the first Net module, the received file data is written into the HDFS source file.

[0055] The file reading instruction sending module 105 is used to send the file reading instruction to the disaster recovery machine through the MAPPER task. That is to say, after the recovery file status list recovery.seq to be recovered is divided according to the text line and the Mapper task is started, the Mapper sends the file reading instruction to the disaster recovery machine through the first Net module. The file reading instruction includes but is not limited to the rule uuid, as well as the file number, path, latest modification date, size, file MD5 value and other specific information. The rule uuid is the unique id of the control machine to manage the big data backup, which is sent to the disaster recovery machine when the control machine generates the rule and is saved in the recovery.seq file together with other information.

[0056] The first Net module 105 is used to implement network transmission between the HADOOP cluster node 10 and the disaster recovery machine 20. In a specific embodiment of the present invention, the Net module implements BIO transmission and NIO transmission. The implementation of NIO is to solve the problem of data backup and data reception on the backup side in a large HADOOP cluster environment.

[0057] The disaster recovery machine 20 deploys the Node module. After receiving the file stream data of the file to be backed up transmitted by the HADOOP cluster node 10, it processes the file stream through the second File module and writes it into the disaster recovery machine; when receiving a file read instruction, it reads the file stream through the second File module and sends it to the HADOOP cluster node 10 through the second Net module.

[0058] Specifically, the disaster recovery machine 20 further includes:

[0059] The Node module 201 is used to provide an entry to the disaster recovery machine, receive the file stream data of the file to be backed up transmitted by the HADOOP cluster node 10, and when receiving a file read instruction, start the second File module to read the corresponding file stream and send it to the HADOOP cluster node 10 through the second Net module.

[0060] In a specific embodiment of the present invention, the Node module 201 is the entry point for starting the disaster recovery machine. It also integrates the RPC framework for interacting with the control machine and the TIMER scheduled task framework. It is responsible for interacting with the control machine, receiving the backup / restore instructions of the control machine, and sending backup / restore instructions to the HJOB module of the HADOOP cluster node 10 through the scheduled task.

[0061] The second File module 202 is used to receive file data sent from the HADOOP cluster node 10 through the MAPPER task, call the Data module 204 to query the disk status of the disaster recovery machine, and write to the disaster recovery machine according to the query result; when the Node module 201 receives a file read instruction, it calls the Data module according to the file read instruction to query the backup file status, read the corresponding file stream, and send it to the HADOOP cluster node 10 through the second Net module.

[0062] In a specific embodiment of the present invention, when the second File module 202 receives the file stream of the file to be backed up transmitted by the HADOOP cluster node 10, it calls the Data module 204, checks the free space size of the disaster recovery machine disk through the Data module 204, and writes the received file data to the disaster recovery machine disk according to the query result. During backup and recovery, the second File module 202 extracts the backup file content of the disaster recovery machine according to the file reading instruction and sends it to the HADOOP cluster node 10dMAPPER.

[0063] The second Net module 203 is used to implement network transmission between the HADOOP cluster node 10 and the disaster recovery machine 20. Similarly, the Net module here implements BIO transmission and NIO transmission. The implementation of NIO is to solve the problem of data backup and data reception on the backup side in a large HADOOP cluster environment.

[0064] The data module 204 is used to record the disk space status, backup file status and backup records of the disaster recovery machine.

[0065] In the present invention, the Data module 204 defines data objects and provides access to the disaster recovery machine database. The Data module uses MyBatis as the basic framework for database access. In a specific embodiment of the present invention, the Data module mainly operates three types of data: disaster recovery machine disk data, backup history records, and file status data. The second File module will call this module when writing or reading, that is, it will call it to register data nodes and check files before backup, and write backup history records after backup is completed; it will also call this module to call backup history records and check file status before recovery.

[0066] It can be seen that the disaster recovery machine in the present invention is not HDFS. It mainly utilizes the cross-platform characteristics of the JAVA language. Therefore, as long as the JAVA virtual machine can run, the files can be backed up to the system. In other words, the present invention realizes the backup of the big data cluster to any disaster recovery machine that can run the JAVA virtual machine based on distributed copy DistCp.

[0067] The control machine 30 is used to interact with the Node module of the disaster recovery machine, provide registration of the disaster recovery machine, and send backup rules to the disaster recovery machine. In the present invention, the control machine 30 does not interact directly with the HADOOP cluster nodes. The control machine 30 sends backup and recovery instructions by indirectly interacting with the Node module.

[0068] In a specific embodiment of the present invention, the control machine provides registration for each disaster recovery machine, provides a web page for initiating big data backup, and sends backup rules to each disaster recovery machine through the web page.

[0069] Figure 2 FIG. 1 is a flow chart of the steps of a large data backup method based on distributed copy according to the present invention. Figure 2 As shown, the present invention provides a large data backup method based on distributed copy, comprising the following steps:

[0070] Step S1, deploying the HJOB module on the HADOOP cluster node, and obtaining the file status master table through the interaction between the HJOB module and the disaster recovery machine master node.

[0071] Specifically, an HJOB module is deployed on any node in the HADOOP cluster. The HJOB module is a Hadoop task program. The HJOB module interacts with the disaster recovery machine to generate a file status list (i.e., a file status list to be backed up filelist.seq or a file status list to be recovered recovery.seq) to provide input to MAPPER, and divides MAPPER tasks to maintain load balancing of the HADOOP cluster. This file status list is a list of files that need to be updated after the HJOB module obtains the status of the big data file and compares it with the file status master table generated on the disaster recovery machine (the latest modification time or the file MD5 value). This update represents backup or recovery.

[0072] During backup, the HJOB module on the HADOOP cluster node will obtain the objects of all files to be backed up according to the API of the HDFS file system, obtain the corresponding file number, path, latest modification date, size, file MD5 value and other specific file information, send it to the disaster recovery machine and insert it to generate the file status master table. Before each backup, the file status master table is obtained from the disaster recovery machine through the first Net module.

[0073] Step S2, when receiving the backup instruction, the HJOB module generates the file status filelist.seq to be backed up according to the file status master table, and divides the file status list filelist.seq to be backed up to divide the Mapper task, starts the Mapper task to run, and sends the corresponding backup file to the disaster recovery machine through the MAPPER task according to the file items in the file status list of the input file to be backed up.

[0074] Specifically, step S2 further includes:

[0075] Step S200, when a backup instruction is received, the files in the directory to be backed up are compared with the file status master table obtained from the disaster recovery machine to generate a file status list to be backed up filelist.seq, which includes a list of files to be backed up.

[0076] Step S201, divide the backup files into Mapper tasks and start the Mapper tasks.

[0077] Specifically, start the Mapper task. The input of the Mapper task is the file status list filelist.seq to be backed up. The file item is a single HDFS file. The specific information includes file number, path, latest modification date, size, file MD5 value, etc. Each line of the text file is split. One file corresponds to one mapper task for data transmission, that is, one line of the HDFS file corresponds to one MAPPER task.

[0078] Step S202, under the control of the Mapper task, obtain the file stream of the file to be backed up and send it to the disaster recovery machine through the first Net module, that is, according to the file item in the file status list of the input file to be backed up, send the corresponding backup file to the disaster recovery machine.

[0079] Step S3, when receiving the recovery instruction, the HJOB module compares the files in the directory to be recovered with the file status master table obtained from the disaster recovery machine to generate a list of file status to be recovered recovery.seq, and divides the list of file status to be recovered recovery.seq to divide the Mapper task, starts the Mapper task, sends a file read instruction to the disaster recovery machine, and writes the HDFS source file through the first File module after receiving the file data sent by the disaster recovery machine.

[0080] Specifically, step S3 further includes:

[0081] Step S300, when receiving the backup recovery instruction, the files in the directory to be restored are compared with the file status master table obtained from the disaster recovery machine to generate a to-be-restored file status list recovery.seq, which includes the to-be-restored files.

[0082] Step S301, dividing the files to be restored into Mapper tasks, and starting the Mapper tasks.

[0083] Specifically, start the Mapper task. The input of the Mapper task is the file status list filelist.seq to be backed up. The file item is a single HDFS file. The specific information includes file number, path, latest modification date, size, file MD5 value, etc. Each line of the text file is split, and one file corresponds to one mapper task for data transmission.

[0084] Step S302: Send a file read instruction to the disaster recovery machine through a Mapper task.

[0085] That is, after the recovery file status list recovery.seq is divided according to text lines and the Mapper task is started, the Mapper sends a file read instruction to the disaster recovery machine through the first Net module.

[0086] Step S303, after the Hjob module receives the file data sent by the disaster recovery machine through the first Net module, the received file data is written into the HDFS source file through the first File module.

[0087] Example

[0088] First, you need to deploy the agent program (HJOB module) on the HADOOP cluster node of the big data platform. Next, install and execute the I2NODE node package on the disaster recovery machine, install and execute the backup main program (NODE module), and finally register the disaster recovery machine node on the control machine and issue the backup rules under the big data menu.

[0089] Figure 3 FIG. 1 is a flowchart of big data backup and recovery based on distributed copy in an embodiment of the present invention. Figure 3 As shown, during backup, after the Hjob module receives the backup instruction, it first compares the files in the directory to be backed up with the file status master table of the disaster recovery machine database DB (the sqlite database installed on the disaster recovery machine) obtained from the disaster recovery machine to generate a file status list to be backed up filelist.seq, which contains the required backup file list. Then start the Mapper task, and the file status list to be backed up filelist.seq is the input of the Mapper task. The file items in the file status list to be backed up filelist.seq are split according to the text line, and one mapper only handles the transmission of one file. In Mapper, the first File module is first used to obtain the file stream of the backup file, and then it is sent to the Node module of the disaster recovery machine, that is, the disaster recovery machine, through the first Net module. After the Node module receives the transmitted file data, it processes the file stream through the second File module and writes it to the hard disk of the disaster recovery machine, and the backup process ends here.

[0090] During recovery, after the Hjob module receives the recovery instruction, it first compares the files in the directory to be recovered with the file status master table in the disaster recovery machine database DB (sqlite database installed on the disaster recovery machine) obtained from the disaster recovery machine to generate a list of file status to be recovered recovery.seq, which contains the required recovery files. Then the Mapper task is started. The list of file status to be recovered recovery.seq is the input of the Mapper task. The file items of the list of file status to be recovered recovery.seq are split according to the text line. A mapper only processes the transmission of one file. The Mapper first sends the file reading instruction to the Node module of the disaster recovery machine through the first Net module. After the Node module receives the file reading instruction, it reads the file stream through the second File module and sends it to the Hjob module through the second Net module. The Hjob module receives the file data and writes it into the HDFS source file through the first File module. The backup process ends here.

[0091] It can be seen that the present invention is based on the transformation of distributed copy DistCp, and has the distributed copy characteristics of distributed copy DistCp. The source data all comes from HDFS. The key point different from distributed copy DistCp is the target file system for data backup. The target file system of distributed copy DistCp can only be HDFS, but the target file system of the present invention can be any basic OS file system such as Linux and Windows that can run JAVA virtual machine, and use the snapshot function of HDFS to perform big data HDFS backup tasks without affecting the operation of application business based on HDFS.

[0092] The above embodiments are merely illustrative of the principles and effects of the present invention, and are not intended to limit the present invention. Any person skilled in the art may modify and alter the above embodiments without violating the spirit and scope of the present invention. Therefore, the scope of protection of the present invention shall be as set forth in the claims.

Claims

1. A big data backup system based on distributed copy, comprising: HADOOP cluster, deploy HJOB module, interact with the disaster recovery machine through the HJOB module to obtain the file status master table, generate a list of file status to be backed up according to the file status master table when receiving the backup instruction, start and divide the MAPPER task to maintain the load balance of the HADOOP cluster, and send the corresponding backup file to the disaster recovery machine through the MAPPER task according to the file item in the input list of file status to be backed up, where the file item is a single HDFS file; When receiving a recovery instruction, a list of file statuses to be recovered is generated according to the file status master table, MAPPER tasks are started and divided to maintain load balancing of the HADOOP cluster, a file read instruction is sent to the disaster recovery machine, and after receiving the file data sent by the disaster recovery machine, the file is written into the HDFS source file through the first File module; The disaster recovery machine deploys the Node module, and after receiving the file stream data of the file to be backed up transmitted by the HADOOP cluster node, processes the file stream through the second File module and writes it into the disaster recovery machine; when receiving the file read instruction, reads the file stream through the second File module and sends it to the HADOOP cluster node; The control machine is used to interact with the Node module of the disaster recovery machine, provide registration of each disaster recovery machine data node, and issue backup rules to each disaster recovery machine data node; the backup instructions and recovery instructions are sent by the control machine to the Node module of the disaster recovery machine, and then sent by the Node module to the HJOB module; The HJOB module further comprises: A file status master table acquisition module, used for interacting with the disaster recovery machine through the first Net module to acquire the file status master table, wherein the file status master table stores the file status of the last backup; A file status list generating module is used for comparing the files in the directory to be backed up / restored with the acquired file status master table to generate a to-be-backed-up file status list / to-be-restored file status list when receiving a backup / restore instruction, wherein the to-be-backed-up file status list includes a to-be-backed-up file list, and the to-be-restored file status list includes a to-be-restored file list; A MAPPER startup module is used to divide the backup / restored files into MAPPER tasks according to the to-be-backed-up file status list / to-be-restored file status list, and start the MAPPER task, wherein the input of the MAPPER task is the to-be-backed-up file status list or the to-be-restored file status list; the MAPPER startup module splits the backup / restored files into text lines, one line represents one file, and one file corresponds to one MAPPER task for data transmission, that is, one line of HDFS files corresponds to one MAPPER task; The first File module is used to obtain the file stream of the file to be backed up under the control of the MAPPER task and send it to the disaster recovery machine through the first Net module; after receiving the file data sent by the disaster recovery machine through the first Net module, the received file data is written into the HDFS source file; The file reading instruction sending module is used to send file reading instructions to the disaster recovery machine through the MAPPER task; The first Net module is used to implement network transmission between the HADOOP cluster node and the disaster recovery machine; The disaster recovery machine further comprises: The Node module is used to provide an entry to the disaster recovery machine, receive the file stream data of the file to be backed up transmitted by the HADOOP cluster node, and when receiving the file reading instruction, start the second File module to read the corresponding file stream, so as to send it to the HADOOP cluster node through the second Net module; The second File module is used to call the Data module to query the disk space status of the disaster recovery machine when the Node module receives the file stream of the file to be backed up transmitted by the HADOOP cluster node, and write to the disaster recovery machine according to the query result; when the Node module receives the file read instruction, call the Data module according to the file read instruction to query the backup file status, read the corresponding file stream, and send it to the HADOOP cluster node through the second Net module; The second Net module is used to realize the network transmission between the HADOOP cluster node and the disaster recovery machine; The Data module is used to record the disk space status, backup file status, and backup records of the disaster recovery machine.

2. The large data backup system based on distributed copy according to claim 1, characterized in that: The Node module integrates the RPC framework and the TIMER scheduled task framework for interacting with the control machine, and sends backup / restore instructions to the HJOB module of the HADOOP cluster node through the scheduled task.

3. The large data backup system based on distributed copy as claimed in claim 2, characterized in that: When receiving the file stream of the file to be backed up transmitted by the HADOOP cluster node, the second File module calls the Data module, checks the free space size of the disaster recovery machine disk through the Data module, and writes the received file data into the disaster recovery machine disk according to the query result.

4. A big data backup method based on distributed copy, applied to the big data backup system based on distributed copy as claimed in claim 1, comprising the following steps: Step S1, deploying an HJOB module on a HADOOP cluster node, and obtaining a file status master table through interaction between the HJOB module and the disaster recovery machine master node; Step S2, when receiving the backup instruction, the HJOB module generates a list of file statuses to be backed up according to the file status master table, starts and divides the MAPPER task to maintain the load balance of the HADOOP cluster, and sends the corresponding backup files to the disaster recovery machine according to the file items in the input list of file statuses to be backed up through the MAPPER task; Step S3, when receiving the recovery instruction, the HJOB module generates a list of file statuses to be recovered according to the file status master table, starts and divides the MAPPER task to maintain the load balance of the HADOOP cluster, sends a file read instruction to the disaster recovery machine, and writes the file data sent by the disaster recovery machine into the HDFS source file after receiving the file data; Step S2 further comprises: Step S200, when a backup instruction is received, the files in the directory to be backed up are compared with the file status master table obtained from the disaster recovery machine to generate a list of file statuses to be backed up; Step S201, divide the backup file into MAPPER tasks and start the MAPPER tasks; Step S202, under the control of the MAPPER task, sending the corresponding backup file to the disaster recovery machine data node according to the file item in the input to-be-backed-up file status list; Step S3 further comprises: Step S300, when receiving the recovery instruction, compare the files in the directory to be restored with the file status master table obtained from the disaster recovery machine to generate a file status list to be restored; Step S301, dividing the to-be-restored files in the to-be-restored file status list into MAPPER tasks, and starting the MAPPER tasks; Step S302, sending a file read instruction to the disaster recovery machine through a MAPPER task; Step S303, after the HJOB module receives the file data sent by the disaster recovery machine through the first Net module, the received file data is written into the HDFS source file through the first File module.

Citation Information

Patent Citations

  • Backup and recovery method for HDFS (Hadoop distributed filesystem)

    CN104572357A

  • Remote disaster recovery backup method and system based on big data rack sensing technology

    CN111581026A