Data backup method, device, program product, medium and electronic device

By using two threads to process stock and incremental data respectively during the data backup process, we ensure that the backup and write processes do not interfere with each other, and optimize the speed through the third thread, the data blocking and loss in cloud server data backup is solved. Improved backup efficiency.

CN114661523BActive Publication Date: 2024-12-13SHANDONG ENERGY CHAIN HLDG CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202210270029.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-18
Publication Date
2024-12-13
Estimated Expiration
2042-03-18

AI Technical Summary

Technical Problem

In data backup scenarios, especially when data backup of cloud servers, writing of new data may lead to confusion in data backup, resulting in data blocking and loss, and the backup efficiency is inefficient.

Method used

Using two threads, one of which is used to back up the stock data from the original database to the backup database, and the other is used to read and write incremental data from the source database to the original database, ensuring that the backup and write process It does not interfere with each other, optimizes the backup speed and write speed through the third thread, processes data in batches, and optimizes the backup process using home identification and data number.

Benefits of technology

Improve the stability and efficiency of data backup, avoid data blocking and loss, and improve the stability and speed of the backup process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114661523B_ABST
    Figure CN114661523B_ABST
Patent Text Reader

Abstract

The embodiments of the present application provide a data backup method, device, program product, medium and electronic device, which relate to the technical field of computer and data backup. The method comprises: creating a first thread and a second thread; backing up the stock data in the original database to the backup database through the first thread; reading the source data from the source database through the second thread, and writing the source data as incremental data to the original database. The technical solution of the embodiments of the present application can improve the efficiency of data backup.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of computers and data backup, and in particular to a data backup method, device, program product, medium and electronic equipment. Background Art

[0002] In data backup scenarios, for example, when backing up cloud data in one cloud server to another cloud server, there will generally be new data stored in the cloud server while the backup data is being stored. In this case, data backup may be chaotic, leading to data blocking and data loss, and low data backup efficiency. Based on this, how to improve data backup efficiency is a technical problem that needs to be solved urgently by those skilled in the art. Summary of the invention

[0003] The embodiments of the present application provide a data backup method, device, program product, medium and electronic device, which can improve the data backup efficiency at least to a certain extent.

[0004] Other features and advantages of the present application will become apparent from the following detailed description, or may be learned in part by the practice of the present application.

[0005] According to one aspect of an embodiment of the present application, a data backup method is provided, including: creating a first thread and a second thread; backing up the existing data in an original database to a backup database through the first thread; reading source data from the source database through the second thread, and writing the source data as incremental data to the original database.

[0006] According to one aspect of an embodiment of the present application, a data backup device is provided, including: a first creation unit, used to create a first thread and a second thread; a first backup unit, used to back up the existing data in an original database to a backup database through the first thread; and a writing unit, used to read source data from the source database through the second thread and write the source data as incremental data to the original database.

[0007] In some embodiments of the present application, based on the aforementioned scheme, the device also includes: a second creation unit, which is used to create a third thread after reading the source data from the source database through the second thread and writing the source data as incremental data to the original database; a second backup unit, which is used to back up the incremental data in the original database to the backup database through the third thread.

[0008] In some embodiments of the present application, based on the aforementioned scheme, the second backup unit is configured to: obtain the writing speed of the second thread writing the source data as incremental data into the original database; obtain the backup speed of the third thread backing up the incremental data in the original database to the backup database; if the backup speed is greater than the writing speed, read the source data from the source database through the third thread, write the source data as incremental data into the original database, and back up the incremental data in the original database to the backup database through the second thread.

[0009] In some embodiments of the present application, based on the aforementioned solution, the first backup unit is configured to: when all the existing data in the original database is backed up to the backup database, back up the incremental data in the original database to the backup database through the first thread.

[0010] In some embodiments of the present application, based on the aforementioned scheme, the backup database includes at least two sub-databases, and both the existing data and the incremental data carry an attribution identifier that matches the corresponding sub-database; the first backup unit is also configured to: according to the attribution identifier carried by each piece of existing data, the existing data is backed up to the sub-database matching the attribution identifier through the first thread; the second backup unit is configured to: according to the attribution identifier carried by each piece of incremental data, the incremental data is backed up to the sub-database matching the attribution identifier through the second thread.

[0011] In some embodiments of the present application, based on the aforementioned scheme, the existing data corresponds to a data number, and the first backup unit is further configured to: export the existing data in batches according to the data number sequence of each piece of existing data; and back up each batch of existing data in sequence to the backup database through the first thread.

[0012] In some embodiments of the present application, based on the aforementioned scheme, the first backup unit is also configured as: the first thread sends a first notification message of data backup to the second thread; when the second thread receives the first notification message, the second thread sends a first confirmation message of data backup to the first thread; when the first thread receives the first confirmation message, the existing data to be backed up is determined in the original database, and the existing data in the original database is backed up to the backup database through the first thread.

[0013] In some embodiments of the present application, based on the aforementioned scheme, the first backup unit is further configured to: determine the moment when the second thread receives the first notification information as the first moment; and determine the data written to the original database before the first moment as the stock data to be backed up.

[0014] In some embodiments of the present application, based on the aforementioned scheme, the writing unit is configured to: after the first moment, read source data from the source database through the second thread, and write the source data as incremental data to the original database.

[0015] According to one aspect of an embodiment of the present application, a computer program product or a computer program is provided, the computer program product or the computer program includes a computer instruction, and the computer instruction is stored in a computer-readable storage medium. A processor of a computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the data backup method described in the above embodiment.

[0016] According to one aspect of an embodiment of the present application, a computer-readable storage medium is provided, in which at least one program code is stored. The at least one program code is loaded and executed by a processor to implement the operations performed by the data backup method described in the above embodiment.

[0017] According to one aspect of an embodiment of the present application, an electronic device is also provided, characterized in that it includes a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors, and the one or more programs include instructions for performing the data backup method as described in the above embodiments.

[0018] In the technical solutions provided in some embodiments of the present application, by creating two threads, wherein one thread is used to back up the existing data to a backup database, and the other thread is used to write new incremental data to the original database, it can be ensured that the backup process of the existing data and the writing process of the incremental data do not interfere with each other. In other words, while the incremental data is continuously written to the original database, the process of backing up the existing data in the original database to the backup database will not be affected in any way. It can be seen that the technical solution proposed in the present application can enhance the stability of the data backup process, avoid the problems of data blocking and data loss to a certain extent, and thus improve the data backup efficiency.

[0019] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and together with the specification, are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:

[0021] Figure 1 A schematic diagram showing an exemplary system architecture to which the technical solution of the embodiments of the present application can be applied;

[0022] Figure 2 A flow chart of a data backup method according to an embodiment of the present application is shown;

[0023] Figure 3 A flow chart of a method after reading source data from a source database through the second thread and writing the source data as incremental data into an original database according to an embodiment of the present application is shown;

[0024] Figure 4 A demonstration diagram of a data backup process according to an embodiment of the present application is shown;

[0025] Figure 5 A detailed flow chart of a data backup process according to an embodiment of the present application is shown;

[0026] Figure 6 A detailed flow chart of backing up the stock data in the original database to the backup database through the first thread according to an embodiment of the present application is shown;

[0027] Figure 7 A detailed flow chart of backing up the stock data in the original database to the backup database through the first thread according to an embodiment of the present application is shown;

[0028] Figure 8 A detailed flow chart of determining the stock data to be backed up in the original database according to an embodiment of the present application is shown;

[0029] Fig. 9 A block diagram of a data backup device according to an embodiment of the present application is shown;

[0030] Fig.10 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown. DETAILED DESCRIPTION

[0031] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this application will be more comprehensive and complete and fully convey the concept of the example embodiments to those skilled in the art.

[0032] In addition, described feature, structure or characteristic can be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present application. However, those skilled in the art will appreciate that the technical scheme of the present application can be put into practice without one or more of the specific details, or other methods, components, devices, steps, etc. can be adopted. In other cases, known methods, devices, realizations or operations are not shown or described in detail to avoid blurring the various aspects of the application.

[0033] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0034] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.

[0035] It should be noted that the "multiple" mentioned in this article refers to two or more. "And / or" describes the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects before and after are in an "or" relationship.

[0036] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the objects used in this way can be interchanged where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those shown or described.

[0037] Figure 1 A schematic diagram of an exemplary system architecture to which the technical solution of the embodiments of the present application can be applied is shown.

[0038] like Figure 1As shown, the system architecture may include terminal devices (such as Figure 1 The embodiment of the present invention is a network 104 and a server 105. The network 104 is a medium for providing a communication link between the terminal device and the server 105. The network 104 may include various connection types, such as a wired communication link, a wireless communication link, etc.

[0039] In one embodiment of the present application, in a scenario where data in an original database (such as server 105) needs to be backed up to a backup database (such as a terminal device), new data may need to be written into the original database. For example, data in the source database is continuously being written into the original database. In this case, server 105 may first create a first thread and a second thread, wherein, on the one hand, the first thread may be used to back up the existing data in the original database to the backup database, and on the other hand, the second thread may be used to read source data from the source database and write the source data as incremental data into the original database.

[0040] In this embodiment, two threads are created, wherein one thread is used to back up the existing data to the backup database, and the other thread is used to write new incremental data to the original database. This ensures that the backup process of the existing data and the writing process of the incremental data do not interfere with each other. In other words, while the incremental data is continuously written to the original database, the process of backing up the existing data in the original database to the backup database will not be affected in any way. It can be seen that the technical solution proposed in the present application can enhance the stability of the data backup process, avoid the problems of data blocking and data loss to a certain extent, and thereby improve the data backup efficiency.

[0041] It should be noted that the data backup method provided in the embodiment of the present application can be executed by the server 105, and accordingly, the data backup device is generally arranged in the server 105. However, in other embodiments of the present application, the terminal device can also have similar functions as the server, so as to execute the data backup solution provided in the embodiment of the present application.

[0042] It should also be noted that Figure 1 The number of terminal devices, networks and servers in the description is only for illustration. According to the implementation requirements, the server can be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.

[0043] It should be explained that cloud computing as described above is a computing model that distributes computing tasks on a resource pool composed of a large number of computers, so that various application systems can obtain computing power, storage space and information services as needed. The network that provides resources is called a "cloud". The resources in the "cloud" are infinitely expandable in the eyes of users, and can be obtained at any time, used on demand, and expanded at any time. By establishing a cloud computing resource pool (referred to as a cloud platform, generally referred to as an IaaS (Infrastructure as a Service) platform, various types of virtual resources are deployed in the resource pool for external customers to choose to use. The cloud computing resource pool mainly includes: computing devices (virtualized machines, including operating systems), storage devices, and network devices.

[0044] The implementation details of the technical solution of the embodiment of the present application are described in detail below:

[0045] Figure 2 A flowchart of a data backup method according to an embodiment of the present application is shown. The data backup method can be executed by a device having a computing and processing function, for example, Figure 1 , or may be performed by the server 105 shown in Figure 1 Refer to the terminal device shown in Figure 2 As shown, the data backup method at least includes steps 210 to 250, which are described in detail as follows:

[0046] Step 210: Create a first thread and a second thread.

[0047] Step 230: back up the stock data in the original database to the backup database through the first thread.

[0048] Step 250: read source data from the source database through the second thread, and write the source data into the original database as incremental data.

[0049] First of all, it should be noted that the data backup solution proposed in this application can be applied to the overall backup scenario of cloud data in cloud services. In a specific scenario, cloud data is stored in cloud server A (i.e., the original database). Under some application requirements, such as the need to back up the cloud data in cloud server A, the cloud data can be backed up from cloud server A to cloud server B (i.e., the backup database). However, in the process of backing up the cloud data from cloud server A to cloud server B, new data may be stored in cloud server A. In this case, data backup may be chaotic, resulting in data backup failure.

[0050] Based on the above situation, two threads can be created, namely the first thread and the second thread, wherein the first thread can be used to back up the existing data in the A cloud server to the B cloud server, and the second thread can be used to read the source data from the source database and write the source data as incremental data to the A cloud server.

[0051] In the present application, the data in the original database may exist in the form of a data table or in the form of a data packet, and the present application does not make any specific limitation on this.

[0052] In one embodiment of the present application, that is, in the Figure 2 After step 250, the following steps may be performed: Figure 3 Steps shown.

[0053] See also Figure 3 , shows a flow chart of a method after reading source data from a source database through the second thread and writing the source data as incremental data into an original database according to an embodiment of the present application. Specifically, it includes steps 261 to 262:

[0054] Step 261, create a third thread.

[0055] Step 262: Back up the incremental data in the original database to the backup database through the third thread.

[0056] In order to enable those skilled in the art to better understand the data backup solution in this application, it will be explained in combination with 4 below.

[0057] Reference Figure 4 , showing a demonstration diagram of the data backup process according to an embodiment of the present application.

[0058] Specifically, Figure 4 As shown, after the first thread, the second thread, and the third thread are created, the source data is read from the source database 401 through the second thread, and the source data is written as incremental data to the original database 402, the existing data in the original database 402 is backed up to the backup database 403 through the first thread, and the incremental data in the original database 402 is backed up to the backup database 403 through the third thread.

[0059] In the present application, after the source data read from the source database is written as incremental data to the original database through the second thread, the incremental data in the original database is backed up to the backup database by creating a third thread. The advantage is that, on the one hand, each detailed task in the data backup process can be shared among different threads, further making each detailed task non-interfering with each other, which can enhance the stability of the data backup process and prevent data blocking and data loss. On the other hand, by processing each detailed task in the data backup process simultaneously through multiple threads, the rate of data backup can be accelerated. Therefore, this embodiment can further improve the efficiency of data backup.

[0060] In one embodiment of the present application, the following can also be performed: Figure 5 The scheme shown.

[0061] See also Figure 5 , shows a detailed flow chart of the data backup process according to an embodiment of the present application. Specifically including steps 271 to 273:

[0062] Step 271, obtaining a writing speed at which the second thread writes the source data as incremental data into the original database.

[0063] Step 272: Obtain the backup speed of the third thread in backing up the incremental data in the original database to the backup database.

[0064] Step 273, if the backup speed is greater than the write speed, the source data is read from the source database through the third thread, the source data is written as incremental data to the original database, and the incremental data in the original database is backed up to the backup database through the second thread.

[0065] In the present application, if the backup speed is greater than the write speed, it means that the third thread will be waiting for the incremental data to be backed up. In this case, the data backup time will be delayed, further affecting the data backup efficiency. Based on this, the tasks of the first thread and the second thread can be switched, that is, the source data is read from the source database by the third thread and the source data is written as incremental data to the original database, and the incremental data in the original database is backed up to the backup database by the second thread. By switching the tasks of the first thread and the second thread, the data backup efficiency can be greatly improved.

[0066] In one embodiment of the present application, when all the stock data in the original database is backed up to the backup database, the incremental data in the original database is backed up to the backup database through the first thread.

[0067] In this embodiment, if the existing data in the original database is backed up in full to the backup database by the first thread, it means that the first thread is already in an idle state. By backing up the incremental data in the original database to the backup database through the first thread, thread resources can be fully utilized, and the backup time of the incremental data can be accelerated, thereby improving the data backup efficiency.

[0068] In the present application, the backup database may include at least two sub-databases, the stock data may carry an attribution identifier that matches the corresponding sub-database, and the incremental data may also carry an attribution identifier that matches the corresponding sub-database.

[0069] For example, at least two sub-databases may include database A and database B, and each piece of stock data or incremental data may carry an attribution identifier a that matches database A, or an attribution identifier b that matches database B.

[0070] In such Figure 2 In one embodiment of step 230, the first thread backs up the stock data in the original database to the backup database, which can be based on the ownership identifier carried by each piece of stock data, and the first thread backs up the stock data to the sub-database matching the ownership identifier.

[0071] For example, when the stock data is a data table, if the data table carries an attribution identifier a, then the data table will be backed up to database A by the first thread; if the data table carries an attribution identifier b, then the data table will be backed up to database B by the first thread.

[0072] In such Figure 3 In one embodiment of step 262 shown, the incremental data in the original database is backed up to the backup database through the third thread. The incremental data can be backed up to the sub-database matching the attribution identifier carried by each incremental data through the third thread.

[0073] For example, when the incremental data is a data table, if the data table carries an attribution identifier a, then the data table will be backed up to database A by the third thread; if the data table carries an attribution identifier b, then the data table will be backed up to database B by the third thread.

[0074] In the present application, the stock data may correspond to a data number.

[0075] Specifically, for example, the stock data may refer to 1,000 data tables, wherein each data table may have a data number, for example, "0001" represents the first data table in the stock data, "0500" represents the 500th data table in the stock data, and "1000" represents the 1,000th data table in the stock data.

[0076] In such Figure 2 In one embodiment of step 230, the first thread backs up the stock data in the original database to the backup database as follows: Figure 6 Follow the steps shown.

[0077] See also Figure 6 , shows a detailed flowchart of backing up the stock data in the original database to the backup database through the first thread according to an embodiment of the present application, specifically including steps 231 to 232:

[0078] Step 231, exporting the stock data in batches according to the data serial number sequence of each stock data.

[0079] Step 232: back up each batch of stock data to the backup database in sequence through the first thread.

[0080] In this embodiment, for example, the stock data includes 1,000 data tables, and the stock data can be exported in batches in order of data numbers from small to large. For example, data tables with data numbers "1-100", "101-200", ..., "901-1000" are exported in sequence, and then, the data tables with data numbers "1-100", "101-200", ..., "901-1000" are backed up in sequence to the backup database through the first thread.

[0081] In this embodiment, on the one hand, by exporting the stock data in batches according to the data serial number sequence of each stock data, the progress and position of the data backup can be mastered in real time, and when the data backup is interrupted, the data backup can still be continued at the interrupted position, thereby enhancing the stability of the data backup and improving the efficiency of the data backup. On the other hand, backing up each batch of stock data to the backup database in sequence can ensure that the data backup is carried out in an orderly manner, thereby also improving the efficiency of the data backup to a certain extent.

[0082] In such Figure 2 In one embodiment of step 230, the first thread backs up the stock data in the original database to the backup database, and can also be used as follows: Figure 7 Follow the steps shown.

[0083] See also Figure 7, shows a detailed flowchart of backing up the stock data in the original database to the backup database through the first thread according to an embodiment of the present application, specifically including steps 233 to 235:

[0084] Step 233: The first thread sends a first notification message of data backup to the second thread.

[0085] Step 234: When the second thread receives the first notification information, the second thread sends first confirmation information of data backup to the first thread.

[0086] Step 235: When the first thread receives the first confirmation information, the stock data to be backed up is determined in the original database, and the stock data in the original database is backed up to the backup database through the first thread.

[0087] In the present application, before backing up the existing data in the original database through the first thread, the first thread can send a notification message, i.e., the first notification message, to the second thread. After receiving the first notification message, the second thread can feedback a confirmation message, i.e., the first confirmation message, to the first thread. Furthermore, after receiving the first confirmation message, the first thread can determine the existing data to be backed up in the original database, and back up the existing data to be backed up to the backup database.

[0088] In such Figure 7 In one embodiment of step 235, the stock data to be backed up is determined in the original database, and the following steps can be used: Figure 8 Follow the steps shown.

[0089] See also Figure 8 , shows a detailed flow chart of determining the stock data to be backed up in the original database according to an embodiment of the present application, specifically including steps 2351 to 2352:

[0090] Step 2351: determine the moment when the second thread receives the first notification information as the first moment.

[0091] Step 2352: determine the data written into the original database before the first moment as the stock data to be backed up.

[0092] In the present application, when the second thread receives the first notification information, that is, the first moment, it means that the first thread is ready to start backing up the existing data to the backup database. At this time, the first thread no longer records the newly added data, that is, it no longer writes the newly added data as existing data into the original database, and thus the original data written before the first moment can be written.

[0093] In this Figure 2 In one embodiment of the step 250 shown, the source data is read from the source database by the second thread and the source data is written as incremental data to the original database. This may be after the first moment, that is, after the second thread receives the first notification information, by the second thread reading the source data from the source database and writing the source data as incremental data to the original database.

[0094] In the present application, two threads are created, wherein one thread is used to back up the existing data to the backup database, and the other thread is used to write new incremental data to the original database. This ensures that the backup process of the existing data and the writing process of the incremental data do not interfere with each other. In other words, while the incremental data is continuously written to the original database, the process of backing up the existing data in the original database to the backup database will not be affected in any way. It can be seen that the technical solution proposed in the present application can enhance the stability of the data backup process, avoid the problems of data blocking and data loss to a certain extent, and thus improve the data backup efficiency.

[0095] The following describes an embodiment of the device of the present application, which can be used to execute the data backup method in the above embodiment of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the data backup method in the above embodiment of the present application.

[0096] Fig. 9 A block diagram of a data backup device according to an embodiment of the present application is shown.

[0097] Reference Fig. 9 As shown, a data backup device 900 according to an embodiment of the present application includes: a first creation unit 901 , a first backup unit 902 and a writing unit 903 .

[0098] Among them, the first creation unit 901 is used to create the first thread and the second thread; the first backup unit 902 is used to back up the existing data in the original database to the backup database through the first thread; the writing unit is used to read the source data from the source database through the second thread and write the source data as incremental data to the original database.

[0099] In some embodiments of the present application, based on the aforementioned scheme, the device also includes: a second creation unit, which is used to create a third thread after reading the source data from the source database through the second thread and writing the source data as incremental data to the original database; a second backup unit, which is used to back up the incremental data in the original database to the backup database through the third thread.

[0100] In some embodiments of the present application, based on the aforementioned scheme, the second backup unit is configured to: obtain the writing speed of the second thread writing the source data as incremental data into the original database; obtain the backup speed of the third thread backing up the incremental data in the original database to the backup database; if the backup speed is greater than the writing speed, read the source data from the source database through the third thread, write the source data as incremental data into the original database, and back up the incremental data in the original database to the backup database through the second thread.

[0101] In some embodiments of the present application, based on the aforementioned solution, the first backup unit 902 is configured to: when all the existing data in the original database is backed up to the backup database, back up the incremental data in the original database to the backup database through the first thread.

[0102] In some embodiments of the present application, based on the aforementioned scheme, the backup database includes at least two sub-databases, and both the existing data and the incremental data carry an attribution identifier that matches the corresponding sub-database; the first backup unit 902 is also configured to: according to the attribution identifier carried by each piece of existing data, the existing data is backed up to the sub-database matching the attribution identifier through the first thread; the second backup unit is configured to: according to the attribution identifier carried by each piece of incremental data, the incremental data is backed up to the sub-database matching the attribution identifier through the second thread.

[0103] In some embodiments of the present application, based on the aforementioned scheme, the existing data corresponds to a data number, and the first backup unit 902 is also configured to: export the existing data in batches according to the data number sequence of each piece of existing data; and back up each batch of existing data in sequence to the backup database through the first thread.

[0104] In some embodiments of the present application, based on the aforementioned scheme, the first backup unit 902 is also configured as: the first thread sends a first notification message of data backup to the second thread; when the second thread receives the first notification message, the second thread sends a first confirmation message of data backup to the first thread; when the first thread receives the first confirmation message, the stock data to be backed up is determined in the original database, and the stock data in the original database is backed up to the backup database through the first thread.

[0105] In some embodiments of the present application, based on the aforementioned scheme, the first backup unit 902 is further configured to: determine the moment when the second thread receives the first notification information as the first moment; and determine the data written to the original database before the first moment as the stock data to be backed up.

[0106] In some embodiments of the present application, based on the aforementioned solution, the writing unit 903 is configured to: after the first moment, read source data from the source database through the second thread, and write the source data into the original database as incremental data.

[0107] Fig.10 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown.

[0108] It should be noted that Fig.10 The computer system 1000 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0109] like Fig.10 As shown, the computer system 1000 includes a central processing unit (CPU) 1001, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 1002 or the program loaded from the storage part 1008 to the random access memory (RAM) 1003, such as executing the method described in the above embodiment. In the RAM 1003, various programs and data required for system operation are also stored. The CPU 1001, the ROM 1002 and the RAM 1003 are connected to each other through the bus 1004. The input / output (I / O) interface 1005 is also connected to the bus 1004.

[0110] The following components are connected to the I / O interface 1005: an input section 1006 including a keyboard, a mouse, etc.; an output section 1007 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1008 including a hard disk, etc.; and a communication section 1009 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 1009 performs communication processing via a network such as the Internet. A drive 1010 is also connected to the I / O interface 1005 as needed. A removable medium 1011, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1010 as needed, so that a computer program read therefrom is installed into the storage section 1008 as needed.

[0111] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication part 1009, and / or installed from a removable medium 1011. When the computer program is executed by a central processing unit (CPU) 1001, various functions defined in the system of the present application are executed.

[0112] It should be noted that the computer-readable medium shown in the embodiment of the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, - but not limited to - an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by an instruction execution system, device or device or used in combination with it. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a computer-readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0113] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Wherein, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0114] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.

[0115] As another aspect, the present application also provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the data backup method described in the above embodiment.

[0116] As another aspect, the present application also provides a computer-readable medium, which may be included in the electronic device described in the above embodiment; or may exist independently without being assembled into the electronic device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by an electronic device, the electronic device implements the data backup method described in the above embodiment.

[0117] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.

[0118] Through the description of the above implementation methods, it is easy for those skilled in the art to understand that the example implementation methods described here can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the implementation methods of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the implementation methods of the present application.

[0119] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the embodiments disclosed herein. The present application is intended to cover any variations, uses or adaptations of the present application, which follow the general principles of the present application and include common knowledge or customary technical means in the art that are not disclosed in the present application.

[0120] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

Claims

1. A data backup method, It is characterized in that The method comprises: Create a first thread, a second thread, and a third thread; Backing up the stock data in the original database to the backup database through the first thread; Reading source data from the source database through the second thread, and writing the source data as incremental data into the original database; Backing up the incremental data in the original database to the backup database through the third thread; Obtaining a writing speed at which the second thread writes the source data as incremental data into an original database; Obtaining a backup speed at which the third thread backs up incremental data in the original database to the backup database; If the backup speed is greater than the write speed, the source data is read from the source database through the third thread, the source data is written as incremental data to the original database, and the incremental data in the original database is backed up to the backup database through the second thread.

2. The method according to claim 1, It is characterized in that The method further comprises: When all the stock data in the original database are backed up to the backup database, the incremental data in the original database is backed up to the backup database through the first thread.

3. The method according to claim 1, It is characterized in that The backup database includes at least two sub-databases, and both the stock data and the incremental data carry attribution identifiers that match the corresponding sub-databases; The backing up the stock data in the original database to the backup database through the first thread includes: according to the attribution identifier carried by each piece of stock data, backing up the stock data to a sub-database matching the attribution identifier through the first thread; The step of backing up the incremental data in the original database to the backup database through the second thread includes: according to the attribution identifier carried by each piece of incremental data, backing up the incremental data to a sub-database matching the attribution identifier through the second thread.

4. The method according to claim 1, It is characterized in that The stock data corresponds to a data number, and backing up the stock data in the original database to the backup database through the first thread includes: Exporting the stock data in batches according to the data serial number sequence of each stock data; Each batch of stock data is backed up in sequence to the backup database through the first thread.

5. The method according to claim 1, It is characterized in that The step of backing up the stock data in the original database to the backup database through the first thread includes: The first thread sends a first notification message of data backup to the second thread; When the second thread receives the first notification information, the second thread sends first confirmation information of data backup to the first thread; When the first thread receives the first confirmation information, the stock data to be backed up is determined in the original database, and the stock data in the original database is backed up to the backup database through the first thread.

6. The method according to claim 5, It is characterized in that The step of determining the stock data to be backed up in the original database includes: Determine the moment when the second thread receives the first notification information as the first moment; The data written into the original database before the first moment is determined as the stock data to be backed up.

7. The method according to claim 6, It is characterized in that The step of reading source data from the source database by the second thread and writing the source data as incremental data into the original database includes: After the first moment, source data is read from the source database through the second thread, and the source data is written into the original database as incremental data.

8. A data backup device, It is characterized in that The device comprises: A first creation unit is used to create a first thread and a second thread; A first backup unit is used to back up the stock data in the original database to the backup database through the first thread; A writing unit, used to read source data from a source database through the second thread, and write the source data as incremental data into an original database; The second creation unit is used to create a third thread after reading source data from the source database through the second thread and writing the source data as incremental data into the original database; the second backup unit is used to back up the incremental data in the original database to the backup database through the third thread; The second backup unit is configured to: obtain the writing speed of the second thread writing the source data as incremental data into the original database; obtain the backup speed of the third thread backing up the incremental data in the original database to the backup database; if the backup speed is greater than the writing speed, read the source data from the source database through the third thread, write the source data as incremental data into the original database, and back up the incremental data in the original database to the backup database through the second thread.

9. A computer program product, It is characterized in that The computer program product includes computer instructions, which are stored in a computer-readable storage medium and are suitable for being read and executed by a processor, so that a computer device having the processor executes the data backup method according to any one of claims 1 to 7.

10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores at least one program code, and the at least one program code is loaded and executed by a processor to implement the operations performed by the data backup method according to any one of claims 1 to 7.

11. An electronic device, It is characterized in that The electronic device includes one or more processors and one or more memories, wherein the one or more memories store at least one program code, and the at least one program code is loaded and executed by the one or more processors to implement the operations performed by the data backup method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

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

    CN104572357A

  • Method and device of data processing and storage medium

    CN108509298A

  • Automatic backup and recovery system of cloud host

    CN108874590A

  • Data backup method and device, data recovery method and device and electronic equipment

    CN112114999A

  • Method and apparatus for processing a database replica

    US20070288526A1