A database backup method and related devices

By setting up a log data API interface on the database, the log data is obtained and stored in real time to a high-speed storage system, and combining aggregation and archiving, the problem that RPO in the existing technology cannot meet the minute level is solved, and the backup effect of RPO is 0 or close to 0 is achieved, reducing costs and maintaining database performance.

CN119377014BActive Publication Date: 2025-08-01SHENZHEN HUAWEI CLOUD COMPUTING TECHNOLOGIES CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411981245.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-08-01
Estimated Expiration
2044-12-31

AI Technical Summary

Technical Problem

Existing database backup methods cannot meet higher RPO (recovery point targets), especially data loss time below minute level, affecting database business performance.

Method used

Set up a log data API interface on the database, obtain log data in real time and store it in a high-speed storage system, and periodically aggregate and archive it to a low-speed storage system through periodic frequency aggregation and archive, combined with disk snapshot backup, to achieve a backup solution with RPO of 0 or close to 0.

Benefits of technology

The RPO of database backup is 0 or close to 0, which reduces the impact on database business performance, meets higher requirements application scenarios, and reduces costs to a certain extent.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119377014B_ABST
    Figure CN119377014B_ABST
Patent Text Reader

Abstract

The present application provides a database backup method and related devices. The method is applied in the field of databases and includes: a log data API is set on the database, and the log data generated by the database is obtained in a timely manner through the log data API and stored in the first storage system in a timely manner. The database backup method provided by the present application can achieve an RPO of 0 or close to 0, and can meet scenarios with higher requirements.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of databases, and in particular, to a database backup method and related devices. Background Art

[0002] Database backup is an important measure to ensure data security. When backing up a database, backup methods are usually considered from several dimensions such as recovery point objective (RPO), recovery time objective (RTO), and cost. RPO refers to the maximum time that data loss can be tolerated after a disaster or failure. In other words, RPO specifies the maximum time point to which data can be restored when a system or service fails. For example, if the RPO of a certain system is 4 hours, this means that if a disaster or failure occurs to the system, up to 4 hours of data loss can be tolerated. That is to say, the restored system should be able to restore the data state 4 hours before the disaster occurred. RTO refers to the longest time required to restore the system and service from the occurrence of a disaster or failure. For example, if the RTO of a certain application is 2 hours, this means that after a failure occurs, it is hoped that the system can resume normal operation within 2 hours.

[0003] Currently, the commonly used database backup method is to back up data such as data table files and log files in the database through backup software. When it is necessary to restore the database service, the database service is restored according to the backed-up data such as data table files and log files. The disadvantage of this backup method is that the RPO and RTO are relatively large. In particular, the RPO is usually at the day level and cannot be made smaller.

[0004] In order to reduce the RPO metric, an improved method was later adopted. The data table files and log files are backed up separately through backup software. Since the log files are relatively small, they can be backed up every few minutes. The data table files are relatively large and can be backed up daily or hourly. For example, the data table files are backed up daily or hourly, and the log files are backed up every 5 minutes. In this way, the RPO can be improved to the minute level. However, the RPO of this backup method can only reach the minute level and cannot meet scenarios with higher requirements. Summary of the Invention

[0005] This application provides a database backup method and related devices. The method has little impact on the performance of the database service. The database backup method provided by this application can achieve an RPO of 0 or close to 0, and can meet scenarios with higher requirements.

[0006] In a first aspect, the present application provides a database backup method, which includes: a log data API is set on the database, and the log data generated by the database is obtained in a timely manner through the log data API and stored in a first storage system. After obtaining the log data, the log data can be stored in a cache and then stored from the cache to the first storage system.

[0007] It can be seen that in the solution of the present application, a log data API interface for transmitting log data is set on the database. The database backup device can obtain the log data generated by the database in real time through the log data API and store the obtained log data in the first storage system in a timely manner. That is, for each log data generated by the database, the log data API transmits one log data, the database backup device obtains one log data and stores it in the first storage system. Implementing the method embodiment of the present application can achieve an RPO of 0 or close to 0. In addition, setting the log data API on the database and obtaining log data through the log data API does not affect the operation of the database service and has a small impact on the performance of the database service. The method embodiment of the present application can meet application scenarios with higher requirements.

[0008] Based on the first aspect, in a possible implementation, after storing the obtained log in the first storage system, the method further includes: periodically reading out the log data in the first storage system at a certain frequency (the first frequency), aggregating the read log data, storing the aggregated log data in a second storage system, and deleting the read log data from the first storage system, where the IOPS of the first storage system is higher than that of the second storage system, or in other words, compared with the second storage system, the medium of the first storage system is a high-speed medium and the throughput of the first storage system is greater than that of the second storage system.

[0009] It can be understood that the log data stored in the first storage system is at the KB level. Aggregating the log data in the first storage system, the aggregated log data can reach the MB level and be stored in the second storage system. The database system needs to write logs frequently. Setting the first storage system to have high IOPS can meet the need for continuous appending of log writing. However, due to the high cost of the first storage system with high IOPS, a second storage system with low IOPS is deployed. The second storage system is used to store historical log data (archived data). Deleting the archived log data from the first storage system can free up the storage space of the first storage system. In the embodiment of the present application, the first storage system and the second storage system are reasonably deployed, which not only meets the requirements of database backup but also reduces costs to a certain extent.

[0010] Based on the first aspect, in a possible implementation manner, the method further includes: periodically obtaining snapshot data of the disk where the database is located at a certain frequency (the second frequency), and storing the snapshot data in a second storage system.

[0011] It can be understood that the amount of data on the disk where the database is located is large. By taking a disk snapshot to back up the disk where the database is located, the backup efficiency can be improved.

[0012] Based on the first aspect, in a possible implementation manner, after backing up the database, the database can also be restored, including: obtaining the snapshot data stored in the second storage system, and sending the snapshot data to the database, so that the database restores the data on the disk where the database is located based on the snapshot data; obtaining the log data in the second storage system, the log data in the first storage system, and the log data in the cache, and sending the log data in the second storage system, the log data in the first storage system, and the log data in the cache to the database through the log data API, so that the database restores the log data according to the log data in the second storage system, the log data in the first storage system, and the log data in the cache.

[0013] Sending the log data in the second storage system, the log data in the first storage system, and the log data in the cache to the log data API, and the database restores the log according to the log data in the second storage system, the log data in the first storage system, and the log data in the cache, can achieve an RPO of 0 or close to 0.

[0014] In a second aspect, the present application provides a database backup device. A log data application programming interface API is set on the database. The device includes:

[0015] A log cache module, configured to obtain in a timely manner the log data generated by the database through the log data API and store it in the cache;

[0016] The log cache module is further configured to store the log data from the cache to the first storage system.

[0017] Based on the second aspect, in a possible implementation manner, the device further includes:

[0018] A log archiving module, configured to periodically obtain the log data from the first storage system at a first frequency, and aggregate the obtained log data to obtain the aggregated log data;

[0019] The log archiving module is further configured to store the aggregated log data in the second storage system, and delete the obtained log data from the first storage system;

[0020] Among them, the number of input / output requests processed per unit time (IOPS) of the first storage system is higher than that of the second storage system.

[0021] Based on the second aspect, in a possible implementation, the apparatus further includes:

[0022] A snapshot backup module, configured to periodically obtain snapshot data of the disk where the database is located at a second frequency;

[0023] The snapshot backup module is further configured to store the snapshot data in the second storage system.

[0024] Based on the second aspect, in a possible implementation, the snapshot backup module is further configured to obtain the snapshot data in the second storage system, and send the snapshot data to the database, so that the database restores the data on the disk where the database is located with the snapshot data;

[0025] The log archiving module is further configured to obtain the log data in the second storage system; the log caching module is further configured to obtain the log data in the first storage system and the log data in the cache, and send the log data in the first storage system, the log data in the cache, and the log data in the second storage system to the database through the log data API, so that the database restores the log data according to the log data in the second storage system, the log data in the first storage system, and the log data in the cache.

[0026] Each functional module of the second aspect is used to implement the method described in the first aspect and any possible implementation of the first aspect.

[0027] In a third aspect, the present application provides a computing device cluster, including at least one computing device. The at least one computing device includes a memory and a processor. The processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster executes the method described in the first aspect and any possible implementation of the first aspect.

[0028] In a fourth aspect, the present application provides a computer storage medium, including program instructions. When the program instructions are executed by the computing device cluster, the computing device cluster is enabled to implement the method described in the first aspect and any possible implementation of the first aspect.

[0029] In a fifth aspect, the present application provides a computer program product, including program instructions. When the program instructions are executed by the computing device cluster, the computing device cluster is enabled to implement the method described in the first aspect and any possible implementation of the first aspect.

[0030] In a sixth aspect, the present application provides a database backup system, including a database backup device, a first storage system, and a second storage system. The database backup device is used to implement the method described in the above first aspect and any possible implementation manner of the first aspect. Description of the Drawings

[0031] The method embodiments and apparatus embodiments in the present application will be introduced below with reference to the drawings.

[0032] Figure 1 It is a schematic flowchart of a database backup provided by the present application;

[0033] Figure 2 It is an example diagram of metadata of log data provided by the present application;

[0034] Figure 3 It is a schematic flowchart of a database recovery provided by the present application;

[0035] Figure 4 It is a schematic flowchart of a database backup method provided by the present application;

[0036] Figure 5 It is a schematic structural diagram of a database backup device provided by the present application;

[0037] Figure 6 It is a schematic structural diagram of a computing device provided by the present application;

[0038] Figure 7 It is a schematic structural diagram of a computing device cluster provided by the present application;

[0039] Figure 8 It is another schematic structural diagram of a computing device cluster provided by the present application. Detailed Embodiments

[0040] Refer to Figure 1 , Figure 1 It is a schematic flowchart of a database backup provided by the present application. The database backup process mainly involves a database, a database backup device, a first storage system, and a second storage system. Among them, the database backup device, the first storage system, and the second storage system constitute a database backup system.

[0041] A log data application programming interface (API) is set on the database. The log data API interface is used for the transmission of log data in the database.

[0042] The database backup device includes a log cache module. The log cache module is used to obtain the log data generated by the database in a timely manner through the data log API on the database, and store the obtained log data in the log cache module. The way for the log cache module to obtain log data through the log data API can be that the database engine sends the log data to the log cache module through the log data API. After the database generates log data, the database engine will write the log data to the disk. At the same time, the database engine can synchronously send the log data to the log cache module through the log data API, or asynchronously send the log data to the log cache module through the log data API. Another way for the log cache module to obtain log data through the log data API is that after the database engine writes the log data to the disk, the operating system reads the log data from the corresponding disk of the database and sends it to the log cache module through the log data API.

[0043] The format of the log data obtained by the log cache module from the log data API can be the following format:

[0044] {

[0045] Database instance,

[0046] Transaction number,

[0047] Timestamp,

[0048] Log content,

[0049] }

[0050] The format of the log data is only an example and does not constitute any limitation. The log data can also be in other forms, which are not limited in this application.

[0051] The log cache module is also used to store the obtained log data in the first storage system in a timely manner. Among them, the medium of the first storage system is a high-speed medium. For example, the medium of the first storage system can be SCM (storage class memory) or solid state disk (SSD). The number of input / output requests processed per unit time (input / output per second, IOPS) of the first storage system is relatively high, and it has the ability to write logs quickly and has a high throughput.

[0052] The database backup device further includes a log archiving module. The log archiving module is used to periodically obtain log data from the first storage system at a first frequency, aggregate the obtained log data to obtain aggregated log data, and store the aggregated log data in the second storage system. Here, the first frequency can be, for example, 5 minutes. The log archiving module obtains log data from the first storage system every 5 minutes. The obtained log data includes log data within 5 minutes. The log data within these 5 minutes is aggregated, and the aggregated log data is written into the second storage system. The first frequency can be specifically set according to the specific application scenario. For example, the first frequency can also be 1 minute, 3 minutes, 4 minutes, 8 minutes, etc. The present application does not limit the magnitude of the first frequency. The second storage system is different from the first storage system. Compared with the first storage system, the medium of the second storage system is a low-speed medium, such as a hard disk drive (HDD). The IOPS of the second storage system is relatively low, and the cost of the second storage system is lower than that of the first storage system. The specific storage form of the log data in the second storage system is not limited. For example, it can be object storage or other storage forms.

[0053] The log archiving module is further used to delete the obtained log data from the first storage system after aggregating the obtained log data and writing it into the second storage system, so as to release the storage space of the first storage system.

[0054] The log archiving module is further used to record the metadata of the log data archived in the second storage system after writing the aggregated log data into the second storage system. The recorded metadata is used to facilitate the search for corresponding log records when restoring logs later. For example, see Figure 2 , Figure 2 is an example diagram of the metadata of a kind of log data provided by the present application. The metadata includes the archived log file (name), database instance, the first log transaction number of this log file, the last log transaction number of this log file, the first timestamp of this log file, and the last timestamp of this log file. The archived log file 1.log corresponds to the log data from 00:00:00:000 to 00:00:04:999 on January 1, 2020, and the transaction numbers are from 00000001 to 00102346. The archived log file 2.log corresponds to the log data from 00:00:05:000 to 00:00:09:999 on January 1, 2020, and the transaction numbers are from 00102347 to 00502335. It should be noted that Figure 2 the metadata in

[0055] The log data can be aggregated by the log archiving module and written into the second storage system in the form of large data blocks or files. For example, the log data written into the first storage system by the log cache module is in the order of KB, and after being aggregated by the log archiving module, the log data written into the second storage system is in the order of MB.

[0056] The database backup device further includes a snapshot backup module. The snapshot backup module is used to periodically obtain the disk snapshot data corresponding to the database at a second frequency and store the disk snapshot data into the second storage system. Herein, the second frequency can be, for example, one hour. The snapshot backup module obtains the disk snapshot data once every hour and writes the obtained disk snapshot data into the second storage system. The magnitude of the second frequency can be specifically set according to specific application scenarios. For example, the second frequency can also be 0.5 hour or 1.5 hours, etc., which is not limited in this application. Specifically, the snapshot backup module creates a disk snapshot corresponding to the database instance, then obtains the disk snapshot data by circularly obtaining disk snapshot data blocks, and writes the disk snapshot data into the second storage system. When obtaining the disk snapshot data, it can be obtained in a full amount form or in an incremental form.

[0057] Figure 1 The storage system therein is used to store the disk data corresponding to the database. The disk data corresponding to the database includes data table files, log data, log files, etc.

[0058] Based on the above Figure 1 provided database backup method and process, this application also provides a database recovery method and process. For the convenience of understanding and description, refer to Figure 3 the process schematic diagram shown in Figure 1 Differently, Figure 3 the data flow direction in Figure 3 has changed. The following introduces the database recovery process in combination with each functional module in

[0059] The log archiving module is used to obtain the log data in the second storage system. The log cache module is used to obtain the log data in the first storage system and the log data in the cache, and send the log data in the first storage system, the log data in the cache, and the log data in the second storage system to the database through the log data API, so that the database restores the log data according to the log data in the first storage system, the log data in the cache, and the log data in the second storage system, and stores the restored log data into the disk (local disk) corresponding to the database.

[0060] It can be understood that the log data in the second storage system is archived log data, the log data in the first storage system is log data written by the log cache module and not yet archived, and the log data in the cache is the log data newly obtained by the database backup device and not yet stored in the first storage system.

[0061] The snapshot backup module is used to obtain the disk snapshot data in the second storage system and send the disk snapshot data to the database, so that the database can restore the data on the disk where the database is located according to the disk snapshot data.

[0062] In this application, for restoring the log data and restoring the data on the disk where the database is located, the point-in-time recovery (PITR) method can be used, or other methods can also be used. This application does not limit the algorithms used.

[0063] Based on Figures 1 to 3 the introduced database backup process and database recovery process, this application provides a database backup method, which can be implemented by the database backup device. See Figure 4 , Figure 4 which is a schematic flowchart of a database backup method provided by this application, and the method includes but is not limited to the following description.

[0064] S101. Timely obtain the log data generated by the database through the log data API, and store the log data in the first storage system.

[0065] This step can be executed by the log cache module in the database backup device.

[0066] The database backup device timely obtains the log data through the log data API, stores it in the cache, and then stores the log data from the cache in the first storage system.

[0067] S102. Periodically obtain the log data from the first storage system at the first frequency, aggregate the obtained log data to obtain the aggregated log data, and store the aggregated log data in the second storage system.

[0068] This step can be executed by the log archiving module in the database backup device.

[0069] S103. Delete the obtained log data from the first storage system.

[0070] This step can be executed by the log archiving module in the database backup device.

[0071] S104. Periodically obtain the snapshot data of the disk where the database is located at the second frequency, and store the snapshot data in the second storage system.

[0072] This step can be executed by the snapshot backup module in the database backup device.

[0073] It can be understood that in the embodiments of the present application, the log data of the database is backed up to the first storage system and the second storage system, and the data on the disk where the database is located is backed up to the second storage system, realizing the backup of all data in the database.

[0074] Optionally, the log data can also be restored according to the log data in the second storage system, the log data in the first storage system, and the log data in the cache, and the data on the disk where the database is located can be restored according to the snapshot data.

[0075] The present application provides a database backup method. A log data API interface for transmitting log data is set on the database. Through the log data API, the log data generated by the database can be obtained in a timely or real-time manner and stored in a timely manner. The data on the database disk is obtained by snapshot and stored. Implementing this solution can achieve an RPO of 0 or close to 0. The log data obtained through the log data API is stored in the first storage system with high IOPS (or high throughput), and the log data in the first storage system is aggregated, and the aggregated log data is archived to the second storage system with low IOPS (or low throughput). Compared with the second storage system, the medium of the first storage system is a high-speed medium, which can reduce costs. Backing up the log data by obtaining the log data through the log data API and backing up the data on the database disk by snapshot has less impact on the database service and does not affect the service performance of the database. The method of the present application can meet application scenarios with higher requirements.

[0076] The above describes the method embodiments provided by the present application. Next, the corresponding device embodiments will be introduced.

[0077] The present application provides a database backup device. Refer to Figure 5 , ​ which is a schematic structural diagram of a database backup device 500 provided by the present application. The device 500 includes a log cache module 510, which is used to timely obtain the log data generated by the database through the log data API and store it in the cache; the log cache module 510 is also used to store the log data from the cache to the first storage system.

[0078] In a possible implementation, the apparatus 500 further includes: a log archiving module 520, configured to periodically obtain log data from a first storage system at a first frequency, and aggregate the obtained log data to obtain aggregated log data; the log archiving module 520 is further configured to store the aggregated log data in a second storage system, and delete the obtained log data from the first storage system; wherein, the number of input / output requests processed per unit time (IOPS) of the first storage system is higher than that of the second storage system.

[0079] In a possible implementation, the apparatus 500 further includes: a snapshot backup module 530, configured to periodically obtain snapshot data of the disk where the database is located at a second frequency; the snapshot backup module 530 is further configured to store the snapshot data in the second storage system.

[0080] In a possible implementation, the snapshot backup module 530 is further configured to obtain the snapshot data in the second storage system, and send the snapshot data to the database, so that the database restores the data on the disk where the database is located with the snapshot data; the log archiving module 520 is further configured to obtain the log data in the second storage system; the log caching module 510 is further configured to obtain the log data in the first storage system and the log data in the cache, and send the log data in the first storage system, the log data in the cache, and the log data in the second storage system to the database through a log data API, so that the database restores the log data according to the log data in the second storage system, the log data in the first storage system, and the log data in the cache.

[0081] Wherein, the log caching module 510, the log archiving module 520, and the snapshot backup module 530 in the apparatus 500 may be implemented by software, or may be implemented by hardware. Exemplarily, next, taking the log caching module 510 as an example, the implementation manner of the log caching module 510 will be introduced. Similarly, the implementation manners of the log archiving module 520 and the snapshot backup module 530 may refer to the implementation manner of the log caching module 510.

[0082] The module is an example of a software functional unit. The log cache module 510 may include code running on a computing instance, where the computing instance may include, for example, a computing device, a virtual machine, a container, etc. Further, the computing instance may be one or more. For example, the log cache module 510 may include code running on multiple computing devices / virtual machines / containers. It should be noted that the multiple computing instances for running this code may be distributed in the same region or in different regions. Further, the multiple computing instances for running this code may be distributed in the same availability zone (AZ) or in different AZs, and each AZ includes one data center or multiple geographically proximate data centers. Usually, one region may include multiple AZs.

[0083] Similarly, the multiple computing instances for running this code may be distributed in the same virtual private cloud (VPC) or in multiple VPCs. Usually, one VPC is set within one region. For cross-region communication between two VPCs within the same region and between VPCs in different regions, a communication gateway needs to be set in each VPC, and the interconnection between VPCs is achieved through the communication gateway.

[0084] The module is an example of a hardware functional unit. The log cache module 510 may include at least one computing device, such as a server, a virtual machine, a container, etc. Alternatively, the log cache module 510 may also be a device implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). Among them, the above PLD may be implemented by a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.

[0085] The multiple computing devices included in the log cache module 510 can be distributed in the same region or in different regions. The multiple computing devices included in the log cache module 510 can be distributed in the same AZ or in different AZs. Similarly, the multiple computing devices included in the log cache module 510 can be distributed in the same VPC or in multiple VPCs. Among them, the multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.

[0086] It should be noted that in other embodiments, the log cache module 510 can be used to execute any steps in a database backup method, and both the log archiving module 520 and the snapshot backup module 530 can be used to execute any steps in a database backup method. The steps to be implemented by the log cache module 510, the log archiving module 520, and the snapshot backup module 530 can be specified as needed. By implementing different steps in a database backup method through the log cache module 510, the log archiving module 520, and the snapshot backup module 530 respectively, all functions of the database backup apparatus 500 can be realized.

[0087] This application provides a computing device 600. Refer to ​ , ​ which is a schematic structural diagram of a computing device 600 provided by this application. The computing device 600 can be configured as a database backup apparatus. The computing device 600 includes: a bus 602, a processor 604, a memory 606, and a communication interface 608. The processor 604, the memory 606, and the communication interface 608 communicate with each other through the bus 602. It should be understood that this application does not limit the number of processors and memories in the computing device 600.

[0088] The bus 602 can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of convenience of representation, ​ only one line is shown in [the figure], but it does not mean that there is only one bus or one type of bus. The bus 602 can include a path for transmitting information between various components (such as the memory 606, the processor 604, and the communication interface 608) of the computing device 600.

[0089] The processor 604 may include any one or more of processors such as a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).

[0090] The memory 606 may include volatile memory, such as random access memory (RAM). The processor 604 may also include non-volatile memory, such as read-only memory (ROM), flash memory, a hard disk drive (HDD), or a solid state drive (SSD).

[0091] Executable code is stored in the memory 606, and the processor 604 executes the executable code to implement the functions of the foregoing log cache module 510, log archiving module 520, and snapshot backup module 530 respectively, thereby implementing a database backup method. That is, instructions for executing a database backup method are stored on the memory 606.

[0092] The communication interface 608 uses a transceiver module such as, but not limited to, a network interface card or a transceiver to implement communication between the computing device 600 and other devices or a communication network.

[0093] The embodiment of the present application also provides a computing device cluster. The computing device cluster includes at least one computing device. The computing device may be a server, a virtual machine, a container, such as a central server, an edge server, or a sidecar container.

[0094] As ​ shown, ​ is a schematic structural diagram of a computing device cluster provided by the present application. The computing device cluster includes at least one computing device 600. Instructions for executing a database backup method that are the same may be stored in the memory 606 of one or more of the computing devices 600 in the computing device cluster.

[0095] In some possible implementation manners, instructions for executing a part of a database backup method may also be stored separately in the memory 606 of one or more of the computing devices 600 in the computing device cluster. In other words, a combination of one or more computing devices 600 can be used to jointly execute instructions for a database backup method.

[0096] When at least one computing device in the computing device cluster is configured as the computing device 600, the memories 606 in different computing devices 600 in the computing device cluster may store different instructions respectively for executing partial functions of the computing device 600. That is to say, the instructions stored in the memories 606 in different computing devices 600 may implement the functions of one or more of the log cache module 510, the log archiving module 520, and the snapshot backup module 530.

[0097] In some possible implementation manners, one or more computing devices in the computing device cluster may be connected through a network, where the network may be a wide area network or a local area network, etc. ​ A schematic structural diagram of another computing device cluster is shown, as ​ shown, two computing devices 600A and 600B are connected through a network. Specifically, they are connected to the network through the communication interfaces in each computing device. In this type of possible implementation manner, the memory 606 in the computing device 600A stores instructions for the functions of the log cache module 510 and the log archiving module 520. The computing device 600A is used to obtain log data generated by the database through the log data API, store the obtained log data in the first storage system, and is also used to periodically obtain the log data in the first storage system at a certain frequency, aggregate the obtained log data, and store the aggregated log data in the second storage system. The memory 606 in the computing device 600B stores instructions for executing the function of the snapshot backup module 530. The computing device 600B is used to obtain snapshot data of the disk where the database is located and store the snapshot data in the second storage system.

[0098] It should be understood that ​ the functions of the computing device 600A shown in may also be completed by multiple computing devices 600, or the computing device cluster includes multiple computing devices having the same functions as the computing device 600A. Similarly, the functions of the computing device 600B may also be completed by multiple computing devices 600, or the computing device cluster includes multiple computing devices having the same functions as the computing device 600B.

[0099] The embodiments of the present application further provide another computing device cluster. The connection relationship between the computing devices in this computing device cluster may be similarly referred to ​ and ​The connection method of the computing device cluster. Differently, in the memory 606 of one or more computing devices 600 in the computing device cluster, there may be stored different instructions for executing a database backup method. In some possible implementation manners, in the memory 606 of one or more computing devices 600 in the computing device cluster, there may also be respectively stored partial instructions for executing a database backup method. In other words, the combination of one or more computing devices 600 can jointly execute the instructions for executing a database backup method.

[0100] An embodiment of the present application also provides a computer program product including instructions. The computer program product may be software or a program product including instructions that can run on a computing device or be stored in any available medium. When the computer program product runs on at least one computing device, at least one computing device is caused to execute a database backup method.

[0101] The present application provides a database backup system, including a database backup device, a first storage system, and a second storage system. The database backup device may be ​ or ​ the database backup device in ​ or may be the database backup device 500 in ​ or may be the computing device 600 in ​ or ​ the computing device cluster in.

[0102] An embodiment of the present application also provides a computer-readable storage medium. The computer-readable storage medium may be any available medium that a computing device can store or a data storage device such as a data center including one or more available media. The available medium may be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid-state drive), etc. The computer-readable storage medium includes instructions, and the instructions direct a computing device or a computing device cluster to execute a database backup method.

[0103] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the protection scope of the technical solutions of the embodiments of the present application.

Claims

1. A database backup method, characterized in that, The database is provided with a log data application programming interface (API), and the method comprises: timely acquiring log data generated by the database through the log data API, storing the data in a cache, and storing the log data from the cache in a first storage system; periodically acquiring log data from the first storage system at a first frequency, and aggregating the acquired log data to obtain aggregated log data; storing the aggregated log data in a second storage system, and deleting the acquired log data from the first storage system; The number of input / output requests processed per unit time by the first storage system (IOPS) is higher than the number of input / output requests processed per unit time by the second storage system (IOPS).

2. The method according to claim 1, wherein The method further comprises: Periodically acquiring snapshot data of the disk where the database is located at a second frequency; The snapshot data is stored in the second storage system.

3. The method according to claim 2, characterized in that The method further comprises: Acquire the snapshot data in the second storage system, and send the snapshot data to the database, so that the database recovers the data on the disk where the database is located according to the snapshot data; Obtain the log data in the second storage system, the log data in the first storage system, and the log data in the cache, and send the log data in the second storage system, the log data in the first storage system, and the log data in the cache to the database through the log data API, so that the database recovers the log data based on the log data in the second storage system, the log data in the first storage system, and the log data in the cache.

4. A database backup device, characterized in that, The database is provided with a log data application programming interface API, and the device includes: A log cache module is used to obtain the log data generated by the database in a timely manner through the log data API and store it in a cache; The log cache module is further configured to store the log data from the cache into a first storage system; a log archiving module, configured to periodically obtain log data from the first storage system at a first frequency, and aggregate the obtained log data to obtain aggregated log data; The log archiving module is further configured to store the aggregated log data in a second storage system and delete the acquired log data from the first storage system; The number of input / output requests processed per unit time by the first storage system (IOPS) is higher than the number of input / output requests processed per unit time by the second storage system (IOPS).

5. The device according to claim 4, characterized in that, The device further comprises: a snapshot backup module, configured to periodically obtain snapshot data of the disk where the database is located at a second frequency; The snapshot backup module is further configured to store the snapshot data in the second storage system.

6. The device according to claim 5, characterized in that The snapshot backup module is further configured to obtain the snapshot data in the second storage system and send the snapshot data to the database, so that the database restores the data on the disk where the database is located with the snapshot data; The log archiving module is further configured to obtain the log data in the second storage system; the log caching module is further configured to obtain the log data in the first storage system and the log data in the cache, and send the log data in the first storage system, the log data in the cache, and the log data in the second storage system to the database through the log data API, so that the database restores the log data according to the log data in the second storage system, the log data in the first storage system, and the log data in the cache.

7. A cluster of computing devices, characterized in that, Comprising at least one computing device, the at least one computing device includes a memory and a processor, and the processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster executes the method according to any one of claims 1 to 3.

8. A computer storage medium, characterized in that, Comprising program instructions, when the program instructions are executed by a computing device cluster, the computing device cluster is caused to implement the method according to any one of claims 1 to 3.

9. A database backup system, characterized in that, Comprising a database backup device, a first storage system, and a second storage system, the database backup device is configured to implement the method according to any one of claims 1 to 3.

Citation Information

Patent Citations

  • Data backup system and method based on memory database

    CN101887388A