Database backup method and related device
By setting up log data APIs on the database, real -time acquisition and storage log data, and using high IOPS and low IOPS storage systems for data storage, solving the problem that the RPO cannot reach the minute level in the existing technology, and realizes the RPO as the RPO as the as the RPO. 0 or near -0 high -efficiency database backup.
Patent Information
- Application Number
- CN202411981245.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2044-12-31
Smart Images

Figure CN119377014A_ABST
Abstract
Description
Technical Field
[0001] The present 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, the backup method is 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 system is 4 hours, it means that if a disaster or failure occurs in the system, a maximum of 4 hours of data loss can be tolerated, that is, the restored system should be able to recover to the data state 4 hours before the disaster. RTO refers to the longest time required from the occurrence of a disaster or failure to the restoration of the system and services. For example, if the RTO of an application is 2 hours, it means that after a failure, it is hoped that the system can resume normal operation within 2 hours.
[0003] At present, the commonly used database backup method is to back up the data table files, log files and other data in the database through backup software. When the database business needs to be restored, the database business is restored based on the backed up data table files, log files and other data. The disadvantage of this backup method is that the RPO and RTO are relatively large, especially the RPO is usually at the day level and cannot be made smaller.
[0004] In order to reduce the RPO index, an improved method was later adopted. The data table files and log files were 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 on a daily or hourly basis. For example, the data table files are backed up once a day or hour, and the log files are backed up every 5 minutes. This can increase the RPO to the minute level. However, this backup method can only achieve an RPO of minutes, which cannot meet higher requirements. Summary of the invention
[0005] The present application provides a database backup method and related devices, which have little impact on database business performance. The database backup method provided by the present application can achieve an RPO of 0 or close to 0, which can meet scenarios with higher requirements. In a first aspect, the present application provides a database backup method, the method comprising: setting up a log data API on the database, timely obtaining log data generated by the database through the log data API, and storing the log data in a first storage system, wherein after obtaining the log data, the log data can be stored in a cache, and then the log data is stored from the cache to the first storage system.
[0006] 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 time, that is, every time the database generates a log data, the log data API transmits a log data, and the database backup device obtains a log data and stores it in the first storage system. By implementing the embodiment of the method of the present application, the RPO can be 0 or close to 0. In addition, the method of 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 business, and has little impact on the performance of the database business. The embodiment of the method of the present application can meet application scenarios with higher requirements.
[0007] Based on the first aspect, in a possible implementation, after storing the acquired logs in the first storage system, the method further includes: periodically reading the log data in the first storage system at a certain frequency (first frequency), aggregating the read log data, storing the aggregated log data in the second storage system, and deleting the read log data from the first storage system, wherein the IOPS of the first storage system is higher than the IOPS 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 the throughput of the second storage system.
[0008] It can be understood that the log data stored in the first storage system is at the KB level. The log data in the first storage system is aggregated, and 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 high IOPS can meet the demand for continuous additional log writes. However, due to the high cost of the high IOPS first storage system, a low IOPS second storage system 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 needs of database backup, but also reduces costs to a certain extent.
[0009] Based on the first aspect, in a possible implementation, the method further includes: periodically acquiring snapshot data of the disk where the database is located at a certain frequency (second frequency), and storing the snapshot data in a second storage system.
[0010] It is understandable that the amount of data on the disk where the database is located is large. Backing up the disk where the database is located by means of disk snapshot can improve the backup efficiency.
[0011] Based on the first aspect, in a possible implementation method, after backing up the database, the database can also be restored, including: obtaining snapshot data stored in the second storage system, and sending the snapshot data to the database, so that the database can restore 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 can restore 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.
[0012] The log data in the second storage system, the log data in the first storage system, and the log data in the cache are sent to the log data API. The database recovers the logs 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, so that the RPO can be 0 or close to 0.
[0013] In a second aspect, the present application provides a database backup device, wherein a log data application programming interface API is provided on the database, and the device comprises: The 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 the cache; The log cache module is also used to store the log data from the cache to the first storage system.
[0014] Based on the second aspect, in a possible implementation, the device further includes: A log archiving module, used 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 also used to store the aggregated log data in the second storage system and delete the acquired log data from the first storage system; The number IOPS of input / output requests processed per unit time by the first storage system is higher than the number IOPS of input / output requests processed per unit time by the second storage system.
[0015] Based on the second aspect, in a possible implementation, the device further includes: A snapshot backup module, used for periodically acquiring snapshot data of the disk where the database is located at a second frequency; The snapshot backup module is further used to store the snapshot data in the second storage system.
[0016] Based on the second aspect, in a possible implementation, the snapshot backup module is further used to obtain 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 using the snapshot data; The log archiving module is also used to obtain log data in the second storage system; the log caching module is also used to obtain log data in the first storage system and 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 can restore 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.
[0017] The functional modules of the second aspect are used to implement the method described in the first aspect and any possible implementation manner of the first aspect.
[0018] In a third aspect, the present application provides a computing device cluster, comprising at least one computing device, wherein the at least one computing device comprises a memory and a processor, and the processor of the at least one computing device is used 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 above-mentioned first aspect and any possible implementation manner of the first aspect.
[0019] In a fourth aspect, the present application provides a computer storage medium, including program instructions, which, when executed by a computing device cluster, enables the computing device cluster to implement the method described in the above-mentioned first aspect and any possible implementation manner of the first aspect.
[0020] In a fifth aspect, the present application provides a computer program product, including program instructions. When the program instructions are executed by a computing device cluster, the computing device cluster implements the method described in the above first aspect and any possible implementation manner of the first aspect.
[0021] 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, wherein the database backup device is used to implement the method described in the above-mentioned first aspect and any possible implementation manner of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The method embodiments and device embodiments in the present application are introduced below in conjunction with the accompanying drawings.
[0023] Figure 1 A schematic diagram of a database backup process provided for this application; Figure 2 An example diagram of metadata of log data provided for this application; Figure 3 A schematic diagram of a database recovery process provided for this application; Figure 4 A flowchart of a database backup method provided in this application; Figure 5 A schematic diagram of the structure of a database backup device provided by this application; Figure 6 A schematic diagram of the structure of a computing device provided for this application; Figure 7 A schematic diagram of the structure of a computing device cluster provided for this application; Figure 8 A schematic diagram of the structure of another computing device cluster provided in this application. DETAILED DESCRIPTION
[0024] See also Figure 1 , Figure 1 A schematic diagram of a database backup process provided in the present application, wherein the database backup process mainly involves a database, a database backup device, a first storage system and a second storage system, wherein the database backup device, the first storage system and the second storage system constitute a database backup system.
[0025] A log data application programming interface (API) is provided on the database, and the log data API interface is used for transmitting log data in the database.
[0026] The database backup device includes a log cache module, which is used to timely obtain the log data generated by the database through the data log API on the database, and store the obtained log data in the log cache module. The log cache module can obtain the log data through the log data API by sending the log data to the log cache module through the log data API through the database engine, wherein after the database generates the log data, the database engine will write the log data to the disk, and 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. The log cache module can also obtain the log data through the log data API by using the operating system to read the log data from the disk corresponding to the database and send it to the log cache module through the log data API after the database engine writes the log data to the disk. The format of the log data obtained by the log cache module from the log data API can be as follows: { Database instance, Transaction number, Timestamp, Log content, } The format of the log data is only an example and does not constitute any limitation. The log data may also be in other forms, which is not limited in this application.
[0027] The log cache module is also used to store the acquired log data in a timely manner in the first storage system. 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 a solid state disk (SSD). The first storage system processes a relatively high number of input / output requests per unit time (input / output per second, IOPS), has the ability to write logs quickly, and has a high throughput.
[0028] The database backup device also includes a log archiving module, which is used to periodically obtain log data from the first storage system at a first frequency, aggregate the obtained log data, obtain aggregated log data, and store the aggregated log data in the second storage system. Among them, the first frequency can be, for example, 5 minutes, and 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, aggregates the log data within 5 minutes, and writes the aggregated log data 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 or 3 minutes or 4 minutes or 8 minutes, etc., and the application does not limit the size 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 mechanical hard disk (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, and other storage forms can also be used.
[0029] The log archiving module is further configured to delete the acquired log data from the first storage system after aggregating and writing the acquired log data into the second storage system, so as to release storage space of the first storage system.
[0030] The log archiving module is also used to record metadata of the log data archived in the second storage system after the aggregated log data is written to the second storage system. The recorded metadata is used to facilitate the search for corresponding log records when restoring the logs later. Figure 2 , Figure 2 An example diagram of the metadata of log data provided for this application, the metadata includes the archived log file (name), the 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, with transaction numbers 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, with transaction numbers 00102347 to 00502335. It should be noted that Figure 2 The metadata in is only an example diagram, and the metadata of the log data may also include more information, which is not limited in this application.
[0031] By aggregating log data through the log archiving module, the log data can be written to the second storage system in the form of large data blocks or files. For example, the log data written to the first storage system by the log cache module is at the KB level. After aggregation by the log archiving module, the log data written to the second storage system is at the MB level.
[0032] The database backup device also includes a snapshot backup module, which is used to periodically obtain disk snapshot data corresponding to the database at a second frequency, and store the disk snapshot data in the second storage system. The second frequency can be, for example, one hour, and the snapshot backup module obtains disk snapshot data every hour, and writes the obtained disk snapshot data into the second storage system. The size of the second frequency can be specifically set according to the specific application scenario. For example, the second frequency can also be 0.5 hours 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, and then obtains the disk snapshot data by cyclically obtaining the disk snapshot data blocks, and writes the disk snapshot data into the second storage system, wherein the disk snapshot data can be obtained in full form or in incremental form.
[0033] Figure 1 The storage system in is used to store disk data corresponding to the database. The disk data corresponding to the database includes data table files, log data or log files, etc.
[0034] Based on the above Figure 1 The database backup method and process provided in this application also provides a database recovery method and process. For ease of understanding and description, see Figure 3 The process diagram shown is Figure 1 The difference is, Figure 3 The data flow in has changed. Figure 3 The various functional modules in the article introduce the process of database recovery.
[0035] The log archiving module is used to obtain log data in the second storage system. The log cache module is used to obtain log data in the first storage system and log data in the cache, and send the obtained log data in the first storage system, log data in the cache, and log data in the second storage system to the database through the log data API, so that the database can restore the log data according to the log data in the first storage system, log data in the cache, and log data in the second storage system, and store the restored log data in the disk corresponding to the database (local disk).
[0036] 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 latest log data acquired by the database backup device and not yet stored in the first storage system.
[0037] The snapshot backup module is used to obtain 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 of the disk where the database is located according to the disk snapshot data.
[0038] In the present application, the log data and the data on the disk where the database is located may be recovered by using a point-in-time recovery (PITR) method or other methods. The present application does not limit the algorithm used.
[0039] based on Figures 1 to 3 The database backup process and database recovery process introduced in this application provide a database backup method, which can be implemented by a database backup device. Figure 4 , Figure 4 A flowchart of a database backup method provided in the present application, the method includes but is not limited to the description of the following content.
[0040] S101. Obtain log data generated by a database in a timely manner through a log data API, and store the log data in a first storage system.
[0041] This step can be performed by a log cache module in the database backup device.
[0042] The database backup device obtains the log data in time through the log data API, stores it in the cache, and then stores the log data from the cache to the first storage system.
[0043] S102: 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.
[0044] This step can be performed by a log archiving module in the database backup device.
[0045] S103: Delete the acquired log data from the first storage system.
[0046] This step can be performed by a log archiving module in the database backup device.
[0047] S104: Periodically obtain snapshot data of the disk where the database is located at a second frequency, and store the snapshot data in a second storage system.
[0048] This step can be performed by a snapshot backup module in the database backup device.
[0049] It can be understood that in the embodiment 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, thereby realizing the backup of all data in the database.
[0050] Optionally, the log data may be restored 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, and the data on the disk where the database is located may be restored based on the snapshot data.
[0051] The present application provides a database backup method, in which a log data API interface for transmitting log data is set on the database. The log data generated by the database can be obtained in a timely or real-time manner through the log data API, and the log data can be stored in a timely manner. The database disk data can be obtained by snapshot, and the database disk data can be stored. The implementation of this solution can achieve an RPO of 0 or close to 0. The log data obtained through the log data API is stored in a first storage system with high IOPS (or high throughput), the log data in the first storage system is aggregated, and the aggregated log data is archived in a 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. Obtaining log data through the log data API to back up the log data and backing up the database disk data by snapshot have little impact on the database business and do not affect the business performance of the database. The method of the present application can meet application scenarios with higher requirements.
[0052] The above describes the method embodiments provided by the present application. The following introduces the device embodiments corresponding to the method embodiments.
[0053] This application provides a database backup device, see Figure 5 , Figure 5 A structural diagram of a database backup device 500 provided in the present application, the device 500 includes a log cache module 510, which is used to timely obtain log data generated by the database through a log data API and store it in a cache; the log cache module 510 is also used to store the log data from the cache to a first storage system.
[0054] In a possible implementation, the device 500 also includes: a log archiving module 520, which is used 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 520 is also used to store the aggregated log data in the second storage system, and delete the obtained log data from the first storage system; wherein the number IOPS of input / output requests processed per unit time of the first storage system is higher than the number IOPS of input / output requests processed per unit time of the second storage system.
[0055] In a possible implementation, the device 500 further includes: a snapshot backup module 530, which is used to periodically obtain snapshot data of the disk where the database is located at a second frequency; the snapshot backup module 530 is also used to store the snapshot data in the second storage system.
[0056] In a possible implementation, the snapshot backup module 530 is also used to obtain snapshot data in the second storage system, and send the snapshot data to the database so that the database uses the snapshot data to restore the data on the disk where the database is located; the log archiving module 520 is also used to obtain log data in the second storage system; the log cache module 510 is also used to obtain log data in the first storage system and 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 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.
[0057] Among them, the log cache module 510, the log archiving module 520 and the snapshot backup module 530 in the device 500 can be implemented by software, or can be implemented by hardware. Exemplarily, the implementation of the log cache module 510 is introduced below by taking the log cache module 510 as an example. Similarly, the implementation of the log archiving module 520 and the snapshot backup module 530 can refer to the implementation of the log cache module 510.
[0058] A module is taken as an example of a software functional unit. The log cache module 510 may include code running on a computing instance, wherein 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 used to run the code may be distributed in the same region or in different regions. Furthermore, the multiple computing instances used to run the code may be distributed in the same availability zone (AZ) or in different AZs, each AZ including one data center or multiple data centers with close geographical locations. Among them, generally a region may include multiple availability zones AZ.
[0059] Similarly, multiple computing instances used to run the code can be distributed in the same virtual private cloud (VPC) or in multiple VPCs. Usually, a VPC is set up in a region. For cross-region communication between two VPCs in the same region and between VPCs in different regions, a communication gateway needs to be set up in each VPC to achieve interconnection between VPCs through the communication gateway.
[0060] The module is taken as 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). The PLD may be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.
[0061] 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. The multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.
[0062] It should be noted that, in other embodiments, the log cache module 510 can be used to execute any step in a database backup method, and the log archive module 520 and the snapshot backup module 530 can both be used to execute any step in a database backup method. The steps that the log cache module 510, the log archive module 520, and the snapshot backup module 530 are responsible for implementing can be specified as needed, and the log cache module 510, the log archive module 520, and the snapshot backup module 530 respectively implement different steps in a database backup method to achieve all the functions of the database backup device 500.
[0063] The present application provides a computing device 600, see Figure 6 , Figure 6 The present application provides a schematic diagram of the structure of a computing device 600, which can be configured as a database backup device, and 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 the present application does not limit the number of processors and memories in the computing device 600.
[0064] The bus 602 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 The bus 602 may include a path for transmitting information between various components of the computing device 600 (eg, the memory 606, the processor 604, and the communication interface 608).
[0065] The processor 604 may include any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0066] The memory 606 may include a volatile memory, such as a random access memory (RAM). The processor 604 may also include a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD), or a solid state drive (SSD).
[0067] The memory 606 stores executable codes, and the processor 604 executes the executable codes to respectively implement the functions of the aforementioned log cache module 510, log archive module 520, and snapshot backup module 530, thereby implementing a database backup method. That is, the memory 606 stores instructions for executing a database backup method.
[0068] 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 communication networks.
[0069] 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 can be a server, a virtual machine, or a container, such as a central server, an edge server, or a sidecar container.
[0070] like Figure 7 As shown, Figure 7 This is a structural diagram of a computing device cluster provided in the present application, wherein the computing device cluster includes at least one computing device 600, and the memory 606 in one or more computing devices 600 in the computing device cluster may store the same instructions for executing a database backup method.
[0071] In some possible implementations, the memory 606 of one or more computing devices 600 in the computing device cluster may also store partial instructions for executing a database backup method. In other words, the combination of one or more computing devices 600 can be used to jointly execute instructions for a database backup method.
[0072] When at least one computing device in the computing device cluster is configured as a computing device 600, the memory 606 in different computing devices 600 in the computing device cluster may store different instructions, respectively used to execute part of the functions of the computing device 600. That is, the instructions stored in the memory 606 in different computing devices 600 may implement the functions of one or more modules among the log cache module 510, the log archiving module 520 and the snapshot backup module 530.
[0073] In some possible implementations, one or more computing devices in the computing device cluster may be connected via a network, wherein the network may be a wide area network or a local area network, and the like. Figure 8 A schematic diagram of the structure of another computing device cluster is shown, such as Figure 8 As shown, two computing devices 600A and 600B are connected via a network. Specifically, the network is connected via the communication interface in each computing device. In this type of possible implementation, 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 the log data generated by the database through the log data API, and store the obtained log data in the first storage system. It 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 functions of the snapshot backup module 530. The computing device 600B is used to obtain the snapshot data of the disk where the database is located, and store the snapshot data in the second storage system.
[0074] It should be understood that Figure 8 The functions of computing device 600A shown in the figure may also be completed by multiple computing devices 600, or a computing device cluster may include multiple computing devices having the same functions as computing device 600A. Similarly, the functions of computing device 600B may also be completed by multiple computing devices 600, or a computing device cluster may include multiple computing devices having the same functions as computing device 600B.
[0075] The present application embodiment also provides another computing device cluster. The connection relationship between the computing devices in the computing device cluster can be similar to that of Figure 7 and Figure 8The connection mode of the computing device cluster. Differently, the memory 606 in one or more computing devices 600 in the computing device cluster may store different instructions for executing a database backup method. In some possible implementations, the memory 606 of one or more computing devices 600 in the computing device cluster may also store partial instructions for executing a database backup method. In other words, the combination of one or more computing devices 600 can jointly execute instructions for executing a database backup method.
[0076] The 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 be run on a computing device or stored in any available medium. When the computer program product is run on at least one computing device, the at least one computing device executes a database backup method.
[0077] 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 can be Figure 1 or Figure 3 The database backup device in Figure 5 The database backup device 500 in Figure 6 The computing device 600 in Figure 7 or Figure 8 A cluster of computing devices in .
[0078] The embodiment of the present application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that can be stored by a computing device or a data storage device such as a data center that contains one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk). The computer-readable storage medium includes instructions that instruct a computing device or a computing device cluster to execute a database backup method.
[0079] 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 aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions 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 the log data generated by the database through the log data API, storing the log data in a cache, and storing the log data from the cache to a first storage system.
2. The method according to claim 1, characterized in that After storing the log data from the cache to the first storage system, the method further includes: 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.
3. The method according to claim 2, characterized in that 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.
4. The method according to claim 3, 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 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.
5. A database backup device, characterized in that: The database is provided with a log data application programming interface API, and the device comprises: A log cache module, 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 also used to store the log data from the cache to the first storage system.
6. The device according to claim 5, characterized in that The device also includes: 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 used 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.
7. The device according to claim 6, characterized in that The device also includes: A snapshot backup module, used for periodically acquiring 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.
8. The device according to claim 7, characterized in that The snapshot backup module is further used 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 by using the snapshot data; The log archiving module is also used to obtain the log data in the second storage system; the log caching module is also 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 can restore 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.
9. A computing device cluster, characterized in that: The method comprises at least one computing device, wherein the at least one computing device comprises a memory and a processor, wherein the processor of the at least one computing device is used 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 4.
10. A computer storage medium, characterized in that: The method comprises program instructions, and when the program instructions are executed by a computing device cluster, the computing device cluster implements the method according to any one of claims 1 to 4.
11. A database backup system, characterized in that: The method comprises a database backup device, a first storage system and a second storage system, wherein the database backup device is used to implement the method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Data backup system and method based on memory database
CN101887388A
Backup method and backup device of database
CN105468475A
Data storage method, electronic equipment and computer program product
CN114063883A
Data synchronization method and device, electronic equipment and storage medium
CN114706867A
Database recovery time objective optimization with synthetic snapshots
US20200250046A1