CN118113523A - Incremental backup method of database, readable storage medium and computer equipment - Google Patents

Incremental backup method of database, readable storage medium and computer equipment Download PDF

Info

Publication number
CN118113523A
CN118113523A CN202410257022.XA CN202410257022A CN118113523A CN 118113523 A CN118113523 A CN 118113523A CN 202410257022 A CN202410257022 A CN 202410257022A CN 118113523 A CN118113523 A CN 118113523A
Authority
CN
China
Prior art keywords
database
data
incremental backup
file
change ratio
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410257022.XA
Other languages
Chinese (zh)
Inventor
邱扬帆
李翔
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Kingbase Information Technologies Co Ltd
Original Assignee
Beijing Kingbase Information Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Kingbase Information Technologies Co Ltd filed Critical Beijing Kingbase Information Technologies Co Ltd
Priority to CN202410257022.XA priority Critical patent/CN118113523A/en
Publication of CN118113523A publication Critical patent/CN118113523A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1448Management of the data involved in backup or backup restore
    • G06F11/1451Management of the data involved in backup or backup restore by selection of backup contents
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides an incremental backup method of a database, a readable storage medium and computer equipment, wherein the method comprises the following steps: responding to a data backup instruction used for backing up the database, and acquiring a target value of the database, wherein the target value at least reflects the number of files and the data volume of updated data in the database after the historical moment is set; determining an incremental backup strategy according to the relative relation between the target value and a preset threshold value; wherein the incremental backup strategy is one of a block incremental backup strategy and a file incremental backup strategy; and executing the incremental backup strategy to generate an incremental backup set. The technical scheme of the invention can solve the problem of the prior art that the application scene and the incremental backup strategy are not adapted in the database operation process, and achieves the aim of improving the database operation performance.

Description

Incremental backup method of database, readable storage medium and computer equipment
Technical Field
The present invention relates to the field of database technologies, and in particular, to a method for incremental backup of a database, a readable storage medium, and a computer device.
Background
In order to ensure the security of data, the data files of the database need to be physically backed up in the process of using the database. The incremental backup is a backup mode commonly used in the physical backup of the database and comprises file incremental backup and block incremental backup, wherein the file incremental backup refers to only data files with changed backup, and is applicable to application scenes in which a large number of data changes occur in a centralized manner in a small number of data files; the incremental backup of the block refers to the backup of only the changed data blocks in the data file, and is suitable for the application scenario that a small amount of data changes are distributed to a large amount of files.
In the prior art, when a backup strategy is deployed on a database, an administrator or an operation and maintenance personnel can complete configuration of the backup strategy at one time in a manual mode or an automatic mode at least according to the current application scene of the database, namely, make a selection from a block incremental backup strategy and a file incremental backup strategy and complete deployment. However, in some periods of actual operation of the database, the application scenario will change during use of the database, resulting in reduced applicability of the incremental backup strategy of the initial configuration; if the incremental backup strategy of the file is used for the service data in a period, the occupation of computing resources is more, so that the normal operation of the database is greatly affected by the backup process, and the efficient operation of the database is not easy to maintain.
Disclosure of Invention
The invention aims to provide an incremental backup method, a readable storage medium and computer equipment for a database, which are used for solving the problem of unadapted application scene and incremental backup strategy in the running process of the database in the prior art, and achieving the purpose of improving the running performance of the database.
Specifically, in a first aspect, the present invention provides a method for incremental backup of a database, including:
responding to a data backup instruction used for backing up the database, and acquiring a target value of the database, wherein the target value at least reflects the number of files and the data volume of updated data in the database after the historical moment is set;
Determining an incremental backup strategy according to the relative relation between the target value and a preset threshold value; wherein the incremental backup strategy is one of a block incremental backup strategy and a file incremental backup strategy;
And executing the incremental backup strategy to generate an incremental backup set.
Further, the obtaining the target value of the database includes:
Acquiring file change ratios and data average change ratios of the database after the set historical moment, wherein the file change ratios are the proportions of updated data files, and the data volume average change ratios are the average values of the proportions of the updated data in each updated data file;
And acquiring the available space duty ratio of the backup storage space, and calculating the target value according to the file change ratio, the data volume average change ratio and the available space duty ratio.
Further, the calculating the target value according to the file change ratio, the data volume average change ratio and the available space ratio includes:
Acquiring the file change ratio, the average change ratio of the data volume and the weight of the available space ratio;
according to each weight, correcting the file change ratio, the data volume average change ratio and the available space ratio respectively;
and calculating the target value according to the corrected file change ratio, the data volume average change ratio and the available space duty ratio by adopting a preset calculation formula.
Further, the obtaining the weights of the file change ratio, the average change ratio of the data volume and the available space ratio includes:
And acquiring application scenes of the database, and determining each weight according to the application scenes.
Further, the obtaining the file change ratio and the data average change ratio of the database after the setting history time includes:
The obtaining the file change ratio and the data average change ratio of the database after the setting history time comprises the following steps:
acquiring a preset sampling rate, and acquiring a sample data file of the database according to the preset sampling rate;
And acquiring the file change ratio and the data average change ratio according to the file number and the data amount of the update data after the set historical moment in the sample data file.
Further, the acquiring the preset sampling rate includes:
and reading the writing configuration parameters of the database, and acquiring the preset sampling rate from the writing configuration parameters.
Further, before determining the incremental backup strategy according to the relative relationship between the target value and the preset threshold value, the method further includes:
and reading the writing configuration parameters of the database, and acquiring the preset threshold value from the writing configuration parameters.
Further, the setting the historical moment is the moment when the database performs data backup last time, and the responding to the data backup instruction used for backing up the database includes:
the interval time length between the time and the set historical time is longer than or equal to the set time length.
In a second aspect, the present invention also provides a machine-readable storage medium having stored thereon a machine-executable program which, when executed by a processor, implements the incremental backup method of any one of the databases described above.
In a third aspect, the present invention further provides a computer device, including a memory, a processor, and a machine executable program stored in the memory and running on the processor, where the processor implements the incremental backup method of any one of the databases described above when executing the machine executable program.
The incremental backup method of the database provided by the invention can determine the incremental backup strategy according to the corresponding relation between the target value of the database and the set threshold value, wherein the target value can reflect the number of files and the data quantity of updated data in the database after the set historical moment. According to the technical scheme, the incremental backup strategy of the database can be dynamically determined according to the data change condition of the data files in the database after the historical moment is set, so that the incremental backup strategy of the database is matched with the application scene of the database operation, and the purpose of improving the operation performance of the database is achieved.
The above, as well as additional objectives, advantages, and features of the present invention will become apparent to those skilled in the art from the following detailed description of a specific embodiment of the present invention when read in conjunction with the accompanying drawings.
Drawings
Some specific embodiments of the invention will be described in detail hereinafter by way of example and not by way of limitation with reference to the accompanying drawings. The same reference numbers will be used throughout the drawings to refer to the same or like parts or portions. It will be appreciated by those skilled in the art that the drawings are not necessarily drawn to scale. In the accompanying drawings:
FIG. 1 is a schematic illustration of an incremental backup of files;
FIG. 2 is a schematic diagram of an incremental backup of blocks;
FIG. 3 is a schematic flow chart diagram of a method of incremental backup of a database in accordance with one embodiment of the invention;
FIG. 4 is a schematic flow chart of obtaining target values for a database according to one embodiment of the invention;
FIG. 5 is a schematic flow chart diagram of calculating a target value for a database according to one embodiment of the invention;
FIG. 6 is a schematic flow chart diagram of file change ratios and data average change ratios of a database after a set history time is obtained according to one embodiment of the invention;
FIG. 7 is a schematic flow chart diagram of a method of incremental backup of a database in accordance with another embodiment of the invention;
FIG. 8 is a schematic diagram of a machine-readable storage medium according to one embodiment of the invention;
FIG. 9 is a schematic diagram of a computer device according to one embodiment of the invention.
Detailed Description
An incremental backup method, a readable storage medium, and a computer device of a database according to an embodiment of the present invention are described below with reference to fig. 1 to 9. In the description of the present embodiment, it should be understood that the terms "first" and "second" are used for descriptive purposes only and are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include at least one such feature, i.e. one or more such features. In the description of the present invention, the meaning of "plurality" means at least two, for example, two, three, etc., unless specifically defined otherwise. When a feature "comprises or includes" a feature or some of its coverage, this indicates that other features are not excluded and may further include other features, unless expressly stated otherwise.
In the description of the present embodiment, a description referring to the terms "one embodiment," "some embodiments," "illustrative embodiments," "examples," "specific examples," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present invention. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiments or examples. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
In the prior art, the backup mode of the database comprises a full-volume backup mode and an incremental backup mode, wherein the full-volume backup mode refers to the backup of all data of the database, and the incremental backup mode refers to the backup of only the data changed from the last data backup. The incremental backup comprises file incremental backup and block incremental backup, wherein the file incremental backup is shown in fig. 1, and refers to the application scenario that only the changed data files are backed up and are applicable to the situation that a large amount of data changes occur in a small amount of data files in a concentrated manner; the incremental backup of blocks is shown in fig. 2, and refers to the situation that only the data changed in the data file is backed up, and is suitable for the application scenario that a small amount of data change is distributed in a large amount of data files.
Compared with a full-volume backup mode, the incremental backup mode has smaller data granularity, smaller data volume to be backed up, relatively fewer occupied storage resources under the condition of the same data security requirement, more complex operation, and more complex processing logic required by the block incremental backup compared with the file incremental backup, and more occupied computing resources.
In the actual use of incremental backup, an administrator needs to manually or automatically configure a backup mode to be used in combination with experience at the initial stage of backup system deployment according to the current general service scenario supported by the database, system resources, data availability requirements and the like, and configure a timing task of a specific period to perform backup and cleaning periodically. For example:
if the business-triggered data modification involves a large number of data files, but each data file modifies only a small amount of data, the incremental backup mode of the database can be set as block incremental backup;
if the service-triggered data modification involves only a small number of data files, but each data file modifies a large amount of data, then the incremental backup of the database may be set to be a file incremental backup;
if the system stability of the database is good, the data security requirement is low but the storage resources are tense, a longer backup period can be set to reserve backup data for a longer period;
if the database has poor system stability, high data security requirements and abundant storage resources, a short backup period can be set to be selected to retain backup data for a longer period.
In the prior art, the incremental backup mode of the database is fixed, namely block incremental backup or file incremental backup. However, the types of services handled by the database during different time periods may be different, for example, assuming that the incremental backup mode of the database is file incremental backup, if the services handled by the database during a certain time period generate a large number of modified data files, each data file modifies only a small amount of data, which may cause a problem of backing up a large amount of repeated data. If the incremental backup mode of the database is block incremental backup, a small amount of modified data files are generated in a service in a certain period, but each data file modifies a large amount of data, which causes the problem that a large amount of data operation is needed in the incremental backup process, and the performance of the database is affected.
In order to at least solve the problem of the prior art that the application scene and the incremental backup strategy are not adapted in the running process of the database, the invention provides an incremental backup method of the database, which can dynamically determine whether to use the block incremental backup strategy or the file incremental backup strategy according to the application scene of the database so as to achieve the aim of improving the running performance of the database.
In one embodiment of the present invention, the incremental backup method of the database of the present invention is shown in fig. 3, and includes the following steps:
step S102: judging whether a data backup instruction is received or not;
If yes, step S104 is executed:
step S104: acquiring a target value of a database;
Step S106: determining an incremental backup strategy of the database according to the relative relation between the target value of the database and a preset threshold value, wherein the incremental backup strategy is one of a block incremental backup strategy and a file incremental backup strategy;
step S108: the resulting incremental backup strategy is executed to generate an incremental backup set.
In the step S102, the data backup instruction is an instruction for backing up the database, and the data backup instruction may be an instruction input to the database by a manager of the database, or may be an instruction generated by the database according to the running state. After the database receives the data backup instruction, the database can be considered to need to execute the incremental backup operation so as to backup the incremental data of the database after the historical moment is set.
In step S103, the obtained target value of the database is a value reflecting at least the number of files and the data amount of the update data in the database after the setting of the history time. Since the more the number of files of the update data, the less the data amount of the update data of each data file, the more the database is suitable for the block incremental backup policy, and the less the number of files of the update data, the more the data amount of the update data of each data file, the more the database is suitable for the file incremental backup policy, in this embodiment, the number of update data files and the target value of the database may be set to a positive correlation, and the data amount of the update data of each data file and the target value of the database may be set to a negative correlation, so that the target value of the database may be used to determine whether the block incremental backup policy or the file incremental backup policy needs to be performed on the database.
In the step S106, it may be determined whether the incremental backup policy of the database is a block incremental backup policy or a file incremental backup policy according to the magnitude relation between the target value of the database and the preset threshold value. For example, if the number of files of the update data is greater and the number of data of the update data of each data file is smaller, the target value of the database is greater, the incremental backup policy of the database may be determined to be a block incremental backup policy if the target value of the database is greater than a preset threshold, and the incremental backup policy of the database may be determined to be a file incremental backup policy if the target value of the database is less than or equal to the preset threshold.
In the step S108, if the obtained incremental backup policy of the database is the block incremental backup policy, performing block incremental backup on the update data of the database after the setting of the history time; if the obtained incremental backup strategy of the database is the file incremental backup strategy, performing file incremental backup on the updated data of the database after the setting of the history time. Thereby generating an incremental backup set of the database, and storing the incremental backup set in a backup storage space of the database to realize incremental backup of updated data of the database after the historical moment is set.
In summary, according to the incremental backup method for a database provided in this embodiment, after the database receives the data backup instruction, the incremental backup policy may be determined according to the correspondence between the target value of the database and the set threshold, where the target value may reflect the number of files and the data amount of the updated data in the database after the history time is set. Therefore, according to the technical scheme of the embodiment, the incremental backup strategy of the database can be dynamically determined according to the data change condition of the data files in the database after the historical moment is set, and compared with the prior art, the incremental backup strategy of the database can be matched with the application scene of the database operation, so that the purpose of improving the operation performance of the database is achieved.
In some embodiments of the present invention, the process of obtaining the target value of the database in the step S104 is shown in fig. 4, and includes the following steps:
step S202: acquiring file change rate and data average change rate of a database after setting historical time;
Step S204: acquiring the available space duty ratio of the backup storage space;
Step S206: and calculating the target value of the database according to the file change ratio, the average change ratio of the data volume and the available space ratio of the database.
In the step S202, the file change ratio of the database refers to the ratio of updated data files in the database after the historical time, that is, the ratio of changed data files; the average change ratio of the data volume of the database is the average value of the proportion of the update data in the update data file. Assuming that the number of data files in the database is N, wherein the number of updated data files is N, that is, the number of data files whose data changes is N, the file change ratio f of the database is:
f=n/N
Assuming that the data amount of the i-th update data file is M i and the data amount of the update data is M i in the update data files, the average change ratio d of the database is:
Assuming that the size of the backup storage space is H, where the size of the available space is H, the available space ratio s of the backup storage space is:
s=h/H
In the above step S206, the following calculation formula may be adopted to calculate the target value v of the database according to the file change ratio, the average change ratio of the data amount, and the available space ratio of the database:
After calculating the target value v of the database, in step S106, whether the target value v of the database is greater than the set threshold t may be compared; if the target value v of the database is larger than the set threshold value, determining the incremental backup strategy of the database as a block incremental backup strategy; and if the target value v of the database is smaller than or equal to the set threshold value t, determining the incremental backup strategy of the database as the file incremental backup strategy.
By means of the implementation manner of the embodiment, the target value of the database can be calculated in a data quantification mode, so that the larger the calculated target value of the database is, the more suitable the database is for applying block incremental backup, and therefore an accurate judgment basis is provided for determining the incremental backup strategy of the database. Therefore, the embodiment not only can improve the usability of the technical scheme of the invention and reduce the implementation difficulty of the technical scheme of the invention, but also can improve the adaptation degree of the obtained incremental backup strategy and the database, and further improve the performance of the database.
In some embodiments of the present invention, the process of calculating the target value of the database according to the file change ratio, the average change ratio of the data amount and the available space ratio in the step S206 is shown in fig. 5, and includes the following steps:
Step S212: respectively acquiring the file change ratio, the average change ratio of the data quantity and the weight of the available space ratio;
Step S214: according to the weights, correcting the file change ratio, the average change ratio of the data volume and the available space occupation ratio of the database respectively;
step S216: and calculating a target value of the database according to the corrected file change rate, the data volume average change rate and the available space ratio by adopting a preset calculation formula.
In step S212, the obtained file change ratio is given a weight of α 1, the average change ratio of the data amount is α 2, and the available space ratio is given a weight of α 3. In the line number step S214, the file change ratio of the corrected database is α 1 f, the average change ratio of the data amount of the corrected database is α 2 d, and the available space ratio of the corrected backup storage space is α 3 S.
In the above step S216, the target value v of the database may be calculated using the following preset calculation formula:
Because the attention of different application scenes to the file change rate, the data volume average change rate and the available space occupation ratio of the backup storage space are different, weights of the file change rate, the data volume average change rate and the available space occupation ratio of the backup storage space are set in the embodiment, and the file change rate, the data volume average change rate and the available space occupation ratio of the backup storage space are corrected through the weights, so that the technical scheme of the invention is suitable for different application scenes, and the reliability of incremental backup of the database is improved.
In some embodiments of the present invention, the method for obtaining the weights of the file change ratio, the average change ratio of the data amount, and the available space ratio of the backup storage space in the step S212 includes:
And acquiring the application scene of the database, and determining the file change ratio, the average change ratio of the data volume and the weight of the available space occupation ratio of the backup storage space according to the application scene of the database.
In this embodiment, the attention degree of the file change ratio, the data volume average change ratio and the available space ratio of the backup storage space of multiple preset application scenes may be obtained in advance, and the weight of the file change ratio, the weight of the data volume average change ratio and the weight of the available space ratio of the backup storage space in each preset application scene may be obtained and stored. In the process of executing the step S212, the stored data are read according to the application scenario of the database, so as to obtain the file change ratio, the average change ratio of the data volume and the weight of the available space ratio of the backup storage space of the database.
For example, under the condition that the available space of the backup storage space is smaller than a preset space value, the weight of the available space ratio can be reduced so as to increase the probability of executing the block incremental backup strategy by the database, thereby achieving the purpose of reducing the data volume of backup; under the condition that the processor utilization rate of the database is larger than the set utilization rate, the weight of the file change rate can be increased or the weight of the average change rate of the data volume can be reduced, so that the probability of executing the file incremental backup strategy by the database is increased, and the aim of reducing the workload of the processor of the database is fulfilled.
By means of the setting mode of the embodiment, the file change rate, the average change rate of the data volume and the weight of the available space ratio of the backup storage space can be rapidly determined according to the application scene of the database, so that the implementation efficiency of the technical scheme of the invention is improved.
In some embodiments of the present invention, the process of obtaining the file change ratio and the data average change ratio of the database after the setting history time in the step S202 is shown in fig. 6, and includes the following steps:
step S302: acquiring a preset sampling rate, and acquiring a sample data file of a database according to the preset sampling rate;
Step S304: and acquiring the file change ratio and the data average change ratio of the database according to the number of files and the data quantity of the updated data in the sample data file after the set historical moment.
In the step S302, a sample data file may be randomly selected from all data files in the database according to a preset sampling rate, for example, assuming that the number of data files in the database is N and the preset sampling rate is p, a number of sample data files is pN.
In the above step S304, assuming that the number of data files in which data is changed in the sample data file is n', the file change ratio f of the target period is calculated by the following calculation formula:
f=n′/pN
assuming that the total data amount of the data file in which the j-th data is changed in the sample data file is M ' j and the data amount of the data file in which the change is made is M ' j, the data amount change rate of the data file is M ' j/M′j, and the number average change rate d of the database is calculated by the following calculation formula:
By means of the method, the device and the system, the file change rate and the data average change rate of the database can be obtained only by adopting the sample data files determined by the preset sampling rate, and compared with the mode of calculating according to all data files in the database, the method and the system can reduce data calculation amount in the process of the technical scheme, and achieve the purpose of improving data processing efficiency.
In some embodiments of the present invention, the method for obtaining the preset sampling rate in the step S302 includes:
and reading the writing configuration parameters of the database, and acquiring a preset sampling rate from the writing configuration parameters.
In this embodiment, the preset sampling rate is a configurable parameter of the database, and an administrator of the database or a third party system may input data into the database to configure the preset sampling rate.
By means of the implementation mode of the embodiment, an administrator or a third party system of the database can adjust the preset sampling rate according to the application scene, and therefore applicability and flexibility of the technical scheme of the invention are improved.
In some embodiments of the present invention, before determining the incremental backup policy of the database according to the relative relationship between the target value and the preset threshold value of the database in step S106, the method further includes:
And reading the write-in configuration parameters of the database, and acquiring a preset threshold value from the write-in configuration parameters.
In this embodiment, the preset threshold is a configurable parameter of the database, and an administrator or a third party system of the database may input data into the database to configure the preset threshold.
By means of the implementation mode of the embodiment, an administrator or a third party system of the database can adjust the preset threshold according to the application scene, so that applicability and flexibility of the technical scheme of the invention are improved.
In some embodiments of the present invention, the step S102 of determining whether a data backup command is received includes:
acquiring the interval time length between the current time and the set historical time, and judging whether the interval time length is greater than or equal to the set time length;
If yes, judging that the database receives the data backup instruction.
In this embodiment, the set duration may be a write configuration parameter written into the database by an administrator of the database or by a third party system, and if the system stability of the database is good, the data security requirement is low but the storage resources are tense, the value of the set duration may be increased; if the system stability of the database is poor, the data security requirement is high but the storage resources are abundant, the value of the set time period can be reduced.
By means of the implementation mode of the embodiment, the data files of the database can be subjected to incremental backup periodically according to the set time length, so that reliability of the database is improved.
In some embodiments of the present invention, the incremental backup method of the database of the present invention is shown in fig. 7, and includes the following steps:
Step S402: acquiring write configuration parameters of the data volume, wherein the write configuration parameters comprise a preset sampling rate and a preset threshold value;
Step S404: judging whether a data backup instruction for backing up the database is received or not;
If yes, go to step S406;
Step S406: acquiring a sample data file of a database according to a preset sampling rate;
Step S408: acquiring the number of update data files and the data amount of update data in the sample data files after the historical moment is set, and calculating the file change ratio and the data average change ratio of the database according to the number of update data files and the data amount of update data;
step S410: calculating the available space duty ratio of the backup storage space;
step S412: according to the application scene of the database, respectively acquiring the file change rate, the average change rate of the data volume and the weight of the available space occupation ratio of the backup storage space;
step S414: correcting the file change rate, the average change rate of the data volume and the available space occupation ratio of the backup storage space of the database according to the weights respectively;
Step S416: calculating a target value of the database according to the file change rate, the average change rate of the data volume and the available space occupation ratio of the backup storage space of the corrected database by adopting a preset calculation formula;
Step S418: judging whether the target value of the database is larger than a set threshold value;
if yes, go to step S420; if not, go to step S422;
Step S420: executing a block incremental backup strategy on the database to generate an incremental backup set of the database after the set historical moment;
Step S422: and executing a file incremental backup strategy on the database to generate an incremental backup set of the database after the set historical moment.
According to the incremental backup method for the database, under the condition that the database receives the data table backup instruction, the incremental backup strategy of the database can be determined according to the file change rate, the average change rate of the data volume and the available space occupation ratio of the backup storage space of the database after the historical moment is set. Because the technical scheme in the embodiment can dynamically determine the incremental backup strategy of the database according to the data change condition of each data file in the database and the residual available free space of the backup storage space, and the incremental backup strategy of the database is matched with the data change condition of the data file, compared with the incremental backup mode in the prior art, the performance of the database can be improved.
An embodiment of the invention also provides a machine-readable storage medium and a computer device. FIG. 8 is a schematic diagram of a machine-readable storage medium 830 according to one embodiment of the invention; fig. 9 is a schematic diagram of a computer device 900 according to one embodiment of the invention. The machine-readable storage medium 830 has stored thereon a machine-executable program 840, which when executed by a processor implements the incremental backup method of a database of any of the embodiments described above.
Computer device 900 may include a memory 920, a processor 910, and a machine executable program 840 stored on memory 920 and running on processor 910, and processor 910 implements the incremental backup method of the database of any of the embodiments described above when executing machine executable program 840.
It should be noted that the logic and/or steps represented in the flow diagrams or otherwise described herein, e.g., a ordered listing of executable instructions for implementing logical functions, can be embodied in any machine-readable storage medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions.
For the purposes of this description of the embodiment, a machine-readable storage medium 830 can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the machine-readable medium may even be paper or other suitable medium upon which the program is printed, as the program may be electronically captured, via, for instance, optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner if necessary, and then stored in a computer memory.
It is to be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above-described embodiments, the various steps or methods may be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system.
The computer device 900 may be, for example, a server, a desktop computer, a notebook computer, a tablet computer, or a smartphone. In some examples, computer device 900 may be a cloud computing node. Computer device 900 may be described in the general context of computer-system-executable instructions, such as program modules, being executed by a computer system. Generally, program modules may include routines, programs, objects, components, logic, data structures, etc. that perform particular tasks or implement particular abstract data types. Computer device 900 may be implemented in a distributed cloud computing environment where remote processing devices coupled via a communications network perform tasks. In a distributed cloud computing environment, program modules may be located in both local and remote computing system storage media including memory storage devices.
Computer device 900 may include a processor 910 adapted to execute stored instructions, a memory 920 providing temporary storage for the operation of the instructions during operation. Processor 910 may be a single core processor, a multi-core processor, a computing cluster, or any number of other configurations. Memory 920 may include Random Access Memory (RAM), read only memory, flash memory, or any other suitable storage system.
Processor 910 may be connected by a system interconnect (e.g., PCI-Express, etc.) to an I/O interface (input/output interface) adapted to connect computer device 900 to one or more I/O devices (input/output devices). The I/O devices may include, for example, a keyboard and a pointing device, which may include a touch pad or touch screen, among others. The I/O device may be a built-in component of the computer device 900 or may be a device externally connected to the computing device.
The processor 910 may also be linked by a system interconnect to a display interface suitable for connecting the computer device 900 to a display device. The display device may include a display screen as a built-in component of the computer device 900. The display device may also include a computer monitor, television, projector, or the like, that is externally connected to the computer device 900. In addition, a network interface controller (network interface controller, NIC) may be adapted to connect the computer device 900 to a network through a system interconnect. In some embodiments, the NIC may use any suitable interface or protocol (such as an internet small computer system interface, etc.) to transfer data. The network may be a cellular network, a radio network, a Wide Area Network (WAN), a Local Area Network (LAN), or the internet, among others. The remote device may be connected to the computing device through a network.
By now it should be appreciated by those skilled in the art that while a number of exemplary embodiments of the invention have been shown and described herein in detail, many other variations or modifications of the invention consistent with the principles of the invention may be directly ascertained or inferred from the present disclosure without departing from the spirit and scope of the invention. Accordingly, the scope of the present invention should be understood and deemed to cover all such other variations or modifications.

Claims (10)

1. A method for incremental backup of a database, comprising:
responding to a data backup instruction used for backing up the database, and acquiring a target value of the database, wherein the target value at least reflects the number of files and the data volume of updated data in the database after the historical moment is set;
Determining an incremental backup strategy according to the relative relation between the target value and a preset threshold value; wherein the incremental backup strategy is one of a block incremental backup strategy and a file incremental backup strategy;
And executing the incremental backup strategy to generate an incremental backup set.
2. The incremental backup method of a database of claim 1 wherein,
The obtaining the target value of the database comprises the following steps:
Acquiring file change ratios and data average change ratios of the database after the set historical moment, wherein the file change ratios are the proportions of updated data files, and the data volume average change ratios are the average values of the proportions of the updated data in each updated data file;
And acquiring the available space duty ratio of the backup storage space, and calculating the target value according to the file change ratio, the data volume average change ratio and the available space duty ratio.
3. The incremental backup method of a database of claim 2 wherein,
Said calculating said target value based on said file change ratio, data volume average change ratio and available space ratio, comprising:
Acquiring the file change ratio, the average change ratio of the data volume and the weight of the available space ratio;
according to each weight, correcting the file change ratio, the data volume average change ratio and the available space ratio respectively;
and calculating the target value according to the corrected file change ratio, the data volume average change ratio and the available space duty ratio by adopting a preset calculation formula.
4. The incremental backup method of a database of claim 3 wherein,
The step of obtaining the weights of the file change ratio, the data volume average change ratio and the available space ratio comprises the following steps:
And acquiring application scenes of the database, and determining each weight according to the application scenes.
5. The incremental backup method of a database of claim 2 wherein,
The obtaining the file change ratio and the data average change ratio of the database after the setting history time comprises the following steps:
acquiring a preset sampling rate, and acquiring a sample data file of the database according to the preset sampling rate;
And acquiring the file change ratio and the data average change ratio according to the file number and the data amount of the update data after the set historical moment in the sample data file.
6. The incremental backup method of a database of claim 5 wherein,
The obtaining the preset sampling rate comprises the following steps:
and reading the writing configuration parameters of the database, and acquiring the preset sampling rate from the writing configuration parameters.
7. The incremental backup method of a database of claim 1 wherein,
Before determining the incremental backup strategy according to the relative relation between the target value and the preset threshold value, the method further comprises:
and reading the writing configuration parameters of the database, and acquiring the preset threshold value from the writing configuration parameters.
8. The incremental backup method of a database of claim 1 wherein,
The setting the historical moment is the moment when the database executes the data backup last time, and the responding the data backup instruction for backing up the database comprises the following steps:
the interval time length between the time and the set historical time is longer than or equal to the set time length.
9. A machine-readable storage medium, having stored thereon a machine-executable program which, when executed by a processor, implements a method of incremental backup of a database according to any one of claims 1-8.
10. A computer device comprising a memory, a processor, and a machine executable program stored on the memory and running on the processor, wherein the processor, when executing the machine executable program, implements the incremental backup method of a database according to any one of claims 1-8.
CN202410257022.XA 2024-03-06 2024-03-06 Incremental backup method of database, readable storage medium and computer equipment Pending CN118113523A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410257022.XA CN118113523A (en) 2024-03-06 2024-03-06 Incremental backup method of database, readable storage medium and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410257022.XA CN118113523A (en) 2024-03-06 2024-03-06 Incremental backup method of database, readable storage medium and computer equipment

Publications (1)

Publication Number Publication Date
CN118113523A true CN118113523A (en) 2024-05-31

Family

ID=91213570

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410257022.XA Pending CN118113523A (en) 2024-03-06 2024-03-06 Incremental backup method of database, readable storage medium and computer equipment

Country Status (1)

Country Link
CN (1) CN118113523A (en)

Similar Documents

Publication Publication Date Title
US10360199B2 (en) Partitioning and rebalancing data storage
CN112261135A (en) Node election method, system, device and equipment based on consistency protocol
CN105701099B (en) For executing the method, apparatus and system of task in distributed environment
CN105242983A (en) Data storage method and data storage management server
CN113806300B (en) Data storage method, system, device, equipment and storage medium
US9298765B2 (en) Apparatus and method for handling partially inconsistent states among members of a cluster in an erratic storage network
CN104144202A (en) Hadoop distributed file system access method, system and device
CN105868002B (en) Method and device for processing retransmission request in distributed computing
CN111754117B (en) Task issuing method and device, electronic equipment and storage medium
CN117499490A (en) Multi-cluster-based network scheduling method and device
CN112751926A (en) Method, system and related device for managing working nodes in cluster
CN115017117B (en) Local disk-based container file system online capacity expansion method and system
CN118113523A (en) Incremental backup method of database, readable storage medium and computer equipment
EP3709173A1 (en) Distributed information memory system, method, and program
CN110022348B (en) System and method for dynamic backup sessions
CN112015551A (en) Coroutine pool management method and coroutine pool management device
CN114281604B (en) Data recovery method and device, electronic equipment and storage medium
CN115373859B (en) Model service capacity adjusting method and device based on Kubernetes cluster
CN114201113B (en) Multi-object storage bucket selection method, device and processor
CN116501258A (en) Disk group dividing method, device, medium and related equipment based on Minio
CN115168405A (en) Data processing method, storage medium and equipment of database cluster
CN117290160A (en) Backup method, storage medium and equipment for database read-write separation cluster
CN118519775A (en) Computing resource scheduling method and device, storage medium and electronic equipment
CN116610502A (en) Fault transfer method, storage medium and equipment for asynchronous database cluster
CN118260031A (en) Node resource determining method, container scheduling method, device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Country or region after: China

Address after: 100102 201, 2 / F, 101, No. 5 building, No. 7 Rongda Road, Chaoyang District, Beijing

Applicant after: China Electronics Technology Group Jincang (Beijing) Technology Co.,Ltd.

Address before: 100102 201, 2 / F, 101, No. 5 building, No. 7 Rongda Road, Chaoyang District, Beijing

Applicant before: BEIJING KINGBASE INFORMATION TECHNOLOGIES Inc.

Country or region before: China