Data recovery method, device and system

By performing data recovery on the primary storage device in the storage system and utilizing backup data and archived logs from the backup storage device, the problem of consuming computing resources and bandwidth in data recovery in existing technologies is solved, and efficient and accurate database data recovery to a specified point in time is achieved.

CN119271452APending Publication Date: 2025-01-07HUAWEI TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202311382360.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2023-07-04
Filing Date
2023-10-23
Publication Date
2025-01-07

AI Technical Summary

Technical Problem

In existing technologies, the process of restoring database data to a specified point in time consumes computing power of computing nodes and occupies bandwidth between computing nodes and storage nodes, affecting the normal operation of database services.

Method used

By having the primary storage device perform the data recovery process within the storage system, and utilizing backup data and archived logs from the backup storage device, data recovery can be performed directly on the storage device without the need for computing devices, ensuring the accuracy and efficiency of data recovery.

Benefits of technology

It saves computing resources and bandwidth, ensures the smooth operation of database services, and achieves accurate data recovery to a specified point in time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119271452A_ABST
    Figure CN119271452A_ABST
Patent Text Reader

Abstract

The invention provides a data recovery method, device and system, relates to the technical field of storage, and aims to save resources in a data recovery process and ensure smooth operation of database services. The method comprises the steps that a data recovery instruction is received, the data recovery instruction comprises a specified time point, and the data recovery instruction is used for instructing data of a database to be recovered to the specified time point; based on the backup data in the backup storage device, full backup data with the backup time earlier than the specified time point is obtained; based on an archiving log of a database stored in the backup storage device, the archiving log is obtained, the archiving log comprises a plurality of logs generated before the specified time point and after the backup time of the total backup data, and the serial numbers of the logs are continuous; performing data recovery on the database according to the total backup data and the archiving log to obtain data of the database at a specified time point; and storing the data at the specified time point.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application claims the priority of the Chinese patent application filed with the State Intellectual Property Office on July 4, 2023, with application number 202310813094.3 and application name “A Database Backup and Recovery Method”, all contents of which are incorporated by reference in this application. Technical Field

[0002] The present application relates to the field of storage technology, and in particular to a data recovery method, device and system. Background Art

[0003] In the field of storage technology, the reliability of data in a database directly affects the service quality. To ensure the reliability of data in a database, the data in the database is usually backed up so that the data in the database can be restored according to the backup data when a database failure occurs.

[0004] One way of data recovery is point-in-time recovery (PITR), which is to restore the data in the database to the data at a specified point in time. During the specified point in time recovery process, the database application for database management deployed in the computing node reads the backup data and archived database logs from the backup storage system, and restores the data to the specified point in time based on the backup data and database logs.

[0005] In the above data recovery method, the database application reads the backup data and database logs, and after the data at the specified time point is recovered, the recovered data is stored in the database in the storage node. This process consumes the computing power of the computing node and occupies the bandwidth between the computing node and the storage node, which may affect the normal operation of the database business. Summary of the invention

[0006] The present application provides a data recovery method, device and system, which can save resources during data recovery and ensure the smooth operation of database services.

[0007] This application adopts the following technical solutions:

[0008] In the first aspect, the present application provides a data recovery method, which is applied to a main storage device in a storage system, and the storage system includes a computing device, a main storage device, and a backup storage device, wherein a database management system is running on the computing device, the main storage device is used to store the data and logs of the database, and the backup storage device is used to store the backup data and archive logs of the database. The method includes: receiving a data recovery instruction, the data recovery instruction is used to instruct to restore the data of the database to a specified time point; and based on the backup data in the backup storage device, obtaining full backup data with a backup time earlier than the specified time point; and based on the archive log of the database stored in the backup storage device, obtaining an archive log, the archive log includes multiple logs generated before the specified time point and after the backup time of the full backup data, and the serial numbers of the multiple logs are continuous; then based on the obtained full backup data and archive logs, recover the database data to obtain the data of the database at the specified time point; and store the data at the specified time point.

[0009] In the present application, the storage device performs a data recovery process based on the backup data and archive logs, and the storage space managed by the storage device stores the recovered data. Compared with the solution in which the computing device performs data recovery based on the backup data and archive logs obtained from the backup storage device, and then sends the recovered data to the main storage device for storage, the solution of the present application does not require the computing device to participate in data recovery, thus saving the resources of the computing device. In addition, the data recovery process is performed by the storage device, and the data recovery process does not require the storage device to interact with the computing device for data transmission, which can save the bandwidth of the computing device and ensure that the computing device has sufficient resources to run the database business, thereby ensuring the smooth operation of the database business.

[0010] Furthermore, compared to the case where the archived log sequence numbers are discontinuous, the data corresponding to the missed logs cannot be recovered, resulting in the inability to restore the data to a specified point in time. In the solution of the present application, since the sequence numbers of the archived logs used for data recovery are continuous (i.e., no logs are missed), the storage device can restore the data to a specified point in time based on the full backup data and complete logs earlier than the specified time point, thereby ensuring the accuracy of data recovery.

[0011] In one possible implementation, the backup data of the above-mentioned database is a data snapshot, and the data recovery method provided in the present application also includes: receiving a data backup instruction, which is used to instruct to back up the data of the database; and generating a data snapshot of the database; and writing the data snapshot to a backup storage device in the form of a full backup or an incremental backup.

[0012] In the present application, the data backup process is completed by the main storage device, and the database management system in the computing device does not need to participate in the data backup, which can save the resources of the computing device. In addition, the data backup process does not require the storage device to interact with the computing device for data transmission, which can save the bandwidth of the computing device.

[0013] In one possible implementation, the archived log is a log snapshot, and the data recovery method provided by the present application also includes: receiving a log archiving instruction, where the log archiving instruction is used to instruct to archive the log of the database; generating a log snapshot of the database at a specified time interval, wherein the serial numbers of the multiple logs contained in two consecutive log snapshots are continuous; and writing the log snapshot to a backup storage device in the form of a full backup or an incremental backup.

[0014] Due to the log recycling mechanism, some of the logs with serial numbers generated by the computing device may be recycled before being archived to the backup storage device, so that the logs with these serial numbers cannot be archived to the backup storage device. In the subsequent data recovery process, the serial numbers of the logs (used for data recovery) obtained based on the archived logs in the backup storage device are discontinuous. In the present application, the logs are not recycled before the data protected by the logs are backed up by snapshots. In the present application, in the process of log archiving, the logs of the database are archived in the form of log snapshots, and it is ensured that the logs contained in the continuous snapshots are complete logs, that is, it is ensured that the logs are not missed, so that when data recovery is performed based on the archived logs, it is helpful to smoothly achieve the specified point in time recovery (PITR).

[0015] In a possible implementation, before generating the log snapshot of the database at the specified time interval, the data recovery method provided by the present application further includes: recycling the log of the database; and when receiving the log archiving instruction, stopping recycling the log of the database. Usually the database has a log recycling mechanism, such as regular log recycling. When the log recycling cycle is reached, the primary storage device will recycle the log of the database stored therein.

[0016] In the present application, upon receiving a log recycling instruction, the primary storage device stops recycling logs, which ensures that the serial numbers of logs included in consecutive log snapshots are continuous, so that no logs are missed, thereby facilitating the smooth implementation of PITR.

[0017] In a possible implementation, the data recovery method provided by the present application further includes: when receiving a log archiving instruction, marking the logs generated within a specified time interval; after generating a log snapshot, recycling the marked logs. Marking the logs facilitates timely recycling of the logs that have been snapshotted in the primary storage device according to the marks, which can save storage space of the storage device.

[0018] In a possible implementation, the data recovery method provided by the present application further includes: obtaining the log of the database from the main storage device according to the log format of the database to mark the log and / or generate a log snapshot. The main storage device in the present application can sense the format of the log of the database, and then accurately and smoothly obtain the log according to the log format, so as to facilitate archiving the log.

[0019] In a possible implementation, when the archived log is a log stream, the data recovery method provided by the present application further includes: obtaining the log stream of the database according to the log format of the database; and writing the log stream of the database to a backup storage device. The log stream of the database is archived in a streaming manner. Since the serial numbers of the logs in the log stream are continuous, it is possible to ensure that the logs of the database are not missed, which is conducive to realizing the specified point in time recovery (PITR) of the data.

[0020] In one possible implementation, the above-mentioned data recovery of the database is performed based on the full backup data and the archived logs to obtain the data of the database at a specified point in time, including: taking the full backup data as the starting point, and recovering the database according to the arrangement order of the serial numbers of the logs in the archived logs to obtain the data of the database at the specified point in time.

[0021] In a second aspect, the present application provides a storage device, which is a main storage device in a storage system, and the storage system also includes a computing device and a backup storage device. A database management system runs on the computing device, the main storage device is used to store the data and logs of the database, and the backup storage device is used to store the backup data and archive logs of the database. The storage device includes various modules for implementing the method described in the first aspect and one of its possible implementations, such as a receiving module, an acquisition module, a data recovery module, a storage module, a generation module, a writing module, a log recovery module, a control module, and a marking module.

[0022] The storage device has the function of implementing the behavior in the method example of any one of the first aspect and its possible implementation methods. The function can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions.

[0023] In a third aspect, the present application provides a storage device comprising a memory and at least one processor connected to the memory, the memory being used to store computer program code, the computer program code comprising computer instructions, and when the computer instructions are executed by at least one processor, the storage device executes the method of the first aspect and any one of its possible implementations.

[0024] In a fourth aspect, the present application provides a computer-readable storage medium storing computer instructions, which, when executed on a computer, execute the method of the first aspect and any one of its possible implementations.

[0025] In a fifth aspect, the present application provides a computer program product, which includes computer instructions. When the computer instructions are run on a computer, the method of the first aspect and any one of its possible implementations is executed.

[0026] In a sixth aspect, the present application provides a chip system, comprising: a processor, configured to call and run a computer program from a memory, so that a storage device equipped with the chip system executes the method of the first aspect and any one of its possible implementations.

[0027] In the seventh aspect, the present application provides a storage system, including a computing device, a primary storage device and an auxiliary storage device; a database management system runs on the computing device, the primary storage device is used to store database data and logs, and the backup storage device is used to store database backup data and archive logs; the primary storage device is used to execute the method of any one of the first aspect and its possible implementation methods.

[0028] It should be understood that the beneficial effects achieved by the technical solutions of the second to seventh aspects of the present application and the corresponding possible implementation methods can be referred to the technical effects of the first aspect and its corresponding possible implementation methods mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] Figure 1 One of the architectural diagrams of a storage system provided in an embodiment of the present application;

[0030] Figure 2 A block diagram of a data backup and data recovery process provided in an embodiment of the present application;

[0031] Figure 3 A block diagram of a data backup and log archiving process provided in an embodiment of the present application;

[0032] Figure 4 A second schematic diagram of the architecture of a storage system provided in an embodiment of the present application;

[0033] Figure 5 A flowchart of a data backup method provided in an embodiment of the present application;

[0034] Figure 6 A block diagram of a full data backup process provided in an embodiment of the present application;

[0035] Figure 7A block diagram of an incremental data backup process provided in an embodiment of the present application;

[0036] Figure 8 One of the flow charts of a log archiving method provided in an embodiment of the present application;

[0037] Fig. 9 A log archiving process framework provided in an embodiment of the present application Figure 1 ;

[0038] Fig.10 A second flow chart of a log archiving method provided in an embodiment of the present application;

[0039] Fig.11 A log archiving process framework provided in an embodiment of the present application Figure 2 ;

[0040] Fig.12 One of the flow charts of a data recovery method provided in an embodiment of the present application;

[0041] Fig.13 A second flowchart of a data recovery method provided in an embodiment of the present application;

[0042] Fig.14 One of the structural schematic diagrams of a storage device provided in an embodiment of the present application;

[0043] Fig.15 The second structural diagram of a storage device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0044] The term "and / or" in this article is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.

[0045] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.

[0046] In the description of the embodiments of the present application, unless otherwise specified, “plurality” means two or more.

[0047] First, some concepts and technical knowledge involved in a data recovery method, device and storage system provided in an embodiment of the present application are explained.

[0048] 1. Database (DB)

[0049] A database is an organized, shared collection of data stored in a storage device. The data in a database is organized, described, and stored according to a certain data model. The database has low redundancy, high data independence, and easy expansibility, and is shared by various users.

[0050] The database is managed by a database management system (DBMS), which is a software running in an operating system (DBMS can also be called a database application). Specifically, the database management system is used to establish, use and maintain the database, and to uniformly manage and control the database to ensure the security and integrity of the database.

[0051] It can be understood that the above database and database management system constitute a database system (DBS). The database is stored in a storage device, and the database management system runs on a computing device. Usually, users access the data in the database through the database management system, and database administrators can also maintain the database through the database management system.

[0052] 2. Data backup

[0053] Data backup refers to the process of copying all or part of the data from the storage medium (hard disk or storage array) of the computing device to other storage media for storage in order to prevent data loss due to operational errors or failures. Data backup can include full, partial and incremental backup.

[0054] Full backup refers to backing up all data at a certain point in time.

[0055] The advantage of full backup is that data recovery time is faster (since all data is backed up, data recovery can be completed by simply reading the backup data and then writing the data to the primary storage device). The disadvantage of full backup is that there is a large amount of duplicate information in the backup data. In addition, since the amount of data that needs to be backed up each time is quite large, the backup takes a long time.

[0056] Incremental backup refers to the backup pointer after the last backup (the last backup may be a full backup or an incremental backup). Each subsequent backup only needs to back up the added or modified data compared to the previous backup.

[0057] The advantage of incremental backup is that there is no duplicate backup data, so the amount of backup data is not large and the backup time is short. The disadvantage of incremental backup is that data must be restored based on the last full backup data and all incremental backup data, and the data recovery time is longer.

[0058] 3. Log Archiving

[0059] Databases all have transaction logs that record all transactions and the changes made to the database by each transaction. In other words, the database log is a record of the operation performed on the database data. The log is an important component of the database. If the system fails, the transaction log may be needed to restore the database.

[0060] For databases, log archiving refers to the process of saving the database log files to a separate storage device for long-term storage. Log archiving is an important backup and recovery strategy that can ensure the data integrity and reliability of the database.

[0061] The main uses of log archiving include: it can be used for database backup, database recovery, database rollback, and database replication.

[0062] It should be understood that a log includes at least the following information: the time point of the operation on the database, the log sequence number, and the modified content. Based on the log of the database, it is possible to determine what operations have been performed on the database. For example, based on log 1, it can be known that at time point 1, a deletion operation was performed on data 1 in the database, and based on log 2, it can be known that at time point 2, a modification operation was performed on data 2 in the database, and data 2 was modified to data 3.

[0063] 4. Data recovery

[0064] Data recovery means restoring the database data to the data before the failure through some technical means when the data cannot be read or lost due to storage medium failure, human error, operating system failure, etc.

[0065] The data recovery involved in the embodiment of the present application is based on backup data for data recovery. One data recovery method is to restore the data of the database to the data before the failure occurs based on the backup data. Another data recovery method is to restore the data of the database to a specified arbitrary time point before the failure occurs based on the backup data, i.e., point-in-time recovery (PITR). It should be understood that the data recovery performed in the embodiment of the present application is PITR, and PITR also needs to rely on archived logs.

[0066] Combine the following Figure 1 The storage system architecture diagram shown in FIG. 1 is an exemplary introduction to the storage system. Figure 1The storage system shown is a storage system with separated storage and computing, and the storage system includes a computing node cluster and a storage node cluster. The computing node cluster includes one or more computing nodes 110 ( Figure 1 Two computing nodes 110 are shown in FIG. 1 , but are not limited to two computing nodes 110 . Each computing node 110 can communicate with each other. The storage node cluster includes multiple storage nodes 120 ( Figure 1 Two storage nodes 120 are shown in the figure, but are not limited to two storage nodes 120). A storage node may also be referred to as a storage device.

[0067] The computing node 110 is a computing device, such as a server, a desktop computer, or a storage array controller. Figure 1 As shown, the computing node 110 at least includes a processor 1101, a memory 1102 and a network card 1103. Among them, the processor 1101 is a central processing unit (CPU), which is used to process data access requests from outside the computing node 110, or requests generated inside the computing node 110. A database management system runs on the computing node, and the database management system includes different database components, such as SQL parser, SQL optimizer, buffer pool, storage engine and other components. For example, for a Mysql database, its database management system includes an SQL engine and a storage engine. The storage engine is mainly responsible for managing the arrangement, data format and writing mode of data, and the SQL engine is responsible for semantic parsing and executing operations on the database. The database application is implemented by the processor 1101 in the computing node 110 running the database application program to implement the functions of the database application. Therefore, the following actions performed by the database management system can be directly described as the processor 1101 performing the action.

[0068] Exemplarily, when the processor 1101 (specifically, the database management system) receives a write request to the database sent by the user device, the data in the write request can be temporarily stored in the memory 1102. When the total amount of data in the memory 1102 reaches a certain threshold, the processor 1101 sends the data stored in the memory 1102 to the storage node 120 for persistent storage.

[0069] In addition, the processor 1101 is also used to calculate or process data, such as metadata management, duplicate data deletion, data compression, virtualized storage space, and address conversion. Figure 1 Only one CPU is shown in the figure. In actual applications, the computing device 110 may include multiple CPUs, wherein one CPU may have one or more CPU cores. The embodiment of the present application does not limit the number of CPUs and the number of CPU cores.

[0070] The memory 1102 of the computing node 110 refers to an internal memory that directly exchanges data with the processor 1101. It can read and write data at any time and at a high speed, and serves as a temporary data storage for the operating system or other running programs. The memory 1102 may include at least two types of memories, for example, the memory 1102 may be either a random access memory (RAM) or a read only memory (ROM).

[0071] For example, RAM is dynamic random access memory (DRAM) or storage class memory (SCM). DRAM is a semiconductor memory, and like most random access memories, it is a volatile memory device. SCM is a composite storage technology that combines traditional storage devices with memory characteristics. SCM can provide faster read and write speeds than hard disks, but the access speed is slower than DRAM and the cost is cheaper than DRAM. Optionally, DRAM and SCM are only exemplary descriptions in the embodiments of the present application, and memory 1102 may also include other random access memories, such as static random access memory (SRAM).

[0072] For example, the ROM may be a programmable read only memory (PROM), an erasable programmable read only memory (EPROM), etc.

[0073] In addition, the memory 1102 may also be a dual in-line memory module (DIMM), that is, a module composed of a dynamic random access memory (DRAM), and the memory 1102 may also be a solid state disk (SSD).

[0074] Optionally, in actual applications, multiple memories 1102 and different types of memories 1102 may be configured in the computing node 110. The embodiment of the present application does not limit the number and type of memory 1102. In addition, the memory 1102 may be configured to have a power-saving function. The power-saving function means that when the system loses power and then powers on again, the data stored in the memory 1102 will not be lost. A memory with a power-saving function is called a non-volatile random access memory (NVRAM), a non-volatile dual in-line memory module (NVDIMM). For example, the NVRAM may be a double data rate synchronous dynamic random access memory (DDR SDRAM).

[0075] The network card 1103 of the computing device 110 is used to communicate with the storage node 120. For example, when the total amount of data in the memory 1102 reaches a certain threshold, the computing node 110 can send a request to the storage node 120 through the network card 1103 to store the data persistently. In addition, the computing node 110 can also include a bus for communication between the components inside the computing node 110. Figure 1 The main function of the computing node 110 in the system is computing services. When storing data, remote storage can be used to achieve persistent storage. Therefore, it has less local storage than a conventional server, thereby saving costs and space. However, this does not mean that the computing node 110 cannot have local storage. In actual implementation, the computing node 110 can also have a small number of hard disks built in or externally connected.

[0076] Combination Figure 1 Any computing node 110 can access any storage node 120 in the storage node cluster through the network. The storage node can be, for example, a server, a desktop computer, or a controller or a hard disk enclosure of a storage array.

[0077] A storage node 120 includes one or more controllers (or control units) 1201, a network card 1202, and multiple hard disks 1203. The network card 1202 is used to communicate with the computing node 110. The hard disk 1203 is used to store data and can be a disk or other types of storage media, such as a solid-state hard disk or a shingled magnetic recording hard disk. The controller 1201 is used to write data to the hard disk 105 or read data from the hard disk 1203 according to the data read / write request sent by the computing node 110. In the process of reading and writing data, the controller 1201 needs to convert the address carried in the data read / write request into an address that the hard disk can recognize. It can be seen that the controller 1201 also has some simple computing functions.

[0078] In practical applications, the controller 1201 may have a variety of forms. In one case, the controller 101 includes a CPU and a memory. The CPU is used to perform operations such as address conversion and reading and writing data. The memory is used to temporarily store data to be written to the hard disk 1203, or read from the hard disk 1203 to be sent to the computing node 110. In some cases, the controller 1201 is a programmable electronic component, such as a data processing unit (DPU). The DPU has the versatility and programmability of the CPU, but is more specialized and can efficiently run network data packets, storage requests or analysis requests. Unlike the CPU, the DPU has a greater degree of parallelism (needs to process a large number of requests). Optionally, the DPU can also be replaced with processing chips such as graphics processing units (GPUs) and embedded neural-network processing units (NPUs).

[0079] Generally, the number of controllers 1201 may be one, two or more. When the storage node 120 includes at least two controllers 1201, the hard disk 1203 and the controller 1201 may have an ownership relationship. When the hard disk 1203 and the controller 1201 have an ownership relationship, each controller can only access the hard disk that belongs to it. If the storage space is insufficient, when adding a new hard disk 1203 in the storage node 120, the ownership relationship between the hard disk 1203 and the controller 1201 needs to be re-bound.

[0080] In another embodiment, the functions of the controller 1201 can be offloaded to the network card 1202. In other words, the storage node 120 does not have a controller 1201 inside, but the network card 1202 completes data reading and writing, address conversion and other computing functions. In this case, the network card 1202 is an intelligent network card, which can include a CPU and a memory. The CPU is used to perform operations such as address conversion and reading and writing data, and the memory is used to temporarily store data to be written to the hard disk 1203, or read from the hard disk 1203 to be sent to the computing node 110. In this case, there is no ownership relationship between the network card 1202 and the hard disk 1203 in the storage node 120, and the network card 1202 can access any hard disk 1203 in the storage node 120, so when the storage space is insufficient, the hard disk can be expanded more conveniently.

[0081] According to the above content, it can be known that the storage node cluster includes multiple storage nodes 120. In actual use, some of the multiple storage nodes 120 can be primary storage nodes, and some storage nodes are backup storage nodes. That is to say, the database data is stored in the primary storage node, and the backup data of the data in the primary storage node is stored in the backup storage node for use in data recovery.

[0082] At present, in the field of storage technology, the data backup, log archiving and data recovery processes of the database must be controlled by the data management system running in the computing node, and implemented through interaction between the computing node, the primary storage node and the backup storage node. This will consume the computing power of the settlement node, and the data transmission between the computing node and the storage node will occupy a certain amount of bandwidth, which will affect the normal operation of the database business.

[0083] refer to Figure 2 In (a), a data backup method is that the database administrator sends a data backup instruction to the database management system through a backup recovery tool, and then the database management system reads data from the primary storage device and writes the data to the backup storage device. The data backup process specifically includes the following steps ① to ④.

[0084] Step 1: Receive data backup instructions.

[0085] The database administrator or user sends a data backup instruction to the database management system through the backup and recovery tool to trigger the data backup process. After receiving the data backup instruction, the data management system starts data backup.

[0086] Step ②: The database management system sends a data read request to the primary storage device to read the backup data.

[0087] Step ③: The database management system obtains the database data (for backup) from the primary storage device as backup data.

[0088] The backup data read by the database management system from the primary storage device can be full data or incremental data (i.e., differential data). That is, the data backup can be a backup of the full data of the database (i.e., full data backup) or a backup of the differential data of the database (difference data after the last backup time point) (i.e., incremental data backup).

[0089] Optionally, if an incremental backup is performed on the database data, then in the above step ②, the data read request sent by the database management system to the primary storage device is a read request for reading differential data. For example, the data read request may be a getDelta instruction, so that the primary storage device returns differential data relative to the data at the last backup time point to the data management system.

[0090] Step ④: The database management system writes the backup data into the backup storage device.

[0091] During the above data backup process, the backup data needs to be transmitted between the storage device and the computing device, which will occupy the bandwidth between the computing device and the storage device.

[0092] Based on the above Figure 2 For the data backup method in (a), refer to Figure 2 In (b), a data recovery method is that the database administrator sends a data recovery instruction to the database management system through a backup recovery tool, and then the database management system reads the backup data from the backup storage device, performs data recovery, and then writes the recovered data to the main storage device. The data recovery process specifically includes the following steps ①'-④'.

[0093] Step ①', receiving a data recovery instruction.

[0094] When a database failure occurs and data recovery is required, the database administrator or user sends a data recovery instruction to the database management system through the backup and recovery tool to trigger the data recovery process. After receiving the data recovery instruction, the data management system starts to recover the database data.

[0095] Step ②': the database management system sends a data read request to the backup storage device to read the backup data from the backup storage device.

[0096] Step ③': the database management system restores the data in the database according to the read backup data.

[0097] Combined with the description of the above backup process, if the data backup method is full data backup, the backup data read is the full backup data, the full backup data is the restored data, and the data restoration process is a full restoration process.

[0098] If the data backup method is incremental backup, the backup data read is a backup set for incremental recovery, which includes a full backup data and at least one incremental backup data. In other words, first select a backup set for incremental recovery, use the full backup data and incremental backup data in the backup set to first restore the full data corresponding to the last backup, and then apply the incremental backup data that saves the time point difference to the restored full data to obtain the restored data. The data recovery process is an incremental recovery process.

[0099] Step ④': the database management system writes the recovered data to the primary storage device.

[0100] After the database data is restored to the primary storage device, the database management system can read the data from the primary storage device into the memory and continue to execute the database business.

[0101] The above data backup process can restore data to the data before the failure. Since the data recovery method cannot obtain the log of the database (the log is not archived), it cannot achieve point-in-time recovery (PITR).

[0102] refer to Figure 3 In another method, the database management system includes a main database management system and an auxiliary database management system. The auxiliary database management system serves as a backup system for the main database management system. When the main database management system fails, the auxiliary database management system takes over the work of the main database management system. The main database management system generates database data and logs when running database services. The auxiliary database management system can synchronize the logs generated by the main database management system and generate the same data as the main database management system based on the logs and existing data.

[0103] refer to Figure 3 Another data backup method is: the auxiliary database management system assists in data backup. The database administrator sends data backup instructions to the backup software through the backup and recovery tool. After that, the backup software notifies the auxiliary database management system to take a snapshot of the data generated by the auxiliary database management system and obtains the data snapshot from the auxiliary database management system. The backup software writes the data snapshot to the backup storage device.

[0104] refer to Figure 3One log archiving method is: the auxiliary database management system assists in log archiving, and the database administrator sends a log archiving instruction to the backup software through the backup recovery tool. After that, the backup software obtains the log stream from the auxiliary database management system (the log stream is the log synchronized by the auxiliary database management system from the primary database management system), and then writes the log stream to the backup storage device.

[0105] Optionally, the storage mode of the backup storage device may be object storage, and the data snapshot is stored in a snapshot bucket, and the log is stored in a log bucket.

[0106] Based on the above data backup method, the data of the database can be restored, and combined with the above archive log, the database data can also be restored in time (PITR). PITR starts from a starting point, reads each log in the archive log one by one, and restores the backup data (such as redo) according to the data operations recorded in the log, and then writes the restored data back to the primary storage device.

[0107] In the above data backup and log archiving process, the backup data and logs need to be transmitted between the storage device and the computing device, which will occupy the bandwidth between the computing device and the storage device. In addition, the data recovery process is also performed by the computing device to perform specific data recovery actions (such as redoing data according to the log), which will consume the resources of the computing device.

[0108] In view of the above problems, the present application provides a data recovery method, in which the main storage device performs the data recovery process, referring to Figure 4 In the architecture of the storage system, a database management system is run in the computing device, and the information generated by the database management system includes data, logs, and metadata, all of which are stored in the primary storage device. A backup and recovery service is deployed in the primary storage device, and the backup and recovery service is used to perform data backup, log archiving, and data recovery processes. When performing data recovery, after the primary storage device receives the data recovery instruction, it can obtain the full backup data and archive logs for recovery at a specified time point based on the backup data and archive logs in the backup storage device, and then restore the database data to the specified time point based on the full backup data and archive logs.

[0109] In the technical solution provided by the present application, data recovery is performed by a storage device, and there is no need for a computing device to participate in the data recovery process. This can save resources of the computing device and save bandwidth of the computing device.

[0110] The technical solution provided in the embodiments of the present application can be applied in a storage system including a computing device, a primary storage device and a backup storage device, wherein a database management system (i.e., a database management system) runs on the computing device, the primary storage device is used to store database data and logs, and the backup storage device is used to store database backup data and archived logs.

[0111] It can be understood that the premise of the data recovery method provided in the embodiment of the present application is data backup and log archiving, that is, data recovery needs to rely on the backup data and archived logs stored in the backup storage device. Figure 4 The schematic diagram of the storage system architecture shown introduces the data backup method and log archiving method provided in the embodiments of the present application.

[0112] like Figure 5 As shown, the data backup method provided in the embodiment of the present application includes S501-S503.

[0113] S501: A primary storage device receives a data backup instruction.

[0114] The database administrator or user sends a data backup instruction to the primary storage device through the backup and recovery tool to trigger the data backup process. The backup and recovery service in the primary storage device responds to the data backup instruction and starts to perform data backup.

[0115] Optionally, data backup includes full backup and incremental backup. During the data backup process, the data backup instruction issued by the database administrator or user may be a full backup instruction or an incremental backup instruction, which is not limited in the embodiments of the present application.

[0116] S502: The primary storage device generates a data snapshot of the database.

[0117] In an embodiment of the present application, when the primary storage device receives a data backup instruction, it takes a snapshot of the storage volumes in the database that are related to the current business, for example, it takes a snapshot of the storage volumes in the database used to store data, or it takes a consistency snapshot of the storage volumes in the database. A consistency snapshot refers to taking a snapshot of a volume group (which may be called a consistency group) consisting of storage volumes for storing data (pages) of the same business, storage volumes for storing logs, and storage volumes for storing metadata.

[0118] S503: The primary storage device writes the data snapshot to the backup storage device.

[0119] According to the description of the above embodiments, data backup includes full backup and incremental backup. In S503, the primary storage device can write the data snapshot to the backup storage device in a full backup or incremental backup manner according to the instruction of the data backup instruction.

[0120] Optionally, in the embodiment of the present application, in the process of backing up the data of the database, invalid data can be skipped and only valid data can be copied to achieve efficient data backup. It should be understood that invalid data can include all zero data or some data with unallocated storage space (for example, metadata describes that some data has no allocated storage space).

[0121] refer to Figure 6 If the data backup instruction indicates to perform a full data backup (i.e., a full backup instruction is issued to the primary storage device), the backup recovery service in the primary storage device responds to the full backup instruction, takes a snapshot of the current consistency group of the database, obtains snapshot T0, and then writes snapshot T0 to the backup storage device. Snapshot T0 is the full data of the database at the time of taking the snapshot.

[0122] refer to Figure 7 If the data backup instruction indicates to perform incremental data backup (i.e., the incremental backup instruction is sent to the primary storage device), the backup recovery service in the primary storage device responds to the incremental backup instruction and takes a snapshot of the current consistency group of the database to obtain a snapshot T x , and determine the current snapshot T x The snapshot difference T between the last snapshot (for example, the last snapshot is T0, that is, the last backup is a full backup) x -T0, and then the snapshot difference T x -T0 writes to the backup storage device.

[0123] The above data backup process is completed by the backup and recovery service in the primary storage device, and there is no need for the database management system in the computing device to participate in the data backup, which can save the resources of the computing device. In addition, the data backup process does not require the storage device to interact with the computing device for data transmission, which can save the bandwidth of the computing device.

[0124] Based on the above data backup method, when a failure occurs and the database data needs to be restored, the database data can be restored to the state before the failure based on the backup data.

[0125] Furthermore, based on the above data backup method, it can be known that in the process of data backup based on snapshot technology, a consistent snapshot is taken of the relevant storage volumes in the database, and the consistent snapshot includes a log snapshot, that is, the database log is also backed up, but it is still difficult to use the log in the consistent snapshot to restore the database to a point in time. The specific reason is that the database has a log recovery mechanism, and the log between two consecutive snapshots may have a discontinuous serial number of the backed up log due to log recovery between the two snapshots. Therefore, in the process of data recovery based on the backup data and logs, the data cannot be restored to any point in time due to omissions in the logs.

[0126] For example, assume that two consecutive snapshots are snapshot T0 and snapshot T1, and the time points of taking the snapshots are the first time point and the second time point. If 5 operations are performed on the data between the first time point and the second time point, that is, 5 logs are generated between the first time point and the second time point, in one case, after taking a snapshot at the first time point and before taking a snapshot at the second time point, the storage device recycles the database logs once and recycles 2 logs. Then, when taking a snapshot at the second time point, snapshot T1 only includes the last 3 of the above 5 logs (the first 2 logs are recycled). It can be seen that there are omissions in the logs, that is, there are omissions in the transaction time points between two consecutive snapshots. Then, when restoring the data to a time point between the first time point and the second time point based on snapshot T0, due to the discontinuity of the logs, the data at that time point cannot be restored based on snapshot T0, that is, PITR cannot be achieved.

[0127] In order to solve the problem that PITR cannot be achieved due to discontinuous log sequence numbers, the present application proposes a log archiving method, which can ensure that the logs between two consecutive snapshots are not missed in the archived logs (that is, the log sequence numbers are continuous). Figure 8 As shown, the embodiment of the present application provides a log archiving method including S801-S804.

[0128] S801: The primary storage device receives a log archiving instruction.

[0129] The database administrator or user sends a log archiving instruction to the primary storage device through the backup and recovery tool to trigger the log archiving process. The backup and recovery service in the primary storage device responds to the log archiving instruction and starts to execute log archiving.

[0130] S802: The primary storage device stops recycling database logs.

[0131] It is understandable that the database usually has a log recycling mechanism, such as regular log recycling. When the log recycling cycle is reached, the primary storage device will recycle the logs of the database stored therein. In the embodiment of the present application, to ensure that the logs included in the continuous log snapshots are not missed, the primary storage device stops recycling logs upon receiving the log backup instruction.

[0132] S803: The primary storage device generates a log snapshot of the database at a specified time interval.

[0133] The sequence numbers of multiple logs included in two consecutive log snapshots are continuous.

[0134] In the embodiment of the present application, the primary storage device responds to the log archiving instruction and starts an automatic continuous data protection mechanism, that is, continuously taking snapshots of the database log (or the consistency group of the database) at specified time intervals.

[0135] Optionally, the above-mentioned specified time interval can be set according to actual needs. For example, the specified time interval can be set to 20 seconds, 30 seconds, etc.

[0136] In some embodiments, when the primary storage device receives a log archiving instruction, the backup and recovery service in the primary storage device may also mark the logs generated within a specified time interval, and after generating a log snapshot within a time interval, recycle the marked logs within the time interval.

[0137] In one implementation, a log format perception module is also deployed in the main storage device, so that the main storage device can perceive the log format of the database. It should be understood that the log format perception module can perceive the log format of some open source databases (such as MySQL, PostgreSQL, etc.), which means that the databases in the embodiments of the present application are all open source data, or are non-open source databases developed by the manufacturer (the log format can be known).

[0138] Based on the above-mentioned log format perception module, in the embodiment of the present application, the main storage device can obtain the log of the database from the main storage device according to the log format of the database, that is, identify the log of the database to mark the log and / or generate a log snapshot. For example, when marking the log of the database, it is necessary to first identify which information is the log, and then mark the log; for another example, when taking a snapshot of the log of the database, it is also necessary to first identify which information is the log, and then smoothly take a snapshot of the log.

[0139] S804: The primary storage device writes the log snapshot to the backup storage device.

[0140] Due to the log recycling mechanism, some of the logs with serial numbers generated by the computing device may be recycled before being archived to the backup storage device, so that the logs with these serial numbers cannot be archived to the backup storage device. In the subsequent data recovery process, the serial numbers of the logs obtained based on the archived logs of the backup storage device are not continuous. In the embodiment of the present application, in the process of archiving the logs of the database through the above S801-S804, the recovery of the logs of the database can be delayed, and it is ensured that the logs included in the continuous snapshots are complete logs, that is, it is ensured that the logs are not missed, so that when performing data recovery based on the archived logs, it is conducive to achieving PITR.

[0141] Optionally, similar to the above data backup, log archiving can be full archiving of logs or incremental archiving of logs. Fig. 9 Taking incremental archiving of logs as an example, the primary storage device takes snapshots of the database logs. For example, the log snapshots obtained at three consecutive time intervals are snapshots T0, T1, T2, and T3. a , Snapshot T a+1 and snapshot T a+2 , store snapshot T0 as a full log snapshot to the backup storage device. Subsequently, store the snapshot differences in the form of incremental backup. The primary storage device reads the snapshot differences of consecutive snapshots, such as snapshot differences T0-T a , snapshot difference T a+1 -T a and the snapshot difference T a+2 -T a+1 , and writes the snapshot differences to the backup storage device.

[0142] Optionally, after writing the log snapshot (full or incremental) at a time point to the backup storage device, if the log snapshot corresponding to the previous time point will not be used later, the previous log snapshot in the primary storage device can be deleted. Marking the logs makes it easier to timely recycle the logs that have been snapshotted in the primary storage device according to the marks, which can save storage space of the primary storage device.

[0143] In order to solve the problem that PITR cannot be achieved due to discontinuous log sequence numbers, the present application embodiment proposes another log archiving method, which can ensure that the archived logs are not missed (that is, the log sequence numbers are continuous). Fig.10 As shown, an embodiment of the present application provides a log archiving method including S1001-S1003.

[0144] S1001. The primary storage device receives a log archiving instruction.

[0145] S1002: The primary storage device obtains a log stream of the database according to the log format of the database.

[0146] Similar to S803 above, a log format perception module is deployed in the main storage device, so that the main storage device can perceive the log format of the database and accurately and smoothly obtain the database log from the main storage device according to the log format of the database, that is, identify the database log.

[0147] S1003: The primary storage device writes the log stream to the backup storage device.

[0148] It should be understood that in this implementation, when the primary storage device archives logs, it archives the log stream of the database in a streaming manner. The logs in the log stream are continuous, which can ensure that no database logs are missed, which is conducive to achieving PITR.

[0149] refer to Fig.11 ,When archiving the logs of the database, after the log format perception module in the ,primary storage device recognizes the logs, the backup and recovery service in the ,primary storage device reads the log stream and writes the log stream to the ,backup storage device.

[0150] Based on the above data backup and log archiving content, the embodiment of the present application provides a data recovery method, which is executed by the primary storage device, such as Fig.12 As shown, the method includes S1201-S1205.

[0151] S1201. Receive a data recovery instruction.

[0152] The data recovery instruction is used to instruct to recover the data of the database to a specified time point, and the specified time point may be any time point before the database failure occurs. Optionally, the data recovery instruction may include the specified time point.

[0153] S1202: Based on the backup data in the backup storage device, obtain the full backup data whose backup time is earlier than the specified time point.

[0154] In an embodiment of the present application, in the process of restoring data at a specified time point, the starting point of data recovery is first determined based on the checkpoint of the database (the starting point is earlier than the specified time point), and the data at the starting point is obtained (it should be understood that the data at the starting point is the full data).

[0155] In one case, when the backup data of the data at the starting point is full data, the data at the starting time point can be directly read from the backup data, and the read data is the full backup data of the starting point.

[0156] In another case, when the backup data of the starting point data is incremental data, the process of obtaining the starting point data (that is, the full backup data whose backup time is earlier than the specified time point) can specifically include: obtaining a full backup data that is earlier than the starting point and closest to the starting time point from the backup storage device, and based on the full backup data and the incremental data of the intermediate process, the full backup data corresponding to the starting point can be determined.

[0157] S1203. Obtain an archive log based on the archive log of the database stored in the backup storage device, where the archive log includes multiple logs generated before a specified time point and after a backup time of the full backup data, and the serial numbers of the multiple logs are continuous.

[0158] For the log archiving method of S801-S804 above, in the embodiment of the present application, firstly, a full log snapshot that is earlier than the above starting point and closest to the starting point is obtained from the archive log of the database; secondly, a target snapshot time point (referring to the time point of taking the snapshot) that is later than the above specified time point but closest to the specified time point is determined, and based on the above full log snapshot and the snapshot difference between them, all logs between the starting point and the target snapshot time point are restored, and all logs between the starting point and the specified time point are obtained as archive logs. Referring to the above log archiving method, it can be seen that the serial numbers of the logs in the obtained archive logs are continuous.

[0159] For the log archiving method of S1001-S1003 above, all logs between the starting point and the specified time point can be directly read from the log stream stored in the backup storage device as archived logs, and the serial numbers of the logs in the archived logs are continuous.

[0160] S1204. Recover the database based on the full backup data and archive logs to obtain the data of the database at a specified time point.

[0161] Combination Fig.12 ,like Fig.13 As shown, the above S1204 can be specifically implemented through S1204a.

[0162] S1204a. Starting from the full backup data, the database is restored according to the sequence number arrangement order of the logs in the archive log to obtain the data of the database at a specified time point.

[0163] Exemplarily, assuming that the specified time point is 12:00:15 (12:00:15), the full backup data obtained above is the data at 12:00:00, and the full backup data is T0. The archive log is the log from 12:00:00 to 12:00:30, and there are 4 logs between 12:00:00 and 12:00:30. The following is a brief illustration of the data recovery process with reference to the operations corresponding to the 4 logs in the example of Table 1 below.

[0164] Table 1

[0165] log Serial Number Timestamp operate Log 1 1 12:00:02 Delete data 1 Log 2 2 12:00:07 Add data 2 Log 3 3 12:00:10 Modify data 3 to data 4 Log 4 4 12:00:14 Add data 5

[0166] Combined with Table 1, the log sequence number from small to large indicates the time of log generation from early to late. Take T0 as the starting point of data recovery, and perform data recovery from Table 1 in the order of log sequence numbers from small to large. The details are as follows:

[0167] 1. According to the operation in log 1, delete data 1 from data T0 to obtain data T1.

[0168] 2. According to the operation in log 2, add data 2 to data T1 to obtain data T2.

[0169] 3. According to the operation in log 3, data 3 in data T2 is modified to data 4 to obtain data T3.

[0170] 4. According to the operation in log 4, add data 5 to data T3 to obtain data T4. Then T4 is the data at the specified time point 12:00:15.

[0171] S1205. Store data at a specified time point.

[0172] The primary storage device performs data recovery based on the backup data and archive logs to obtain the data at a specified time point, and stores the data at the specified time point in the storage space of the primary storage device so that the computing node can read and use the data later.

[0173] In summary, the data recovery method provided by the embodiment of the present application is that the storage device performs a data recovery process based on the backup data and the archive log, and the storage space managed by the storage device stores the recovered data. Compared with the solution in which the computing device performs data recovery based on the backup data and the archive log obtained from the backup storage device, and then sends the recovered data to the main storage device for storage, the solution of the present application does not require the computing device to participate in data recovery, so that the resources of the computing device can be saved. In addition, the data recovery process is performed by the storage device, and the data recovery process does not require the storage device to interact with the computing device for data transmission, which can save the bandwidth of the computing device and ensure that the computing device has sufficient resources to run the database business, thereby ensuring the smooth operation of the database business.

[0174] Furthermore, compared to the case where the archived log sequence numbers are discontinuous, the data corresponding to the missed logs cannot be recovered, resulting in the inability to restore the data to a specified point in time. In the solution of the present application, since the sequence numbers of the archived logs used for data recovery are continuous (i.e., no logs are missed), the storage device can restore the data to a specified point in time based on the full backup data and complete logs earlier than the specified time point, thereby ensuring the accuracy of data recovery.

[0175] It is understandable that the above data storage method is executed by a storage device, and the storage device includes a hardware structure and / or software module corresponding to each function in order to realize the above functions. It should be easily appreciated by those skilled in the art that, in combination with the method steps of each example described in the embodiments disclosed herein, the embodiments of the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the embodiments of the present application.

[0176] The embodiment of the present application can divide the functional modules of the above-mentioned storage device according to the above-mentioned method example. For example, each functional module can be divided corresponding to each function, or two or more functions can be integrated into one processing module. The above-mentioned integrated module can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.

[0177] In the case of dividing each functional module into corresponding functional modules, Fig.14 A possible structural diagram of the storage device involved in the above embodiment is shown. The storage device includes a receiving module 1401, an acquisition module 1402, a data recovery module 1403 and a storage module 1404.

[0178] Among them, the receiving module 1401 is used to execute S501, S801, S1001, and S1201 in the above method embodiments; the acquisition module 1402 is used to execute S1002, S1202, and S1203 in the above method embodiments; the data recovery module 1403 is used to execute S1204 (including 1204a) in the above method embodiments, and the storage module 1404 is used to execute S1205 in the above method embodiments.

[0179] Optionally, the storage device provided in the embodiment of the present application further includes a control module 1405, a log recovery module 1406, a generation module 1407, a writing module 1408, and a marking module 1409. The control module 1405 is used to execute S802 in the above method embodiment; the log recovery module 1406 is used to recover the logs of the database; the generation module 1407 is used to execute S502 and S803 in the above method embodiment; the writing module 1408 is used to execute S503, S804, and S1003 in the above method embodiment; and the marking module 1409 is used to mark the logs generated within a specified time interval.

[0180] The modules of the storage device may also be used to execute other actions in the method embodiment. All relevant contents of the steps involved in the method embodiment may be referred to the functional description of the corresponding functional modules and will not be repeated here.

[0181] In the case of an integrated unit, Fig.15 Another possible structural diagram of the storage device involved in the above embodiment is shown. Fig.15 As shown, the storage device provided in the embodiment of the present application may include: a processing module 1501 and a communication module 1502. The processing module 1501 may be used to control and manage the actions of the storage device. For example, the processing module 1501 may be used to support the above Fig.14 The acquisition module 1402, data recovery module 1403, control module 1405, log recovery module 1406, generation module 1407, writing module 1408 and marking module 1409 in the communication device may perform corresponding steps and / or other processes for the technology described herein. The communication module 1502 may be used to support the communication between the communication device and other network entities. For example, the communication module 1502 is used to perform the corresponding steps performed by the receiving module 1401. Fig.15 As shown, the communication device may also include a storage module 1503 for storing computer instructions and data (eg, storing recovered data).

[0182] The processing module 1501 may be a processor or a controller (for example, the processor 1501 may be Figure 1 The controller 1201 in the storage node 120 in the embodiment of the present invention) may be a combination of processors 1501 that implements computing functions, such as a combination of one or more microprocessors, a combination of DSP and microprocessors, etc. The communication module 1502 may be a communication interface (for example, the communication module 1502 may be Figure 1 The storage module 1503 may be a memory (for example, the storage module 1503 may be Figure 1 When the processing module 1501 is a processor, the communication module 1502 is a communication interface, and the storage module 1503 is a memory, the processor, the transceiver, and the memory may be connected via a bus.

[0183] For more details on how the modules included in the storage device implement the above functions, please refer to the descriptions in the previous method embodiments, which will not be repeated here. Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments.

[0184] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using a software program, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instruction is loaded and executed on a computer, the process or function in accordance with the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instruction can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instruction can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) mode or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, data center, etc. that includes one or more available media integrated. The available medium may be a magnetic medium (eg, a floppy disk, a magnetic disk, a magnetic tape), an optical medium (eg, a digital video disc (DVD)), or a semiconductor medium (eg, a solid state drive (SSD)).

[0185] Through the description of the above implementation methods, technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, device and unit described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0186] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0187] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0188] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0189] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art, or all or part of the technical solution. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) or a processor to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: flash memory, mobile hard disk, read-only memory, random access memory, disk or optical disk, and other media that can store program codes.

[0190] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A data recovery method, characterized in that: A main storage device applied to a storage system, the storage system comprising a computing device, the main storage device and a backup storage device, a database management system running on the computing device, the main storage device being used to store data and logs of the database, and the backup storage device being used to store backup data and archive logs of the database; the method comprising: Receiving a data recovery instruction; the data recovery instruction is used to instruct to recover the data of the database to a specified time point; Based on the backup data in the backup storage device, obtaining full backup data whose backup time is earlier than the specified time point; Based on the archive log of the database stored in the backup storage device, obtaining the archive log; the archive log includes a plurality of logs generated before the specified time point and after the backup time of the full backup data, and the serial numbers of the plurality of logs are continuous; Performing data recovery on the database according to the full backup data and the archive log to obtain the data of the database at the specified time point; The data at the specified time point is stored.

2. The method according to claim 1, characterized in that The backup data of the database is a data snapshot, and the method further includes: Receive a data backup instruction; the data backup instruction is used to instruct to back up the data in the database; Generate a data snapshot of the database; The data snapshot is written to the backup storage device in a full backup or incremental backup manner.

3. The method according to claim 1 or 2, characterized in that: The archive log is a log snapshot, and the method further includes: receiving a log archiving instruction, wherein the log archiving instruction is used to instruct to archive the logs of the database; Generate a log snapshot of the database at a specified time interval; wherein the serial numbers of the multiple logs included in two consecutive log snapshots are continuous; The log snapshot is written to the backup storage device in a full backup or incremental backup manner.

4. The method according to claim 3, characterized in that Before generating the log snapshot of the database at the specified time interval, the method further includes: Recovering logs of the database; When the log archiving instruction is received, the logs of the database are stopped from being recovered.

5. The method according to claim 3 or 4, characterized in that: The method further comprises: When receiving the log archiving instruction, marking the logs generated within the specified time interval; After the log snapshot is generated, the marked log is recycled.

6. The method according to any one of claims 3 to 5, characterized in that: The method further comprises: According to the log format of the database, the log of the database is obtained from the primary storage device to mark the log and / or generate a log snapshot.

7. The method according to claim 1 or 2, characterized in that: The archive log is a log stream, and the method further includes: According to the log format of the database, obtaining the log stream of the database; The log stream of the database is written into the backup storage device.

8. The method according to any one of claims 1 to 7, characterized in that: The restoring the database according to the full backup data and the archive log to obtain the data of the database at the specified time point includes: Taking the full backup data as a starting point, data recovery is performed on the database according to the arrangement order of the serial numbers of the logs in the archive logs to obtain the data of the database at the specified time point.

9. A storage device, characterized in that: The storage device is a main storage device in the storage system, and the storage system further includes a computing device and a backup storage device. A database management system runs on the computing device. The main storage device is used to store the data and logs of the database, and the backup storage device is used to store the backup data and archive logs of the database. The storage device includes a receiving module, an acquisition module, a data recovery module and a storage module. The receiving module is used to receive a data recovery instruction; the data recovery instruction is used to instruct to recover the data of the database to a specified time point; The acquisition module is used to obtain the full backup data whose backup time is earlier than the specified time point based on the backup data in the backup storage device; The acquisition module is further used to obtain an archive log based on the archive log of the database stored in the backup storage device; the archive log includes a plurality of logs generated before the specified time point and after the backup time of the full backup data, and the serial numbers of the plurality of logs are continuous; The data recovery module is used to recover the database data according to the full backup data and the archive log to obtain the data of the database at the specified time point; The storage module is used to store the data at the specified time point.

10. The storage device according to claim 9, characterized in that: The backup data of the database is a data snapshot; the storage device also includes a generation module and a writing module; The receiving module is further used to receive a data backup instruction; the data backup instruction is used to instruct to back up the data in the database; The generating module is used to generate a data snapshot of the database; The writing module is used to write the data snapshot into the backup storage device in a full backup or incremental backup manner.

11. The storage device according to claim 9 or 10, characterized in that: The archived log is a log snapshot; The receiving module is further used to receive a log archiving instruction, where the log archiving instruction is used to instruct to archive the logs of the database; The generating module is further used to generate a log snapshot of the database at a specified time interval; wherein the serial numbers of the multiple logs included in two consecutive log snapshots are continuous; The writing module is used to write the log snapshot into the backup storage device in a full backup or incremental backup manner.

12. The storage device according to claim 11, characterized in that: The storage device also includes a log recovery module and a control module; The log recovery module is used to recover the logs of the database; The control module is used to control the log recovery module to stop recovering the logs of the database when the receiving module receives the log archiving instruction.

13. The storage device according to claim 11 or 12, characterized in that: The storage device also includes a marking module; The marking module is used to mark the logs generated within the specified time interval when the receiving module receives the log archiving instruction; The log recovery module is further used to recover the marked logs after generating the log snapshot.

14. The storage device according to any one of claims 11 to 13, characterized in that: The acquisition module is further used to acquire the log of the database from the primary storage device according to the log format of the database, so as to mark the log and / or generate a log snapshot.

15. The storage device according to claim 9 or 10, characterized in that: The archive log is a log stream; The acquisition module is further used to acquire the log stream of the database according to the log format of the database; The writing module is further used to write the log stream of the database into the backup storage device.

16. The storage device according to any one of claims 9 to 15, characterized in that: The data recovery module is specifically used to recover the data of the database based on the full backup data as the starting point and the arrangement order of the serial numbers of the logs in the archive log to obtain the data of the database at the specified time point.

17. A storage device, characterized in that: The method comprises a memory and at least one processor connected to the memory, wherein the memory is used to store computer program code, and the computer program code comprises computer instructions. When the computer instructions are executed by the at least one processor, the storage device executes the method according to any one of claims 1 to 8.

18. A storage system, characterized in that: It comprises a computing device, a primary storage device and an auxiliary storage device; a database management system is run on the computing device, the primary storage device is used to store the data and logs of the database, and the backup storage device is used to store the backup data and archive logs of the database; the primary storage device is used to execute the method according to any one of claims 1 to 8 to recover the data of the database.

19. A computer-readable storage medium, characterized in that: Computer instructions are stored, and when the computer instructions are executed on a computer, the method according to any one of claims 1 to 8 is executed.

Citation Information

Cited By

  • Distributed report file management method and system, electronic equipment and storage medium

    CN120448361A