Data backup method and system and storage medium

By introducing relay sites in the cloud system, using semi-synchronous replication and asynchronous replication, the problem of data loss in the main site in the cloud system is solved, and efficient backup and rapid recovery of data are achieved.

CN119003234APending Publication Date: 2024-11-22HUAWEI CLOUD COMPUTING TECHNOLOGIES CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310538138.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-05-12
Publication Date
2024-11-22

AI Technical Summary

Technical Problem

When the main site fails in the cloud system, asynchronous replication method causes delay in data transmission between the main site and the disaster recovery site, resulting in the inability to store data in a timely manner in the disaster recovery database during the failure, resulting in data loss.

Method used

Introduce relay sites, save data to the main database and the relay database simultaneously through semi-synchronous replication, and store the data in the relay database into the disaster recovery database through asynchronous replication, ensuring that the main database and the relay database are data consistency, thus avoiding data loss in the event of a primary site failure.

Benefits of technology

It realizes data backup without data loss when the main site fails, improves the efficiency of business switching, avoids the need for primary database reconstruction, and improves the speed and reliability of data recovery.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119003234A_ABST
    Figure CN119003234A_ABST
Patent Text Reader

Abstract

The invention discloses a data backup method and system and a storage medium, and belongs to the field of communication. The method is applied to a main station included in the cloud system, the cloud system further comprises a relay station and a disaster tolerance station, the transmission delay between the main station and the relay station is smaller than a delay threshold value, the main station is located in a first area, the disaster tolerance station is located in a second area, the first area is different from the second area, and the main station comprises a main database. The relay station comprises a relay database, and the disaster recovery station comprises a disaster recovery database. In the method, a main site obtains first data to be stored; the main site stores the first data in the main database through a write operation and sends the first data to the relay station, and the relay station stores the first data in the relay database and stores the first data stored in the relay database in the disaster recovery database. The application can avoid data loss.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communications, and in particular to a method, system and storage medium for backing up data. Background Art

[0002] The cloud system has extremely high requirements for data reliability. To improve reliability, the primary site is used to provide services to users, and the disaster recovery site is used to back up the data in the primary site. The primary site is located in a different area from the disaster recovery site. In this way, when the primary site fails and cannot provide services, the disaster recovery site takes over the services and continues to provide the services to users.

[0003] The primary site includes a primary database, and the disaster recovery site includes a disaster recovery database. When the primary site obtains the service data, it stores the data in the primary database. Then, the primary site reads the data from the primary database using asynchronous replication, sends the read data to the disaster recovery site, and the disaster recovery site stores the data in the disaster recovery database. In this way, the disaster recovery database also stores the service data. When the disaster recovery site takes over the service, the service is provided to users based on the disaster recovery database.

[0004] In the asynchronous replication mode, after writing the data to the primary database, a delay is required before the data is stored in the disaster recovery database. During this period of time, the primary site first reads the data from the primary database and then sends the read data to the disaster recovery site. In this way, when the primary site fails, the data obtained by the primary site during this period of time cannot be stored in the disaster recovery database, resulting in data loss. Summary of the invention

[0005] The present application provides a method, system and storage medium for backing up data to avoid data loss. The technical solution is as follows:

[0006] In a first aspect, the present application provides a method for backing up data, which is applied to a cloud system including a primary site, the cloud system also including a relay site and a disaster recovery site, the transmission delay between the primary site and the relay site is less than a delay threshold, the primary site is located in a first area, the disaster recovery site is located in a second area, the first area and the second area are different, the primary site includes a primary database, the relay site includes a relay database, and the disaster recovery site includes a disaster recovery database.

[0007] In the method, the primary site obtains the first data to be saved, saves the first data to the primary database through a write operation, and sends the first data to the relay site. The relay site saves the first data to the relay database, and then stores the first data saved in the relay database into the disaster recovery database.

[0008] Since the transmission delay between the main site and the relay site is less than the delay threshold, the main site saves the first data to the main database and sends the first data to the relay site through a write operation, so that the data saved in the main database is consistent with the data saved in the relay database. When the main site fails, since the data saved in the main database is consistent with the data saved in the relay database, the relay site can store all the data in the relay database in the disaster recovery database, thereby avoiding data loss.

[0009] In a possible implementation manner, the relay site is located in the first area, thereby ensuring that the transmission delay between the master site and the relay site is less than a delay threshold.

[0010] In another possible implementation, the first data is data of a first service run by the primary site, and the disaster recovery site is used to run the first service after the primary site fails. The disaster recovery site obtains second data of the first service when running the first service. The disaster recovery site saves the second data in a disaster recovery database. The disaster recovery site stores the second data saved in the disaster recovery database in a relay database. In this way, the relay database can save the second data obtained by the disaster recovery site when running the service, so that the data saved in the relay database is consistent with the data saved in the disaster recovery database.

[0011] In another possible implementation, the disaster recovery site obtains the third data, the relay database stores the third data, but the disaster recovery database does not store the third data. The disaster recovery site stores the third data in the disaster recovery database. In this way, each data in the relay database can be stored in the disaster recovery database to avoid data loss.

[0012] In another possible implementation, the primary site is also used to run a second service corresponding to the first service, the disaster recovery site is also used to run the second service after the primary site fails, and the disaster recovery database includes a first database of the first service and a second database of the second service. The disaster recovery site obtains the fourth data, and the first database stores the fourth data, but the second database does not store the fourth data. The disaster recovery site stores the fourth data in the second database. In this way, the second database can include each data in the first database, ensuring that the disaster recovery site can successfully run the second service based on the second database.

[0013] In another possible implementation, when the primary site returns to normal, the relay site sends the second data stored in the relay database to the primary site. The primary site stores the second data in the primary database. In this way, the primary site obtains the second data when the disaster recovery site is running the service through the relay site, and stores the second data in the primary database, ensuring that the primary site can successfully switch back to the service.

[0014] In another possible implementation, the master site sends the global transaction identifier GTID of each data in the master database to the relay site when it returns to normal. The relay site determines the second data based on the GTID of each data in the master database and the GTID of each data in the relay database. Wherein, based on the GTID of each data in the master database and the GTID of each data in the relay database, it can be determined whether the relay database includes each data in the master database. If the relay database includes each data in the master database, the relay site obtains the second data and sends the second data to the master site, and the master site can save the second data in the master database, so that the master site does not need to rebuild the master database.

[0015] In another possible implementation, when the relay site determines that the relay database stores each data in the main database based on the GTID of each data in the main database, the relay site obtains the second data stored in the relay database based on the GTID of each data in the main database and the GTID of each data in the relay database, so that the main site does not need to rebuild the main database.

[0016] In a second aspect, the present application provides a method for backing up data, the method being applied to a cloud system including a primary site, the cloud system also including a relay site and a disaster recovery site, the transmission delay between the primary site and the relay site being less than a delay threshold, the primary site being located in a first area, the disaster recovery site being located in a second area, the first area being different from the second area, the primary site including a primary database, the relay site including a relay database, and the disaster recovery site including a disaster recovery database. In the method, the primary site acquires first data to be saved. The primary site saves the first data to the primary database and sends the first data to the relay site through a write operation, so that the relay site saves the first data to the relay database, and then stores the first data saved in the relay database into the disaster recovery database.

[0017] Since the transmission delay between the main site and the relay site is less than the delay threshold, the main site saves the first data to the main database and sends the first data to the relay site through a write operation, so that the data saved in the main database is consistent with the data saved in the relay database. When the main site fails, since the data saved in the main database is consistent with the data saved in the relay database, the relay site can store all the data in the relay database in the disaster recovery database, thereby avoiding data loss.

[0018] In a possible implementation manner, the relay site is located in the first area, thereby ensuring that the transmission delay between the master site and the relay site is less than a delay threshold.

[0019] In another possible implementation, the first data is data of the first service run by the primary site, and the disaster recovery site is used to run the first service after the primary site fails. When the primary site returns to normal, it receives the second data saved in the relay database, and the second data is data stored in the relay database by the disaster recovery site, and the second data is data of the first service obtained when the disaster recovery site runs the first service. The primary site saves the second data in the primary database. In this way, the primary site obtains the second data when the disaster recovery site runs the service through the relay site, and saves the second data in the primary database, ensuring that the primary site can successfully switch back to the service.

[0020] In another possible implementation, the master site sends the global transaction identifier GTID of each data in the master database to the relay site when returning to normal, so that the relay site determines the second data based on the GTID of each data in the master database and the GTID of each data in the relay database. Wherein, based on the GTID of each data in the master database and the GTID of each data in the relay database, it can be determined whether the relay database includes each data in the master database. If the relay database includes each data in the master database, the relay site acquires the second data and sends the second data to the master site, and the master site can save the second data in the master database, so that the master site does not need to rebuild the master database.

[0021] In a third aspect, the present application provides a method for backing up data, the method being applied to a relay site included in a cloud system, the cloud system also including a main site and a disaster recovery site, the transmission delay between the main site and the relay site being less than a delay threshold, the main site being located in a first area, the disaster recovery site being located in a second area, the first area being different from the second area, the main site including a main database, the relay site including a relay database, and the disaster recovery site including a disaster recovery database. In the method, the relay site receives first data, the first data being sent by the main site when saving the first data to the main database. The relay site saves the first data in the relay database. The relay site stores the first data saved in the relay database in the disaster recovery database.

[0022] Since the transmission delay between the main site and the relay site is less than the delay threshold, the relay site receives the first data sent by the main site while saving the first data to the main database, and saves the first data in the relay database. Then the relay site stores the first data saved in the relay database in the disaster recovery database, so that the data saved in the main database is consistent with the data saved in the relay database. When the main site fails, since the data saved in the main database is consistent with the data saved in the relay database, the relay site can store all the data in the relay database in the disaster recovery database, thereby avoiding data loss.

[0023] In a possible implementation manner, the relay site is located in the first area, thereby ensuring that the transmission delay between the master site and the relay site is less than a delay threshold.

[0024] In another possible implementation, the first data is data of a first service run by the primary site, and the disaster recovery site is used to run the first service after the primary site fails. The relay site receives second data, and the second data is data of the first service acquired when the disaster recovery site runs the first service. The relay site saves the second data in a relay database. In this way, the relay database can save the second data acquired by the disaster recovery site when running the service, so that the data saved in the relay database is consistent with the data saved in the disaster recovery database.

[0025] In another possible implementation, when the primary site returns to normal, the relay site sends the second data stored in the relay database to the primary site, so that the primary site stores the second data in the primary database. In this way, the primary site obtains the second data when the disaster recovery site is running the service, stores the second data in the primary database, and ensures that the primary site can successfully switch back to the service.

[0026] In another possible implementation, the relay site receives the global transaction identifier GTID of each data in the main database sent by the main site when the main site returns to normal. The relay site obtains the second data stored in the relay database based on the GTID of each data in the main database and the GTID of each database in the relay database.

[0027] Among them, the relay site can determine whether the relay database includes each data in the main database based on the GTID of each data in the main database and the GTID of each data in the relay database. If the relay database includes each data in the main database, the relay site obtains the second data and sends the second data to the main site. The main site can save the second data in the main database, so that the main site does not need to rebuild the main database.

[0028] In another possible implementation, when the relay site determines that the relay database stores each data in the main database based on the GTID of each data in the main database, the relay site obtains the second data stored in the relay database based on the GTID of each data in the main database and the GTID of each data in the relay database, so that the main site does not need to rebuild the main database.

[0029] In a fourth aspect, the present application provides a method for backing up data, the method being applied to a disaster recovery site included in a cloud system, the cloud system further comprising a primary site and a relay site, the transmission delay between the primary site and the relay site being less than a delay threshold, the primary site being located in a first area, the disaster recovery site being located in a second area, the first area being different from the second area, the primary site comprising a primary database, the relay site comprising a relay database, and the disaster recovery site comprising a disaster recovery database. In the method, the disaster recovery site receives first data stored in a relay database sent by the relay site, the first data stored in the relay database being data sent by the primary site to the relay site when the primary site saves the first data to the primary database through a write operation. The disaster recovery site stores the first data in the disaster recovery database.

[0030] Since the transmission delay between the main site and the relay site is less than the delay threshold, the main site sends the first data to the relay site when saving the first data in the main database, so that the data saved in the main database and the data saved in the relay database can be consistent. When the main site fails, since the data saved in the main database and the data saved in the relay database are consistent, the disaster recovery site can obtain data from the relay site, that is, all data in the relay database can be stored in the disaster recovery database, thereby avoiding data loss.

[0031] In a possible implementation manner, the relay site is located in the first area, thereby ensuring that the transmission delay between the master site and the relay site is less than a delay threshold.

[0032] In another possible implementation, the first data is data of a first service run by the primary site, and the disaster recovery site is used to run the first service after the primary site fails. The disaster recovery site obtains second data of the first service when running the first service. The disaster recovery site saves the second data in a disaster recovery database. The disaster recovery site stores the second data saved in the disaster recovery database in a relay database. In this way, the relay database can save the second data obtained by the disaster recovery site when running the service, so that the data saved in the relay database is consistent with the data saved in the disaster recovery database.

[0033] In another possible implementation, the disaster recovery site obtains the third data, the relay database stores the third data, but the disaster recovery database does not store the third data. The disaster recovery site stores the third data in the disaster recovery database. In this way, each data in the relay database can be stored in the disaster recovery database to avoid data loss.

[0034] In another possible implementation, the primary site is also used to run a second service corresponding to the first service, the disaster recovery site is also used to run the second service after the primary site fails, and the disaster recovery database includes a first database of the first service and a second database of the second service. The disaster recovery site obtains the fourth data, and the first database stores the fourth data, but the second database does not store the fourth data. The disaster recovery site stores the fourth data in the second database. In this way, the second database can include each data in the first database, ensuring that the disaster recovery site can successfully run the second service based on the second database.

[0035] In a fifth aspect, the present application provides a device for backing up data, which is used to execute the method in the second aspect or any possible implementation of the second aspect. Specifically, the device includes a unit for executing the method in the second aspect or any possible implementation of the second aspect.

[0036] In a sixth aspect, the present application provides a device for backing up data, which is used to execute the method in the third aspect or any possible implementation of the third aspect. Specifically, the device includes a unit for executing the method in the third aspect or any possible implementation of the third aspect.

[0037] In a seventh aspect, the present application provides a device for backing up data, which is used to execute the method in the fourth aspect or any possible implementation of the fourth aspect. Specifically, the device includes a unit for executing the method in the fourth aspect or any possible implementation of the fourth aspect.

[0038] In an eighth aspect, the present application provides a computing device cluster, the cluster comprising at least one computing device, each device in the at least one computing device comprising at least one processor and at least one memory, the at least one memory storing computer-readable instructions; the at least one processor executes the computer-readable instructions so that the cluster implements the method in the first aspect, the second aspect, the third aspect, the fourth aspect, any possible implementation manner of the first aspect, any possible implementation manner of the second aspect, any possible implementation manner of the third aspect, or any possible implementation manner of the fourth aspect.

[0039] In a ninth aspect, the present application provides a computer program product, comprising a computer program stored in a computer-readable storage medium, and the computer program is loaded by a processor to implement the method in the first aspect, the second aspect, the third aspect, the fourth aspect, any possible implementation of the first aspect, any possible implementation of the second aspect, any possible implementation of the third aspect, or any possible implementation of the fourth aspect.

[0040] In the tenth aspect, the present application provides a computer-readable storage medium for storing a computer program, wherein the computer program is loaded by a processor to execute the method in the first aspect, the second aspect, the third aspect, the fourth aspect, any possible implementation of the first aspect, any possible implementation of the second aspect, any possible implementation of the third aspect, or any possible implementation of the fourth aspect.

[0041] In the eleventh aspect, the present application provides a chip comprising a memory and a processor, the memory being used to store computer instructions, and the processor being used to call and run the computer instructions from the memory to execute the method in the first aspect, the second aspect, the third aspect, the fourth aspect, any possible implementation of the first aspect, any possible implementation of the second aspect, any possible implementation of the third aspect, or any possible implementation of the fourth aspect.

[0042] In a twelfth aspect, the present application provides a system for backing up data, comprising the device described in the fifth aspect, the device described in the sixth aspect, and the device described in the seventh aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Figure 1 It is a structural diagram of a cloud system provided by an embodiment of the present application;

[0044] Figure 2 is a schematic diagram of the structure of another cloud system provided in an embodiment of the present application;

[0045] Figure 3 This is a flow chart of a method for backing up data provided by an embodiment of the present application;

[0046] Figure 4 is a schematic diagram of transmitting first data provided by an embodiment of the present application;

[0047] Figure 5 This is a schematic diagram of backup data provided by an embodiment of the present application;

[0048] Figure 6 is a schematic diagram of transmitting second data provided by an embodiment of the present application;

[0049] Figure 7 It is a schematic diagram of the structure of a device for backing up data provided in an embodiment of the present application;

[0050] Figure 8 is a schematic diagram of the structure of another device for backing up data provided in an embodiment of the present application;

[0051] Fig. 9 is a schematic diagram of the structure of another device for backing up data provided in an embodiment of the present application;

[0052] Fig.10 is a schematic diagram of the structure of a computing device provided in an embodiment of the present application;

[0053] Fig.11 It is a schematic diagram of the structure of a cluster provided in an embodiment of the present application;

[0054] Fig.12 is a schematic diagram of the structure of another cluster provided in an embodiment of the present application;

[0055] Fig.13 is a schematic diagram of the structure of another computing device provided in an embodiment of the present application;

[0056] Fig.14 is a schematic diagram of the structure of another cluster provided in an embodiment of the present application;

[0057] Fig.15 is a schematic diagram of the structure of another cluster provided in an embodiment of the present application;

[0058] Fig.16 is a schematic diagram of the structure of another computing device provided in an embodiment of the present application;

[0059] Fig.17 is a schematic diagram of the structure of another cluster provided in an embodiment of the present application;

[0060] Fig.18 It is a schematic diagram of the structure of another cluster provided in an embodiment of the present application. DETAILED DESCRIPTION

[0061] The implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0062] See also Figure 1 An embodiment of the present application provides a cloud system 100, which includes a primary site 101, a relay site 102 and a disaster recovery site 103.

[0063] Among them, the main site 101 is located in the first area, the disaster recovery site 103 is located in the second area, the first area and the second area are different, the relay site 102 communicates with the main site 101 and the disaster recovery site 103 respectively, and the transmission delay between the main site 101 and the relay site 102 is less than the delay threshold.

[0064] Since the primary site 101 is located in the first area and the redundancy site 103 is located in the second area, the transmission delay between the primary site 101 and the redundancy site 103 may be greater than the delay threshold.

[0065] In some embodiments, the relay site 102 is also located in the first area, so that the distance between the master site 101 and the relay site 102 is relatively short, so that the transmission delay between the master site 101 and the relay site 102 is less than the delay threshold.

[0066] In some embodiments, the primary site 101, the relay site 102, and the disaster recovery site 103 may be different clusters (e.g., different data centers). The primary site 101 includes at least one computing device, the relay site 102 includes at least one computing device, and the disaster recovery site 103 includes at least one computing device.

[0067] The primary site 101 further includes a primary database, the relay site 102 further includes a relay database, and the disaster recovery site 103 further includes a disaster recovery database.

[0068] The main site 101 also includes at least one service, and the main site 101 is used to run the at least one service. Optionally, the main site 101 includes at least one application, and the at least one application corresponds to the at least one service. The main site 101 runs the at least one application to implement the at least one service corresponding to the at least one application.

[0069] The disaster recovery site 103 also includes the at least one service, that is, the disaster recovery site 103 includes at least one application corresponding to the at least one service. When the primary site 101 is normal, the primary site 101 runs the at least one service, obtains data of the at least one service during the running of the at least one service, and saves the data to the primary database.

[0070] When the primary site 101 is normal, the disaster recovery site 103 backs up the data stored in the primary database. That is, the primary site 101 needs to store the data stored in the primary database into the disaster recovery database in the disaster recovery site 103. In this way, when the primary site 101 fails, the disaster recovery site 103 takes over the at least one service and runs the at least one service based on the data stored in the disaster recovery database.

[0071] The primary site 101 may use an asynchronous replication method to store the data stored in the primary database into the disaster recovery database in the disaster recovery site 103 .

[0072] In implementation, when the primary site 101 obtains the first data, the first data is data of the first service obtained by the primary site 101 when running the first service, and the at least one service includes the first service. The first data is saved in the primary database through a write operation. Then, the first data is read from the primary database and sent to the disaster recovery site 103. The disaster recovery site 103 receives the first data and saves the first data in the disaster recovery database.

[0073] After the primary site 101 saves the first data to the primary database, it takes a period of time (usually 2-5 minutes) to read the first data from the primary database and send the first data to the disaster recovery site 103. In this way, when the primary site 103 fails, for the period closest to the current time, the primary site 101 cannot store the data obtained during the period closest to the current time into the disaster recovery database in the disaster recovery site 103, so that the data obtained during the period closest to the current time is lost. In other words, the disaster recovery database in the disaster recovery site 103 does not save the lost data, but the primary database in the primary site 101 saves the lost data, so that the data saved in the primary database is inconsistent with the data saved in the disaster recovery database.

[0074] After the disaster recovery site 103 takes over the at least one service, the disaster recovery site 103 runs the at least one service, obtains data of the at least one service when running the at least one service, and stores the obtained data in the disaster recovery database.

[0075] When the primary site 101 returns to normal, the at least one service needs to be switched back to the primary site 101 for operation. However, since the disaster recovery database does not include all the data in the primary database, the primary site 101 needs to rebuild the primary database. Since the primary database includes at least one database corresponding to the at least one service, the primary site 101 needs to obtain various data stored in the disaster recovery database when rebuilding the primary database, and rebuild the primary database including the at least one database based on the various data.

[0076] When rebuilding the primary database, all data in the disaster recovery database needs to be stored in the primary database. The amount of data stored in the disaster recovery database is very large, and it often takes several hours or even days to complete the reconstruction of the primary database, wasting a lot of time and resulting in very low efficiency of business switchback.

[0077] In order to solve the above problem, when the primary site 101 obtains the first data of the first service in the process of running the first service, the primary site 101 uses a semi-synchronous replication method to simultaneously save the first data to the primary database and the relay database in the relay site 102. Then, the relay site 102 uses an asynchronous replication method to store the first data saved in the relay database into the disaster recovery database in the disaster recovery site 103.

[0078] In this way, the data stored in the main database in the main site 101 and the data stored in the relay database in the relay site 102 are always consistent. When the main site 101 fails, the relay site 102 can continue to store the data stored in the relay database into the disaster recovery database, so that the data stored in the main database and the data stored in the disaster recovery database are also consistent, thereby avoiding data loss.

[0079] The so-called semi-synchronous replication mode means that the primary site 101 writes the first data to the primary database and the relay database through the same write operation, and the write operation is completed only after the first data is successfully written to the primary database and the relay database.

[0080] Optionally, since the transmission delay between the primary site 101 and the relay site 102 is less than the delay threshold, when the primary site 101 obtains the first data to be saved, the primary site 101 saves the first data to the primary database through a write operation and sends the first data to the relay site 102. The relay node 102 receives the first data and saves the first data to the relay database, and then the relay site stores the first data saved in the relay database in the disaster recovery database using asynchronous replication.

[0081] Since the transmission delay between the main site 101 and the relay site 102 is less than the delay threshold, the main site 101 can write the first data to the relay database located on the relay site 102 in a shorter time, thereby avoiding the long time taken for the write operation and affecting the operation of the main site 101.

[0082] For example, assuming that the delay threshold is 1.5 ms, that is, the transmission delay between the master site 101 and the relay site 102 is less than 1.5 ms. The time required for the master site 101 to write data to the relay database on the relay site 102 through a write operation is relatively short, so the first data can be written into the master database and the relay database respectively through one write operation.

[0083] The interruption node 102 stores the first data stored in the relay database into the disaster recovery database using an asynchronous replication method. The so-called asynchronous replication method means that after the first data is saved in the relay database, the relay site 102 reads the first data from the relay database, and then sends the read first data to the disaster recovery site, and the disaster recovery site saves the first data into the disaster recovery database.

[0084] It often takes a long time for the relay site 102 to read the first data from the relay database and send the read first data to the disaster recovery site 103, which may take several minutes, for example, 2-5 minutes.

[0085] The relay node 102 uses an asynchronous replication method to store the data stored in the relay database into the disaster recovery database. In this way, after the main site 101 fails, the data stored in the disaster recovery database is made consistent with the data stored in the main database through the asynchronous replication method, so that the disaster recovery site 103 can successfully take over the one or more services based on the disaster recovery database and can successfully run the one or more services.

[0086] The disaster recovery site 103 obtains the second data of the first service when running the first service, saves the second data in the disaster recovery database, and stores the second data saved in the disaster recovery database in the relay database in the relay site 102 by asynchronous replication.

[0087] When the primary site 101 is restored to normal, since the data stored in the relay database includes the data stored in the primary database, the relay site 102 copies the incremental data stored in the relay database after the failure of the primary site 101 to the primary database in the primary site 101, and the primary site 101 does not need to rebuild the primary database. After the incremental data in the relay database is stored in the primary database in the primary site 101, the at least one service can be switched back to the primary site 101.

[0088] Since the primary site 101 does not need to rebuild the primary database, only the incremental data in the relay database needs to be stored in the primary database in the primary site 101. Compared with the data volume of the entire disaster recovery database, the amount of incremental data is very small, and the time required to store the incremental data in the primary database is short, which can improve the efficiency of business switchback.

[0089] In some embodiments, see Figure 2 The cloud system 100 further includes a control device 104, which communicates with the primary site 101, the relay site 102 and the disaster recovery site 103 respectively.

[0090] The control device 104 includes a data migration tool, and the direction of data transmission is controlled by the data migration tool.

[0091] For example, when the primary site 101 is normal, the control device 104 controls the primary site 101 to use a semi-synchronous replication method to store the data obtained by the primary site 101 in the relay database in the relay site 102, and controls the relay site 102 to use an asynchronous replication method to store the data stored in the relay database in the disaster recovery database in the disaster recovery site 103. And / or,

[0092] When the primary site 101 fails, the control device 104 controls the disaster recovery site 103 to take over the at least one service, and controls the disaster recovery site 103 to store the data obtained by the disaster recovery site 103 in the relay database in the relay site 102 using asynchronous replication, and controls the relay site 102 to store the data stored in the relay database in the primary database in the primary site 101.

[0093] In some embodiments, the control device 104 may be integrated on the disaster recovery site 103 .

[0094] See also Figure 3 The present application embodiment provides a method 300 for backing up data, wherein the method 300 is applied to Figure 1 or Figure 2 The cloud system 100 is shown. The method 300 includes:

[0095] Step 301: The main site obtains first data to be saved, where the first data is data of a first service obtained by the main site when running the first service.

[0096] At least one service is running on the main site, and the first service is any service in the at least one service. The main database in the main site includes at least one database, and the at least one database corresponds to at least one service one by one. Each database is used to store data of the service corresponding to each database.

[0097] In some embodiments, the first data includes a global transaction identifier (GTID) of the first data, the GTID of the first data includes identification information of the first database corresponding to the first business and a sequence number of the first data, and the sequence number of the first data is obtained by adding the sequence number of the data acquired last time.

[0098] Before executing step 301, the control device obtains the transmission delay between the primary site and other sites near the primary site, selects other sites with transmission delay less than the delay threshold as relay sites, and sends a semi-synchronous replication status detection command to the primary site and the relay site.

[0099] The master site receives the semi-synchronous replication status detection command and detects whether the semi-synchronous replication status of the master site is turned on. If the semi-synchronous replication status of the master site is not turned on, the semi-synchronous replication status is turned on and a semi-synchronous replication status confirmation message is sent to the control device. If the semi-synchronous replication status of the master site is turned on, a semi-synchronous replication status confirmation message is sent to the control device.

[0100] The relay site receives the semi-synchronous replication state detection command and detects whether the semi-synchronous replication state of the relay site is turned on. If the semi-synchronous replication state of the relay site is not turned on, the semi-synchronous replication state is turned on and a semi-synchronous replication state confirmation message is sent to the control device. If the semi-synchronous replication state of the relay site is turned on, a semi-synchronous replication state confirmation message is sent to the control device.

[0101] The control device receives the semi-synchronous replication status confirmation message sent by the primary site and the semi-synchronous replication status confirmation message sent by the relay site, sends a semi-synchronous replication command to the primary site and the relay site, the semi-synchronous replication command includes the device identifier of the primary site and the device identifier of the relay site, and sends an asynchronous replication command to the relay site and the disaster recovery site, the asynchronous replication command includes the device identifier of the relay site and the device identifier of the disaster recovery site.

[0102] The master site receives a semi-synchronous replication command, the relay site receives the semi-synchronous replication command, the master site and the relay site establish a communication connection based on the device identifier of the master site and the device identifier of the relay site in the semi-synchronous replication command, and configure a semi-synchronous replication relationship between the master database in the master site and the relay database in the relay site. In this way, when the master site saves data to the master database, the data is also saved in the relay database of the relay site using a semi-synchronous replication method.

[0103] The relay site receives the asynchronous replication command, the disaster recovery site receives the asynchronous replication command, the relay site and the disaster recovery site establish a communication connection based on the device identifier of the relay site and the device identifier of the disaster recovery site in the asynchronous replication command, and configure an asynchronous replication relationship between the relay database in the relay site and the disaster recovery database in the disaster recovery site. In this way, the relay site stores the data stored in the relay database into the disaster recovery database in the disaster recovery site.

[0104] Then the primary site runs at least one service, and when running the first service, obtains first data to be stored and belonging to the first service.

[0105] Step 302: The primary site saves the first data to the primary database and the relay database through a write operation.

[0106] In step 302, the primary site saves the first data to the primary database and the relay database using a semi-synchronous replication method.

[0107] In some embodiments, see Figure 4 , the primary site saves the first data to the primary database and the relay database through a write operation. In implementation, the primary site saves the first data to the primary database through a write operation and also sends the first data to the relay site. The relay site receives the first data and saves the first data to the relay database.

[0108] Optionally, the main site sends a write operation request to the relay site, the write operation request including the first data. The relay site receives the write operation request, and saves the first data into the relay database based on the write operation request.

[0109] The master site completes the write operation only after the first data is successfully saved in the master database and the relay database. Since the transmission delay between the master site and the relay site is small and less than the delay threshold, the master site can save the first data in the relay database in the relay site in a relatively short time through the write operation.

[0110] In some embodiments, see Figure 5The main site also includes a backup database corresponding to the main database. The main site normally operates at least one service and obtains first data of the first service. When the main site saves the first data to the main database through the one write operation, it also saves the first data to the backup database, and sends the first data to the relay site while saving the first data to the backup database.

[0111] Step 303: The relay site stores the first data stored in the relay database to the disaster recovery database in the disaster recovery site.

[0112] In step 303, the relay site stores the first data stored in the relay database to the disaster recovery database in the disaster recovery site by using an asynchronous replication method.

[0113] When implementing, see Figure 4 After the relay site saves the first data to the relay database, it reads the first data from the relay database through a read operation and then sends the first data to the disaster recovery site. The disaster recovery site receives the first data and saves the first data to the disaster recovery database.

[0114] When the primary site fails, the data stored in the primary database of the primary site is the same as the data stored in the relay database of the relay site because the primary site and the relay site use semi-synchronous replication. At this time, the relay site may not have stored the data stored in the relay database of the primary site acquired in the first time period in the disaster recovery site. The first time period is the closest time period to the current time period (such as a time period of 2-5 minutes closest to the current time period). The relay site can continue to use asynchronous replication to store the data stored in the relay database of the primary site acquired in the first time period in the disaster recovery database of the disaster recovery site, thereby avoiding data loss.

[0115] After the primary site fails, the control device may wait for a first time length, which may be greater than or equal to the time length of the first time period, so that the relay site stores the data acquired by the primary site in the first time period and stored in the relay database into the disaster recovery database in the disaster recovery site. After the control device waits for the first time length, the control device sends a service takeover command to the disaster recovery site. After receiving the service takeover command, the disaster recovery site takes over the at least one service through the following process and runs the at least one service.

[0116] Step 304: the disaster recovery site obtains the third data, wherein the third data is stored in the relay database but not in the disaster recovery database, and saves the third data in the disaster recovery database.

[0117] When the disaster recovery site receives the service takeover command, some data in the relay database may not be stored in the disaster recovery database in time, and the data includes the third data. The disaster recovery site can check the relay database and the disaster recovery database to find out the data in the relay database that has not been stored in the disaster recovery database.

[0118] In step 304, the audit process is as follows: the disaster recovery site may send identification information of each data in the disaster recovery database to the relay site. The relay site receives the identification information of each data in the disaster recovery database, obtains the third data based on the identification information of each data in the disaster recovery database and the identification information of each data in the relay database, and sends the third data to the disaster recovery site. The disaster recovery site receives the third data and saves the third data in the disaster recovery database.

[0119] In this way, each data stored in the relay database is stored in the disaster recovery database, so that the data stored in the relay database is consistent with the data stored in the disaster recovery database, thereby avoiding data loss.

[0120] In some embodiments, the disaster recovery database includes at least one database, the at least one database corresponds to at least one business, and each database is used to store data of the business corresponding to each database.

[0121] The at least one service may include a second service corresponding to the first service, the at least one database includes first data of the first service and a second database of the second service, and the disaster recovery site needs the data of the first service when running the second service. In other words, the second database needs to store the data of the first service.

[0122] For example, assuming that the first business is an order business and the second business is a billing business, the first database is used to store order information generated by the order business. The order information is required when running the billing business, so the second database needs to store the data in the first database.

[0123] In some embodiments, before the disaster recovery site takes over the second service, some data in the first database of the first service may not be stored in the second database of the second service. Therefore, the disaster recovery site may also obtain the fourth data, which is stored in the first database but not in the second database; and store the fourth data in the second database.

[0124] That is, the disaster recovery site may audit the first database and the second database to find out some data in the first database that has not been stored in the second database, and the some data includes the fourth data.

[0125] In some embodiments, the audit process is as follows: the disaster recovery site may obtain identification information of each data in the first database, and obtain identification information of each data in the second database. Based on the identification information of each data in the first database and the identification information of each data in the second database, fourth data may be obtained. The fourth data may be stored in the second database.

[0126] After the disaster recovery site finds that each data stored in the relay database is stored in the disaster recovery database and / or finds that each data stored in the first database is stored in the second database, it starts at least one application corresponding to the at least one business and runs the at least one application to implement the operation of the at least one business.

[0127] Step 305: The disaster recovery site obtains second data to be saved, where the second data is data of the first service obtained when the disaster recovery site runs the first service, and saves the second data in the disaster recovery database.

[0128] The disaster recovery site runs a first service based on data stored in a first database included in the disaster recovery database, obtains second data of the first service to be stored during the running of the first service, and stores the second data in a second database in the disaster recovery database.

[0129] Step 306: The disaster recovery site stores the second data stored in the disaster recovery database into the relay database.

[0130] In step 306, see Figure 5 and Figure 6 After the disaster recovery site saves the second data to the disaster recovery database, it reads the second data from the disaster recovery database through a read operation, and then sends the second data to the relay site. The relay site receives the second data and saves the second data to the relay database. In other words, the disaster recovery site uses an asynchronous replication method to store the second data in the relay database.

[0131] After the main site fails, the technician repairs the main site. When the main site returns to normal, the control device sends a reverse semi-synchronous replication command to the relay site and the main site. The reverse semi-synchronous replication command is used to instruct the relay site to store the secondary data stored in the relay database into the main database in the main site, that is, to store the incremental data in the relay database after the main site fails into the main database.

[0132] Step 307: When the primary site returns to normal, the relay site sends the second data stored in the relay database to the primary site.

[0133] See also Figure 5 When receiving the reverse semi-synchronous replication command, the relay site determines that the primary site has recovered to normal, reads the second data from the relay database, and sends the second data to the primary site.

[0134] In some embodiments, when the primary site returns to normal, it obtains the GTID of each data in the primary database and sends the GTID of each data to the relay site.

[0135] The relay site receives the GTID of each data in the master database and obtains the GTID of each data in the relay database. Based on the GTID of each data in the master database and the GTID of each database in the relay database, it is determined whether the relay database includes each data in the master database. If the relay database includes each data in the master database, there is no need to rebuild the master database in the master site. At this time, the relay site only needs to store the incremental data in the relay database after the master site fails to the master database.

[0136] That is, if the relay database includes every data in the main database, the relay site reads the second data from the relay database and sends the second data to the main site.

[0137] Step 308: The primary site receives the second data and saves the second data into the primary database.

[0138] After the relay site stores all the incremental data stored in the relay database in the master database of the master site, it may continue to receive fourth data sent by the disaster recovery site. The fourth data is the data of the first service obtained by the disaster recovery site when running the first service. After the disaster recovery site saves the fourth data in the disaster recovery database, it reads the fourth data stored in the disaster recovery database and sends the fourth data to the relay node.

[0139] Since the relay site has stored all the incremental data stored in the relay database in the master database of the master site, the relay node uses reverse semi-synchronous replication to store the fourth data in the relay database and the master database when receiving the fourth data.

[0140] In some embodiments, see Figure 5 and Figure 6 , the relay site saves the fourth data to the relay database and the main database through a write operation. During implementation, the relay site saves the fourth data to the relay database through a write operation and also sends the fourth data to the main site. The main site receives the fourth data and saves the fourth data to the main database.

[0141] Optionally, the relay site sends a write operation request to the master site, the write operation request including the fourth data. The master site receives the write operation request, and based on the write operation request, saves the fourth data into the master database.

[0142] After the fourth data is successfully saved in the main database and the relay database, the relay site completes the write operation. Since the transmission delay between the main site and the relay site is small and less than the delay threshold, the relay site can save the fourth data in the main database of the main site in a relatively short time through the write operation.

[0143] See also Figure 6 , the control device may send a service stop command to the disaster recovery site, and after receiving the service stop command, the disaster recovery site stops running the at least one service. Since there is a time delay in the reverse asynchronous replication mode, when the disaster recovery site stops running the at least one service, the disaster recovery data stores the fifth data obtained by the disaster recovery site in the second time period, and the disaster recovery site has not stored the fifth data in the relay database, and the second time period is the closest time period to the current time period. Therefore, it is necessary to wait for the disaster recovery site to read the fifth data from the disaster recovery database and send the fifth data to the relay site.

[0144] The relay site receives the fifth data, saves the fifth data in the relay database, and sends the fifth data to the main site at the same time. The main site receives the fifth data and saves the fifth data in the main database. In this way, the data acquired by the disaster recovery site when running the service after the main site fails are stored in the main database, and then the control device sends a service switching back command to the main site. After receiving the service switching back command, the main site runs the at least one service based on the data saved in the main database.

[0145] In an embodiment of the present application, since the transmission delay between the main site and the relay site is less than the delay threshold, the main site obtains the first data to be saved, and sends the first data to the relay site while saving the first data to the main database of the main site through a write operation. The relay site receives the first data and saves the first data to the relay database, so that the data saved in the relay database and the data saved in the main database are always consistent. When the main site fails, but the relay site does not fail, and when the main site fails, the data saved in the main database is consistent with the data saved in the relay database, so the relay site continues to use asynchronous replication to store the data in the relay database in the disaster recovery database in the disaster recovery site, so that the data saved in the disaster recovery database is consistent with the data saved in the relay database, thereby avoiding data loss.

[0146] See also Figure 1, an embodiment of the present application provides a system 100 for backing up data, the system 100 includes a primary site 101, a relay site 102 and a disaster recovery site 103, the transmission delay between the primary site 101 and the relay site 102 is less than a delay threshold, the primary site 101 is located in a first area, the disaster recovery site 103 is located in a second area, the first area and the second area are different, the primary site 101 includes a primary database, the relay site 102 includes a relay database, and the disaster recovery site 103 includes a disaster recovery database;

[0147] The main site 101 is used to obtain first data to be saved;

[0148] The primary site 101 is further configured to save the first data to the primary database and send the first data to the relay site through a write operation;

[0149] The relay site 102 is used to store the first data in the relay database, and then store the first data stored in the relay database into the disaster recovery database.

[0150] Optionally, the detailed implementation process of the primary site 101 obtaining the first data can be found in Figure 3 Step 301 of the method 300 is not described in detail here.

[0151] Optionally, the detailed implementation process of the primary site 101 saving the first data to the primary database and sending the first data to the relay site is shown in Figure 3 Step 302 of the method 300 is not described in detail here.

[0152] Optionally, the relay site 102 stores the first data stored in the relay database in the disaster recovery database for a detailed implementation process. Figure 3 Step 303 of the method 300 is not described in detail here.

[0153] Optionally, the relay site is located in the first area.

[0154] Optionally, the first data is data of a first service run by the primary site;

[0155] The disaster recovery site 103 is used to run the first service after the primary site fails, and obtain the second data of the first service when running the first service;

[0156] The disaster recovery site 103 is further used to store the second data in the disaster recovery database;

[0157] The disaster recovery site 103 is further configured to store the second data stored in the disaster recovery database into the relay database.

[0158] Optionally, the detailed implementation process of the disaster recovery site 103 obtaining the second data is shown in Figure 3Step 305 of the method 300 is not described in detail here.

[0159] Optionally, the detailed implementation process of the disaster recovery site 103 storing the second data in the disaster recovery database is shown in Figure 3 Step 305 of the method 300 is not described in detail here.

[0160] Optionally, the disaster recovery site 103 stores the second data stored in the disaster recovery database into the relay database. For a detailed implementation process, see Figure 3 Step 306 of the method 300 is not described in detail here.

[0161] Optionally, the disaster recovery site 103 is further used to obtain third data, the relay database stores the third data, but the disaster recovery database does not store the third data;

[0162] The disaster recovery site 103 is also used to store the third data in the disaster recovery database.

[0163] Optionally, the detailed implementation process of the disaster recovery site 103 obtaining the third data is shown in Figure 3 Step 304 of the method 300 is not described in detail here.

[0164] Optionally, the detailed implementation process of the disaster recovery site 103 storing the third data in the disaster recovery database is shown in Figure 3 Step 304 of the method 300 is not described in detail here.

[0165] Optionally, the primary site is further used to run a second service corresponding to the first service, the disaster recovery site is further used to run the second service after the primary site fails, and the disaster recovery database includes a first database of the first service and a second database of the second service;

[0166] The disaster recovery site 103 is further used to obtain fourth data. The first database stores the fourth data, but the second database does not store the fourth data.

[0167] The disaster recovery site 103 is further configured to store the fourth data in the second database.

[0168] Optionally, the detailed implementation process of the disaster recovery site 103 obtaining the fourth data is shown in Figure 3 Step 304 of the method 300 is not described in detail here.

[0169] Optionally, the detailed implementation process of the disaster recovery site 103 storing the fourth data in the second database is shown in Figure 3 Step 304 of the method 300 is not described in detail here.

[0170] Optionally, the relay site 102 is further configured to send the second data stored in the relay database to the main site when the main site returns to normal;

[0171] The primary site 101 is further configured to store the second data in the primary database.

[0172] Optionally, the detailed implementation process of the relay station 102 sending the second data stored in the relay database is shown in Figure 3 Step 307 of the method 300 is not described in detail here.

[0173] Optionally, the detailed implementation process of the primary site 101 storing the second data in the primary database is shown in Figure 3 Step 308 of the method 300 is not described in detail here.

[0174] Optionally, the primary site 101 is further configured to send a global transaction identifier GTID of each data in the primary database to the relay site 102 when the primary site 101 returns to normal;

[0175] The relay site 102 is further used to determine the second data based on the GTID of each data in the main database and the GTID of each data in the relay database.

[0176] Optionally, the master site 101 sends the GTID of each data in the master database for a detailed implementation process, see Figure 3 Step 307 of the method 300 is not described in detail here.

[0177] Optionally, the detailed implementation process of the relay station 102 obtaining the second data stored in the relay database is shown in Figure 3 Step 307 of the method 300 is not described in detail here.

[0178] Optionally, the relay site 102 is also used to obtain the second data stored in the relay database based on the GTID of each data in the main database and the GTID of each data in the relay database when it is determined that the relay database stores each data in the main database based on the GTID of each data in the main database.

[0179] Optionally, the relay site 102 determines that the relay database stores each data in the main database based on the GTID of each data in the main database. For a detailed implementation process, see Figure 3 Step 307 of the method 300 is not described in detail here.

[0180] In the embodiment of the present application, since the transmission delay between the main site and the relay site is less than the delay threshold, the main site sends the first data to the relay site while saving the first data in the main database, and the relay site stores the first data saved in the relay database in the disaster recovery database, so that the data saved in the main database is consistent with the data saved in the relay database. When the main site fails, since the data saved in the main database is consistent with the data saved in the relay database, the relay site can store all the data in the relay database in the disaster recovery database, thereby avoiding data loss.

[0181] See also Figure 7 The present application embodiment provides a device 700 for backing up data, and the device 700 is applied to Figure 1 or Figure 2 The cloud system 100 shown in FIG. 1 includes the device 700, a relay site, and a disaster recovery site. The transmission delay between the device 700 and the relay site is less than the delay threshold. The device 700 is located in a first area, and the disaster recovery site is located in a second area. The first area and the second area are different. The device 700 includes a primary database, the relay site includes a relay database, and the disaster recovery site includes a disaster recovery database. The device 700 is deployed at Figure 1 or Figure 2 On the primary site in the cloud system shown in the figure, or deployed on Figure 3 The method 300 is shown on the main site. The device 700 includes a processing unit 701 and a sending unit 702;

[0182] The processing unit 701 is used to obtain first data to be saved;

[0183] The processing unit 701 is further configured to save the first data to the primary database through a write operation and enable the sending unit 702 to send the first data to the relay site, so that the relay site saves the first data to the relay database, and then stores the first data saved in the relay database into the disaster recovery database.

[0184] Optionally, the detailed implementation process of the processing unit 701 obtaining the first data can be found in Figure 3 Step 301 of the method 300 is not described in detail here.

[0185] Optionally, the detailed implementation process of the processing unit 701 saving the first data to the main database and sending the first data to the relay station is shown in Figure 3 Step 302 of the method 300 is not described in detail here.

[0186] Optionally, the relay site is located in the first area.

[0187] Optionally, the first data is data of a first service run by the apparatus 700, and the disaster recovery site is used to run the first service after the apparatus 700 fails. The apparatus 700 further includes a receiving unit 703,

[0188] A receiving unit 703 is used to receive second data saved in the relay database when the device 700 returns to normal, where the second data is data stored in the relay database by the disaster recovery site, and the second data is data of the first service acquired when the disaster recovery site runs the first service;

[0189] The processing unit 701 is further configured to store the second data in the main database.

[0190] Optionally, the detailed implementation process of the receiving unit 702 receiving the second data is shown in Figure 3 Step 308 of the method 300 is not described in detail here.

[0191] Optionally, the detailed implementation process of the processing unit 701 storing the second data in the main database is shown in Figure 3 Step 308 of the method 300 is not described in detail here.

[0192] Optionally, the sending unit 703 is used to send the global transaction identifier GTID of each data in the main database to the relay site when the device 700 returns to normal, so that the relay site determines the second data based on the GTID of each data in the main database and the GTID of each data in the relay database.

[0193] Optionally, the detailed implementation process of the sending unit 703 sending the GTID of each data in the master database can be found in Figure 3 Step 307 of the method 300 is not described in detail here.

[0194] In the embodiment of the present application, since the transmission delay between the device and the relay site is less than the delay threshold, the processing unit obtains the first data to be saved, saves the first data to the main database through a write operation, and sends the first data to the relay site, so that the data saved in the main database is consistent with the data saved in the relay database. When the device fails, since the data saved in the main database is consistent with the data saved in the relay database, the relay site can store all the data in the relay database in the disaster recovery database, thereby avoiding data loss.

[0195] See also Figure 8, an embodiment of the present application provides a device 800 for backing up data, and the device 800 is applied to a cloud system. The cloud system includes a primary site, the device 800, and a disaster recovery site, and the transmission delay between the primary site and the device 800 is less than the delay threshold. The primary site is located in a first area, and the disaster recovery site is located in a second area, and the first area and the second area are different. The primary site includes a primary database, the device 800 includes a relay database, and the disaster recovery site includes a disaster recovery database. The device 700 is deployed at Figure 1 or Figure 2 On a relay site in the cloud system shown in the figure, or deployed on Figure 3 The apparatus 800 comprises:

[0196] The receiving unit 801 is used to receive first data, where the first data is sent by the primary site when saving the first data to the primary database;

[0197] The processing unit 802 is used to save the first data into the relay database;

[0198] The processing unit 802 is further configured to store the first data stored in the relay database in the disaster recovery database.

[0199] Optionally, the detailed implementation process of the receiving unit 801 receiving the first data is shown in Figure 3 Step 302 of the method 300 is not described in detail here.

[0200] Optionally, the detailed implementation process of the processing unit 802 saving the first data to the relay database is shown in Figure 3 Step 302 of the method 300 is not described in detail here.

[0201] Optionally, the detailed implementation process of the processing unit 802 storing the first data stored in the relay database in the disaster recovery database is shown in Figure 3 Step 303 of the method 300 is not described in detail here.

[0202] Optionally, the device 800 is located in the first area.

[0203] Optionally, the first data is data of a first service running at the primary site, and the disaster recovery site is used to run the first service after the primary site fails;

[0204] The receiving unit 801 is further configured to receive second data, where the second data is data of the first service acquired when the disaster recovery site runs the first service;

[0205] The processing unit is further used to store the second data in the relay database.

[0206] Optionally, the detailed implementation process of the receiving unit 801 receiving the second data is shown in Figure 3 Step 306 of the method 300 is not described in detail here.

[0207] Optionally, the detailed implementation process of the processing unit 802 storing the second data in the relay database is shown in Figure 3 Step 306 of the method 300 is not described in detail here.

[0208] Optionally, the device 800 further includes a sending unit 803;

[0209] The sending unit 803 is used to send the second data stored in the relay database to the master site when the master site returns to normal, so that the master site stores the second data in the master database.

[0210] Optionally, the detailed implementation process of the sending unit 803 sending the second data stored in the relay database is shown in Figure 3 Step 307 of the method 300 is not described in detail here.

[0211] Optionally, the receiving unit 801 is further configured to receive a global transaction identifier GTID of each data in the primary database sent when the primary site recovers to normal;

[0212] The processing unit 802 is further configured to obtain the second data stored in the relay database based on the GTID of each data in the main database and the GTID of each database in the relay database.

[0213] Optionally, the detailed implementation process of the receiving unit 801 receiving the GTID of each data in the master database can be found in Figure 3 Step 307 of the method 300 is not described in detail here.

[0214] Optionally, the detailed implementation process of the processing unit 802 obtaining the second data stored in the relay database is shown in Figure 3 Step 307 of the method 300 is not described in detail here.

[0215] Optionally, processing unit 802 is used to obtain second data stored in the relay database based on the GTID of each data in the main database and the GTID of each data in the relay database when it is determined that the relay database stores each data in the main database based on the GTID of each data in the main database.

[0216] Optionally, the processing unit 802 determines that the relay database stores each data in the main database based on the GTID of each data in the main database. For a detailed implementation process, see Figure 3 Step 307 of the method 300 is not described in detail here.

[0217] In the embodiment of the present application, since the transmission delay between the main site and the device is less than the delay threshold, the receiving unit receives the first data sent by the main site while saving the first data to the main database, and the processing unit stores the first data saved in the relay database in the disaster recovery database, so that the data saved in the main database is consistent with the data saved in the relay database. When the main site fails, since the data saved in the main database is consistent with the data saved in the relay database, the processing unit can store all the data in the relay database in the disaster recovery database, thereby avoiding data loss.

[0218] See also Fig. 9 , an embodiment of the present application provides a device 900 for backing up data, and the device 900 is applied to a cloud system. The cloud system includes a primary site, a relay site, and the device 900, and the transmission delay between the primary site and the relay site is less than the delay threshold. The primary site is located in a first area, and the device 900 is located in a second area, and the first area and the second area are different. The primary site includes a primary database, the relay site includes a relay database, and the device 900 includes a disaster recovery database. The device 900 is deployed in Figure 1 or Figure 2 The disaster recovery site in the cloud system shown in the figure, or deployed on Figure 3 The method 300 is shown at a disaster recovery site. The device 900 includes:

[0219] A receiving unit 901 is used to receive first data stored in a relay database sent by a relay site, where the first data stored in the relay database is data sent to the relay site by the master site when saving the first data to the master database through a write operation;

[0220] The processing unit 902 is configured to store the first data in a disaster recovery database.

[0221] Optionally, the detailed implementation process of the receiving unit 901 receiving the first data stored in the relay database sent by the relay station can be found in Figure 3 Step 303 of the method 300 is not described in detail here.

[0222] Optionally, the detailed implementation process of the processing unit 902 storing the first data in the disaster recovery database is shown in Figure 3 Step 303 of the method 300 is not described in detail here.

[0223] Optionally, the relay site is located in the first area.

[0224] Optionally, the first data is data of a first service run by the primary site, and the apparatus 900 is used to run the first service after the primary site fails, and the processing unit 902 is further used to:

[0225] Acquiring second data of the first service when running the first service;

[0226] The second data is stored in a disaster recovery database;

[0227] The second data stored in the disaster recovery database is stored in the relay database.

[0228] Optionally, the detailed implementation process of the processing unit 902 obtaining the second data is shown in Figure 3 Step 305 of the method 300 is not described in detail here.

[0229] Optionally, the detailed implementation process of the processing unit 902 storing the second data in the disaster recovery database is shown in Figure 3 Step 305 of the method 300 is not described in detail here.

[0230] Optionally, the processing unit 902 stores the second data stored in the disaster recovery database into the relay database for a detailed implementation process. Figure 3 Step 306 of the method 300 is not described in detail here.

[0231] Optionally, the processing unit 902 is further configured to:

[0232] Acquire the third data. The third data is stored in the relay database, but not in the disaster recovery database.

[0233] The third data is stored in the disaster recovery database.

[0234] Optionally, the detailed implementation process of the processing unit 902 obtaining the third data is shown in Figure 3 Step 304 of the method 300 is not described in detail here.

[0235] Optionally, the detailed implementation process of the processing unit 902 storing the third data in the disaster recovery database is shown in Figure 3 Step 304 of the method 300 is not described in detail here.

[0236] Optionally, the primary site is further used to run a second service corresponding to the first service, the apparatus 900 is further used to run the second service after the primary site fails, the disaster recovery database includes a first database of the first service and a second database of the second service, and the processing unit 902 is further used to:

[0237] Acquire fourth data, the fourth data is stored in the first database but not in the second database;

[0238] The fourth data is stored in the second database.

[0239] Optionally, the detailed implementation process of the processing unit 902 obtaining the fourth data can be found in Figure 3 Step 304 of the method 300 is not described in detail here.

[0240] Optionally, the detailed implementation process of the processing unit 902 storing the fourth data in the second database is shown in Figure 3 Step 304 of the method 300 is not described in detail here.

[0241] In the embodiment of the present application, since the transmission delay between the main site and the device is less than the delay threshold, the main site sends the first data to the relay site when saving the first data in the main database, so that the data saved in the main database and the data saved in the relay database can be consistent. When the main site fails, since the data saved in the main database and the data saved in the relay database are consistent, the processing unit can obtain data from the relay site, that is, all data in the relay database can be stored in the disaster recovery database, thereby avoiding data loss.

[0242] See also Fig.10 , the present application embodiment provides a computing device 1000. For example, the computing device 1000 may be Figure 1 or Figure 2 The main site of the cloud system shown includes equipment, or is Figure 3 A device in a primary site of the illustrated method 300 .

[0243] like Fig.10 As shown, computing device 1000 includes: bus 1002, processor 1004, memory 1006 and communication interface 1008. Processor 1004, memory 1006 and communication interface 1008 communicate through bus 1002. Computing device 1000 can be a server or a terminal device. It should be understood that the present application does not limit the number of processors and memories in computing device 1000.

[0244] The bus 1002 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.10 The bus 1002 may include a path for transmitting information between various components of the computing device 1000 (eg, the memory 1006, the processor 1004, and the communication interface 1008).

[0245] The processor 1004 may include any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).

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

[0247] See also Fig.10 , the memory 1006 stores executable program codes, and the processor 1004 executes the executable program codes to respectively implement Figure 7 The functions of the processing unit 701, the sending unit 702 and the receiving unit 703 in the device 700 shown in the figure are implemented to realize the method provided by any of the above embodiments. That is, the memory 1006 stores instructions for executing the method provided by any of the above embodiments. Or,

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

[0249] The embodiment of the present application also provides a cluster. The cluster includes at least one computing device. The computing device can be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device can also be a terminal device such as a desktop computer, a laptop computer, or a smart phone.

[0250] like Fig.11 As shown, the cluster includes at least one computing device 1000. The memory 1006 in one or more computing devices 1000 in the cluster may store the same instructions for executing the method provided in any of the above embodiments.

[0251] In some possible implementations, the memory 1006 of one or more computing devices 1000 in the cluster may also store partial instructions for executing the above-mentioned method for backing up data. In other words, a combination of one or more computing devices 1000 may jointly execute instructions for executing the method provided in any of the above-mentioned embodiments.

[0252] In some possible implementations, one or more computing devices in the cluster may be connected via a network, which may be a wide area network or a local area network. Fig.12 A possible implementation is shown. Fig.12 As shown, two computing devices 1000A and 1000B are connected via a network. Specifically, they are connected to the network via a communication interface in each computing device.

[0253] In this type of possible implementation, the memory 1006 in the computing device 1000A stores the execution Figure 7 Instructions for the functions of the processing unit 701 in the embodiment shown. At the same time, the memory 1006 in the computing device 1000B stores instructions for executing the functions of the processing unit 701 in the embodiment shown. Figure 7 Instructions for the functions of the sending unit 702 and the receiving unit 703 in the illustrated embodiment.

[0254] It should be understood that Fig.12 The functions of the computing device 1000A shown in FIG. 1000A may also be completed by multiple computing devices 1000. Similarly, the functions of the computing device 1000B may also be completed by multiple computing devices 1000.

[0255] The present application embodiment also provides another cluster. The connection relationship between the computing devices in the cluster can be similar to that of Fig.12 The connection mode of the cluster of the acquisition function is different in that the memory 1006 in one or more computing devices 1000 in the cluster may store the same instructions for executing the method provided by any of the above embodiments.

[0256] In some possible implementations, the memory 1006 of one or more computing devices 1000 in the cluster may also store partial instructions for executing the method provided in any of the above embodiments. In other words, the combination of one or more computing devices 1000 may jointly execute instructions for executing the method provided in any of the above embodiments.

[0257] See also Fig.13 , the present application embodiment provides a computing device 1300. For example, the computing device 1300 may be Figure 1 or Figure 2 The relay site in the cloud system shown includes a device, or is Figure 3A device in a relay site of the illustrated method 300.

[0258] like Fig.13 As shown, the computing device 1300 includes: a bus 1302, a processor 1304, a memory 1306, and a communication interface 1308. The processor 1304, the memory 1306, and the communication interface 1308 communicate through the bus 1302. The computing device 1300 can be a server or a terminal device. It should be understood that the present application does not limit the number of processors and memories in the computing device 1300.

[0259] The bus 1302 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.13 The bus 1302 may include a path for transmitting information between various components of the computing device 1300 (eg, the memory 1306, the processor 1304, and the communication interface 1308).

[0260] The processor 1304 may include any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).

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

[0262] See also Fig.13 , the memory 1306 stores executable program codes, and the processor 1304 executes the executable program codes to respectively implement Figure 8The functions of the processing unit 802, the receiving unit 801 and the sending unit 703 in the device 800 shown in the figure are implemented to realize the method provided by any of the above embodiments. That is, the memory 1306 stores instructions for executing the method provided by any of the above embodiments. Or,

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

[0264] The embodiment of the present application also provides a cluster. The cluster includes at least one computing device. The computing device can be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device can also be a terminal device such as a desktop computer, a laptop computer, or a smart phone.

[0265] like Fig.14 As shown, the cluster includes at least one computing device 1300. The memory 1306 in one or more computing devices 1300 in the cluster may store the same instructions for executing the method provided in any of the above embodiments.

[0266] In some possible implementations, the memory 1306 of one or more computing devices 1300 in the cluster may also store partial instructions for executing the above-mentioned method for backing up data. In other words, a combination of one or more computing devices 1300 may jointly execute instructions for executing the method provided in any of the above-mentioned embodiments.

[0267] In some possible implementations, one or more computing devices in the cluster may be connected via a network, which may be a wide area network or a local area network. Fig.15 A possible implementation is shown. Fig.15 As shown, two computing devices 1300A and 1300B are connected via a network. Specifically, they are connected to the network via a communication interface in each computing device.

[0268] In this type of possible implementation, the memory 1306 in the computing device 1300A stores the execution Figure 8 Instructions for the functions of the processing unit 802 in the illustrated embodiment. Meanwhile, the memory 1306 in the computing device 1300B stores instructions for executing the functions of the processing unit 802 in the illustrated embodiment. Figure 8 Instructions for the functions of the receiving unit 801 and the sending unit 803 in the illustrated embodiment.

[0269] It should be understood that Fig.15The functions of the computing device 1300A shown in FIG. 1300A may also be completed by multiple computing devices 1300. Similarly, the functions of the computing device 1300B may also be completed by multiple computing devices 1300.

[0270] The present application embodiment also provides another cluster. The connection relationship between the computing devices in the cluster can be similar to that of Fig.15 The connection mode of the cluster of the acquisition function is different in that the memory 1306 in one or more computing devices 1300 in the cluster may store the same instructions for executing the method provided by any of the above embodiments.

[0271] In some possible implementations, the memory 1306 of one or more computing devices 1300 in the cluster may also store partial instructions for executing the method provided in any of the above embodiments. In other words, the combination of one or more computing devices 1300 may jointly execute instructions for executing the method provided in any of the above embodiments.

[0272] See also Fig.16 , the present application embodiment provides a computing device 1600. For example, the computing device 1600 may be Figure 1 or Figure 2 The disaster recovery site in the cloud system shown includes devices, or Figure 3 Devices in a disaster recovery site of the method 300 are shown.

[0273] like Fig.16 As shown, computing device 1600 includes: bus 1602, processor 1604, memory 1606 and communication interface 1608. Processor 1604, memory 1606 and communication interface 1608 communicate through bus 1602. Computing device 1600 can be a server or a terminal device. It should be understood that the present application does not limit the number of processors and memories in computing device 1600.

[0274] The bus 1602 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.16 The bus 1602 may include a path for transmitting information between various components of the computing device 1600 (eg, the memory 1606, the processor 1604, and the communication interface 1608).

[0275] The processor 1604 may include any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).

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

[0277] See also Fig.16 , the memory 1606 stores executable program codes, and the processor 1604 executes the executable program codes to respectively implement Fig. 9 The functions of the processing unit 902 and the receiving unit 901 in the device 900 shown in the figure are implemented to realize the method provided by any of the above embodiments. That is, the memory 1606 stores instructions for executing the method provided by any of the above embodiments. Or,

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

[0279] The embodiment of the present application also provides a cluster. The cluster includes at least one computing device. The computing device can be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device can also be a terminal device such as a desktop computer, a laptop computer, or a smart phone.

[0280] like Fig.17 As shown, the cluster includes at least one computing device 1600. The memory 1606 in one or more computing devices 1600 in the cluster may store the same instructions for executing the method provided in any of the above embodiments.

[0281] In some possible implementations, the memory 1606 of one or more computing devices 1600 in the cluster may also store partial instructions for executing the above-mentioned method for backing up data. In other words, the combination of one or more computing devices 1600 may jointly execute instructions for executing the method provided in any of the above-mentioned embodiments.

[0282] In some possible implementations, one or more computing devices in the cluster may be connected via a network, which may be a wide area network or a local area network. Fig.18 A possible implementation is shown. Fig.18 As shown, two computing devices 1600A and 1600B are connected via a network. Specifically, they are connected to the network via a communication interface in each computing device.

[0283] In this type of possible implementation, the memory 1606 in the computing device 1600A stores the execution Fig. 9 Instructions for the functions of the processing unit 902 in the illustrated embodiment. Meanwhile, the memory 1606 in the computing device 1600B stores instructions for executing the functions of the processing unit 902 in the illustrated embodiment. Fig. 9 Instructions for the functionality of the receiving unit 901 in the illustrated embodiment.

[0284] It should be understood that Fig.18 The functions of the computing device 1600A shown in FIG. 1 may also be completed by multiple computing devices 1600. Similarly, the functions of the computing device 1600B may also be completed by multiple computing devices 1600.

[0285] The present application embodiment also provides another cluster. The connection relationship between the computing devices in the cluster can be similar to that of Fig.18 The connection mode of the cluster of the acquisition function. The difference is that the memory 1606 in one or more computing devices 1600 in the cluster may store the same instructions for executing the method provided by any of the above embodiments.

[0286] In some possible implementations, the memory 1606 of one or more computing devices 1600 in the cluster may also store partial instructions for executing the method provided in any of the above embodiments. In other words, the combination of one or more computing devices 1600 may jointly execute instructions for executing the method provided in any of the above embodiments.

[0287] The present application also provides a computer program product including instructions. The computer program product may be software or a program product including instructions that can be run on a computing device or stored in any available medium. When the computer program product is run on at least one computing device, the at least one computing device executes the method provided in any of the above embodiments.

[0288] The embodiment of the present application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that can be stored by a computing device or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk). The computer-readable storage medium includes instructions that instruct the computing device to execute the method provided in any of the above embodiments.

[0289] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.

[0290] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present application shall be included in the protection scope of the present application.

Claims

1. A method for backing up data, characterized in that: The method is applied to a primary site included in a cloud system, the cloud system further includes a relay site and a disaster recovery site, the transmission delay between the primary site and the relay site is less than a delay threshold, the primary site is located in a first area, the disaster recovery site is located in a second area, the first area and the second area are different, the primary site includes a primary database, the relay site includes a relay database, and the disaster recovery site includes a disaster recovery database, the method includes: The primary site acquires first data to be saved; The primary site saves the first data to the primary database and sends the first data to the relay site through a write operation; The relay site saves the first data in the relay database, and then stores the first data saved in the relay database in the disaster recovery database.

2. The method according to claim 1, characterized in that The relay site is located in the first area.

3. The method according to claim 1 or 2, characterized in that The first data is data of a first service running at the primary site, and the redundancy site is used to run the first service after the primary site fails. The method further includes: The disaster recovery site obtains second data of the first service when running the first service; The disaster recovery site stores the second data in the disaster recovery database; The disaster recovery site stores the second data stored in the disaster recovery database into the relay database.

4. The method according to claim 3, characterized in that Before the disaster recovery site runs the first service, the method further includes: The disaster recovery site obtains the third data, the relay database stores the third data, but the disaster recovery database does not store the third data; The disaster recovery site stores the third data in the disaster recovery database.

5. The method according to claim 3 or 4, characterized in that The primary site is further used to run a second service corresponding to the first service, the disaster recovery site is further used to run the second service after the primary site fails, the disaster recovery database includes a first database of the first service and a second database of the second service, and before the disaster recovery site runs the first service and the second service, the method further includes: The disaster recovery site obtains fourth data, the fourth data is stored in the first database, but the fourth data is not stored in the second database; The disaster recovery site stores the fourth data in the second database.

6. The method according to any one of claims 3 to 5, characterized in that: The method further comprises: When the primary site returns to normal, the relay site sends the second data stored in the relay database to the primary site; The master site stores the second data in the master database.

7. The method according to claim 6, characterized in that The method further comprises: When the primary site returns to normal, the primary site sends the global transaction identifier GTID of each data in the primary database to the relay site; The relay site determines the second data based on the GTID of each data in the main database and the GTID of each data in the relay database.

8. The method according to claim 7, characterized in that The relay site obtains the second data stored in the relay database based on the GTID of each data in the main database and the GTID of each database in the relay database, including: When the relay site determines that the relay database stores each data in the main database based on the GTID of each data in the main database, the relay site obtains the second data stored in the relay database based on the GTID of each data in the main database and the GTID of each data in the relay database.

9. A system for backing up data, characterized in that: The system includes a primary site, a relay site and a disaster recovery site, the transmission delay between the primary site and the relay site is less than a delay threshold, the primary site is located in a first area, the disaster recovery site is located in a second area, the first area and the second area are different, the primary site includes a primary database, the relay site includes a relay database, and the disaster recovery site includes a disaster recovery database; The main site is used to obtain the first data to be saved; The primary site is further configured to save the first data to the primary database and send the first data to the relay site through a write operation; The relay site is used to save the first data in the relay database, and then store the first data saved in the relay database into the disaster recovery database.

10. The system according to claim 9, characterized in that The relay site is located in the first area.

11. The system according to claim 9 or 10, characterized in that The first data is data of a first service run by the primary site; The disaster recovery site is used to run the first service after the primary site fails, and obtain the second data of the first service when running the first service; The disaster recovery site is further used to store the second data in the disaster recovery database; The disaster recovery site is further configured to store the second data stored in the disaster recovery database into the relay database.

12. The system according to claim 11, characterized in that The disaster recovery site is further used to obtain third data, the third data is stored in the relay database, but the third data is not stored in the disaster recovery database; The disaster recovery site is further used to store the third data in the disaster recovery database.

13. The system according to claim 11 or 12, characterized in that The primary site is further used to run a second service corresponding to the first service, the disaster recovery site is further used to run the second service after the primary site fails, and the disaster recovery database includes a first database of the first service and a second database of the second service; The disaster recovery site is further used to obtain fourth data, the fourth data is stored in the first database, but the fourth data is not stored in the second database; The disaster recovery site is further used to store the fourth data in the second database.

14. The system according to any one of claims 11 to 13, characterized in that: The relay site is further configured to send the second data stored in the relay database to the main site when the main site returns to normal; The primary site is further configured to store the second data in the primary database.

15. The system of claim 14, wherein: The primary site is further configured to send a global transaction identifier GTID of each data in the primary database to the relay site when the primary site returns to normal; The relay site is further used to determine the second data based on the GTID of each data in the main database and the GTID of each data in the relay database.

16. The system of claim 15, wherein: The relay site is also used to obtain the second data stored in the relay database based on the GTID of each data in the main database and the GTID of each data in the relay database when it is determined that the relay database stores each data in the main database based on the GTID of each data in the main database.

17. A computing device cluster, characterized in that: The cluster includes at least one computing device, each of the at least one computing device includes at least one processor and at least one memory, and the at least one memory stores computer-readable instructions; the at least one processor executes the computer-readable instructions so that the cluster executes the method according to any one of claims 1 to 8.

18. A computer storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.

19. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.