Data backup method, system, and storage medium
By introducing relay sites in the cloud system, using semi-synchronous replication and asynchronous replication, data is synchronized from the main database to the relay database, and then asynchronously replicated from the relay database to the disaster recovery database, solving the problem of data loss in the cloud system. , improves data recovery efficiency.
Patent Information
- Application Number
- PCT/CN2024/077744
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-05-12
- Filing Date
- 2024-02-20
- Publication Date
- 2024-11-21
AI Technical Summary
The asynchronous replication method between the main site and the disaster recovery site in the cloud system causes data to be unable to be stored in the disaster recovery database in time when the main site fails, resulting in data loss.
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 to the disaster recovery database through asynchronous replication, thereby ensuring that the main database and the disaster recovery database are data consistency.
It effectively avoids data loss, improves the efficiency of business switching, reduces the time for primary database reconstruction, and improves the speed of data recovery.
Smart Images

Figure CN2024077744_21112024_PF_FP_ABST
Abstract
Description
Data backup method, system and storage medium
[0001] This application claims priority to Chinese patent application No. 202310538138.6, filed on May 12, 2023, entitled “Method, system and storage medium for backing up data”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] 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
[0003] Cloud systems have extremely high requirements for data reliability. To improve reliability, a primary site is used to provide services to users, while a redundancy site is used to back up the data at the primary site. The primary site and the redundancy site are located in different regions. This way, if the primary site fails and becomes unavailable, the redundancy site will take over and continue providing services to users.
[0004] The primary site includes a primary database, and the redundancy site includes a redundancy database. When the primary site obtains service data, it stores it in the primary database. The primary site then uses asynchronous replication to read the data from the primary database and sends it to the redundancy site, which then stores it in the redundancy database. This ensures that the redundancy database also stores the service data. When the redundancy site takes over the service, it provides the service to users based on the redundancy database.
[0005] Asynchronous replication requires a delay after writing data to the primary database before storing it in the disaster recovery database. During this delay, the primary site first reads the data from the primary database and then sends it to the disaster recovery site. Therefore, if the primary site fails, the data retrieved during this period cannot be stored in the disaster recovery database, resulting in data loss.
[0006] Summary of the Invention
[0007] This application provides a method, system, and storage medium for backing up data to avoid data loss. The technical solution is as follows:
[0008] 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.
[0009] In the method, the primary site obtains 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 in the disaster recovery database.
[0010] Because the transmission delay between the primary site and the relay site is less than the delay threshold, the primary site saves the first data to the primary database and sends the first data to the relay site through a single write operation, resulting in the data stored in the primary database being consistent with the data stored in the relay database. In the event of a primary site failure, because the data stored in the primary database is consistent with the data stored 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.
[0011] In a possible implementation, 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.
[0012] In another possible implementation, 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 a failure of the primary site. While running the first service, the redundancy site obtains second data of the first service. The redundancy site stores the second data in a redundancy database. The redundancy site then stores the second data stored in the redundancy database in a relay database. This allows the relay database to store the second data obtained by the redundancy site while running the service, ensuring that the data stored in the relay database is consistent with the data stored in the redundancy database.
[0013] In another possible implementation, the disaster recovery site obtains the third data. The relay database already stores the third data, but the disaster recovery database does not. The disaster recovery site stores the third data in the disaster recovery database. This allows all data in the relay database to be stored in the disaster recovery database, preventing data loss.
[0014] In another possible implementation, the primary site is also used to run a second service corresponding to the first service, and the redundancy site is also used to run the second service after a failure of the primary site. The redundancy database includes a first database for the first service and a second database for the second service. The redundancy site obtains fourth data. The first database already stores the fourth data, but the second database does not. The redundancy site stores the fourth data in the second database. This ensures that the second database includes every data item in the first database, ensuring that the redundancy site can successfully run the second service based on the second database.
[0015] 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. This allows the primary site to obtain the second data from the redundancy site when it is operating, through the relay site, and store the second data in the primary database, ensuring that the primary site can successfully switch back to normal operations.
[0016] In another possible implementation, upon recovery, the primary site sends the global transaction identifier (GTID) of each data item in the primary database to the relay site. The relay site determines the second data based on the GTID of each data item in the primary database and the GTID of each data item in the relay database. Based on the GTID of each data item in the primary database and the GTID of each data item in the relay database, it can be determined whether the relay database includes each data item in the primary database. If the relay database includes each data item in the primary database, the relay site obtains the second data and sends it to the primary site. The primary site can save the second data in the primary database, eliminating the need for the primary site to rebuild the primary database.
[0017] 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.
[0018] In a second 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. In the method, the primary site obtains 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 in the disaster recovery database.
[0019] Because the transmission delay between the primary site and the relay site is less than the delay threshold, the primary site saves the first data to the primary database and sends the first data to the relay site through a single write operation, resulting in the data stored in the primary database being consistent with the data stored in the relay database. In the event of a primary site failure, because the data stored in the primary database is consistent with the data stored 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.
[0020] In a possible implementation, 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.
[0021] In another possible implementation, 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 a failure at the primary site. Upon restoration, the primary site receives second data stored in the relay database. The second data is data stored in the relay database by the redundancy site and is obtained while the redundancy site is running the first service. The primary site stores the second data in the primary database. In this way, the primary site obtains the second data from the redundancy site 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 service.
[0022] In another possible implementation, upon recovery, the primary site sends the global transaction identifier (GTID) of each data item in the primary database to the relay site, allowing the relay site to determine the second data item based on the GTID of each data item in the primary database and the GTID of each data item in the relay database. Based on the GTID of each data item in the primary database and the GTID of each data item in the relay database, it can be determined whether the relay database includes each data item in the primary database. If the relay database includes each data item in the primary database, the relay site obtains the second data item and sends it to the primary site. The primary site can save the second data item in the primary database, thereby eliminating the need for the primary site to rebuild the primary database.
[0023] In a third aspect, the present application provides a method for backing up data, which is applied to a relay site included in a cloud system, the cloud system also including a primary 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. In the method, the relay site receives first data, which is sent by the primary site when saving the first data to the primary 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.
[0024] Because the transmission delay between the primary site and the relay site is less than the delay threshold, the relay site receives the first data sent by the primary site simultaneously with the first data being saved in the primary database, and stores the first data in the relay database. The relay site then stores the first data stored in the relay database in the disaster recovery database, ensuring that the data stored in the primary database and the data stored in the relay database are consistent. If the primary site fails, since the data stored in the primary database and the data stored in the relay database are consistent, the relay site can store all the data in the relay database in the disaster recovery database, thus avoiding data loss.
[0025] In a possible implementation, 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.
[0026] In another possible implementation, 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 a failure of the primary site. The relay site receives second data, which is data of the first service obtained when the redundancy site runs the first service. The relay site stores the second data in a relay database. This ensures that the relay database stores the second data obtained by the redundancy site when running the service, ensuring that the data stored in the relay database is consistent with the data stored in the redundancy database.
[0027] 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, causing the primary site to store the second data in the primary database. This allows the primary site to obtain the second data from the disaster recovery site while the service is running, and store the second data in the primary database, ensuring that the primary site can successfully switch back to service.
[0028] In another possible implementation, the relay site receives the global transaction identifier (GTID) of each data item in the primary database sent by the primary site when the primary site returns to normal. Based on the GTID of each data item in the primary database and the GTID of each database in the relay database, the relay site obtains the second data stored in the relay database.
[0029] 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.
[0030] 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.
[0031] 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 saving the first data to the primary database through a write operation. The disaster recovery site stores the first data in the disaster recovery database.
[0032] Because the transmission delay between the primary site and the relay site is less than the delay threshold, the primary site sends the first data to the relay site when saving the first data to the primary database. This ensures that the data stored in the primary database and the data stored in the relay database are consistent. If the primary site fails, because the data stored in the primary database and the data stored in the relay database are consistent, the disaster recovery site can obtain data from the relay site. In other words, all data in the relay database can be stored in the disaster recovery database, thereby avoiding data loss.
[0033] In a possible implementation, 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.
[0034] In another possible implementation, 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 a failure of the primary site. While running the first service, the redundancy site obtains second data of the first service. The redundancy site stores the second data in a redundancy database. The redundancy site then stores the second data stored in the redundancy database in the relay database. This ensures that the relay database stores the second data obtained by the redundancy site while running the service, ensuring that the data stored in the relay database is consistent with the data stored in the redundancy database.
[0035] In another possible implementation, the disaster recovery site obtains the third data. The relay database already stores the third data, but the disaster recovery database does not. The disaster recovery site stores the third data in the disaster recovery database. This allows all data in the relay database to be stored in the disaster recovery database, preventing data loss.
[0036] In another possible implementation, the primary site is also used to run a second service corresponding to the first service, and the redundancy site is also used to run the second service after a failure of the primary site. The redundancy database includes a first database for the first service and a second database for the second service. The redundancy site obtains fourth data. The first database already stores the fourth data, but the second database does not. The redundancy site stores the fourth data in the second database. This ensures that the second database includes every data item in the first database, ensuring that the redundancy site can successfully run the second service based on the second database.
[0037] In a fifth aspect, the present application provides a device for backing up data, configured 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.
[0038] In a sixth aspect, the present application provides a device for backing up data, configured 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.
[0039] In a seventh aspect, the present application provides a device for backing up data, configured 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.
[0040] 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 of 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 ninth aspect, the present application provides a computer program product, which includes 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.
[0042] In the tenth aspect, the present application provides a computer-readable storage medium for storing a computer program, which 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.
[0043] 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.
[0044] In a twelfth aspect, the present application provides a system for backing up data, comprising the apparatus described in the fifth aspect, the apparatus described in the sixth aspect, and the apparatus described in the seventh aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] FIG1 is a schematic diagram of the structure of a cloud system provided in an embodiment of the present application;
[0046] FIG2 is a schematic diagram of the structure of another cloud system provided in an embodiment of the present application;
[0047] FIG3 is a flow chart of a method for backing up data provided in an embodiment of the present application;
[0048] FIG4 is a schematic diagram of transmitting first data provided by an embodiment of the present application;
[0049] FIG5 is a schematic diagram of backup data provided by an embodiment of the present application;
[0050] FIG6 is a schematic diagram of transmitting second data provided by an embodiment of the present application;
[0051] FIG7 is a schematic diagram of the structure of a device for backing up data provided in an embodiment of the present application;
[0052] FIG8 is a schematic diagram of the structure of another device for backing up data provided in an embodiment of the present application;
[0053] FIG9 is a schematic diagram of the structure of another device for backing up data provided in an embodiment of the present application;
[0054] FIG10 is a schematic diagram of the structure of a computing device provided in an embodiment of the present application;
[0055] FIG11 is a schematic diagram of the structure of a cluster provided in an embodiment of the present application;
[0056] FIG12 is a schematic diagram of the structure of another cluster provided in an embodiment of the present application;
[0057] FIG13 is a schematic diagram of the structure of another computing device provided in an embodiment of the present application;
[0058] FIG14 is a schematic diagram of the structure of another cluster provided in an embodiment of the present application;
[0059] FIG15 is a schematic diagram of the structure of another cluster provided in an embodiment of the present application;
[0060] FIG16 is a schematic diagram of the structure of another computing device provided in an embodiment of the present application;
[0061] FIG17 is a schematic diagram of the structure of another cluster provided in an embodiment of the present application;
[0062] FIG18 is a schematic diagram of the structure of another cluster provided in an embodiment of the present application. DETAILED DESCRIPTION
[0063] The embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
[0064] 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 .
[0065] 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.
[0066] 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.
[0067] 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 close, so that the transmission delay between the master site 101 and the relay site 102 is less than the delay threshold.
[0068] In some embodiments, primary site 101, relay site 102, and disaster recovery site 103 may be different clusters (e.g., different data centers). Primary site 101 includes at least one computing device, relay site 102 includes at least one computing device, and disaster recovery site 103 includes at least one computing device.
[0069] 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.
[0070] The primary site 101 also includes at least one service, and the primary site 101 is configured to run the at least one service. Optionally, the primary site 101 includes at least one application, and the at least one application corresponds one-to-one with the at least one service. The primary site 101 runs the at least one application to implement the at least one service corresponding to the at least one application.
[0071] Disaster recovery site 103 also includes the at least one service, that is, the at least one application corresponding to the at least one service. When primary site 101 is normal, 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.
[0072] When primary site 101 is operating normally, redundancy site 103 backs up the data stored in the primary database. That is, primary site 101 needs to store the data stored in the primary database in the redundancy database at redundancy site 103. In this way, if primary site 101 fails, redundancy site 103 takes over the at least one service and runs the at least one service based on the data stored in the redundancy database.
[0073] The primary site 101 may use asynchronous replication to store the data stored in the primary database into the disaster recovery database in the disaster recovery site 103 .
[0074] During implementation, when primary site 101 obtains the first data, the first data is data of the first service obtained by primary site 101 while running the first service, where the at least one service includes the first service. A write operation is performed to save the first data to the primary database. Then, the first data is read from the primary database and sent to disaster recovery site 103. Disaster recovery site 103 receives the first data and saves it to the disaster recovery database.
[0075] After primary site 101 saves the first data to the primary database, it takes a while (typically 2-5 minutes) to read the first data from the primary database and send it to disaster recovery site 103. Therefore, if primary site 103 fails, primary site 101 will be unable to store the data acquired during the most recent period of time in the disaster recovery database at disaster recovery site 103, resulting in loss of data acquired during the most recent period of time. In other words, the disaster recovery database at disaster recovery site 103 does not store the lost data, but the primary database at primary site 101 does, resulting in inconsistency between the data stored in the primary database and the data stored in the disaster recovery database.
[0076] 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.
[0077] When primary site 101 returns to normal, the at least one service needs to be switched back to primary site 101 for operation. However, since the disaster recovery database does not include all the data in the primary database, 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, primary site 101 needs to obtain the 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 data.
[0078] 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.
[0079] To solve the above problem, when primary site 101 obtains first data of the first service while running the first service, it uses semi-synchronous replication to simultaneously save the first data to the primary database and the relay database at relay site 102. Relay site 102 then uses asynchronous replication to store the first data stored in the relay database into the disaster recovery database at disaster recovery site 103.
[0080] In this way, the data stored in the primary database of the primary site 101 and the data stored in the relay database of the relay site 102 are always consistent. When the primary 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 primary database and the data stored in the disaster recovery database are also consistent, thereby avoiding data loss.
[0081] 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 completes the write operation only after the first data is successfully written to the primary database and the relay database.
[0082] Optionally, because the transmission delay between primary site 101 and relay site 102 is less than the delay threshold, when primary site 101 obtains the first data to be saved, it saves the first data to the primary database through a write operation and sends the first data to relay site 102. Relay site 102 receives the first data and saves the first data to the relay database. Then, the relay site uses asynchronous replication to store the first data saved in the relay database in the disaster recovery database.
[0083] Since the transmission delay between the master site 101 and the relay site 102 is less than the delay threshold, the master site 101 can write the first data to the relay database located on the relay site 102 in a shorter time, thereby avoiding the write operation taking a long time and affecting the operation of the master site 101.
[0084] For example, assuming the latency threshold is 1.5 ms, that is, the transmission latency 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 to both the master database and the relay database through one write operation.
[0085] Relay site 102 uses asynchronous replication to store the first data stored in the relay database in the disaster recovery database. Asynchronous replication means that after the first data is stored in the relay database, relay site 102 reads the first data from the relay database and then sends the read first data to the disaster recovery site, which then stores the first data in the disaster recovery database.
[0086] 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.
[0087] Relay site 102 uses asynchronous replication to store data stored in the relay database in the disaster recovery database. This allows the data stored in the disaster recovery database to be consistent with the data stored in the primary database after a failure at primary site 101, allowing disaster recovery site 103 to successfully take over and successfully operate one or more services based on the disaster recovery database.
[0088] 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 using asynchronous replication.
[0089] When primary site 101 returns to normal, because the data stored in the relay database includes the data stored in the primary database, relay site 102 copies the incremental data stored in the relay database after the failure of primary site 101 to the primary database in primary site 101, eliminating the need for primary site 101 to rebuild the primary database. After the incremental data in the relay database is stored in the primary database in primary site 101, the at least one service can be switched back to primary site 101.
[0090] Since the primary site 101 does not need to rebuild the primary database, it only needs to store the incremental data in the relay database 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.
[0091] In some embodiments, referring to FIG. 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.
[0092] The control device 104 includes a data migration tool, and the direction of data transmission is controlled by the data migration tool.
[0093] For example, when the primary site 101 is normal, the control device 104 controls the primary site 101 to use semi-synchronous replication to store the data obtained by the primary site 101 in the relay database of the relay site 102, and controls the relay site 102 to use asynchronous replication to store the data stored in the relay database in the disaster recovery database of the disaster recovery site 103. And / or,
[0094] When the primary site 101 fails, the control device 104 controls the disaster recovery site 103 to take over the at least one business, and controls the disaster recovery site 103 to use asynchronous replication to store the data obtained by the disaster recovery site 103 in the relay database in the relay site 102, and controls the relay site 102 to store the data stored in the relay database in the primary database in the primary site 101.
[0095] In some embodiments, the control device 104 may be integrated into the disaster recovery site 103 .
[0096] 3 , an embodiment of the present application provides a method 300 for backing up data, which is applied to the cloud system 100 shown in FIG. 1 or FIG. 2 . The method 300 includes:
[0097] Step 301: The primary site obtains first data to be saved, where the first data is data of a first service obtained by the primary site when running the first service.
[0098] At least one service is running on the primary site, and the first service is any one of the at least one service. The primary database in the primary site includes at least one database, and the at least one database corresponds to the at least one service. Each database is used to store data of the service corresponding to each database.
[0099] 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. The sequence number of the first data is obtained by adding the sequence number of the data obtained last time.
[0100] 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.
[0101] The master site receives the semisynchronous replication status detection command and detects whether the semisynchronous replication status of the master site is enabled. If the semisynchronous replication status of the master site is not enabled, the master site enables the semisynchronous replication status and sends a semisynchronous replication status confirmation message to the control device. If the semisynchronous replication status of the master site is enabled, the master site sends a semisynchronous replication status confirmation message to the control device.
[0102] The relay site receives the semi-synchronous replication status detection command and detects whether the semi-synchronous replication status of the relay site is enabled. If the semi-synchronous replication status of the relay site is not enabled, the relay site enables the semi-synchronous replication status and sends a semi-synchronous replication status confirmation message to the control device. If the semi-synchronous replication status of the relay site is enabled, the relay site sends a semi-synchronous replication status confirmation message to the control device.
[0103] 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, and sends an asynchronous replication command to the relay site and the disaster recovery site, and the asynchronous replication command includes the device identifier of the relay site and the device identifier of the disaster recovery site.
[0104] The master site receives a semi-synchronous replication command, and the relay site receives the semi-synchronous replication command. The master site and the relay site establish a communication connection based on the master site's device identifier and the relay site's device identifier in the semi-synchronous replication command, and configure a semi-synchronous replication relationship between the master database at the master site and the relay database at the relay site. Thus, when the master site saves data to the master database, the data is also saved to the relay database at the relay site using semi-synchronous replication.
[0105] The relay site receives the asynchronous replication command, and 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 at the relay site and the disaster recovery database at the disaster recovery site. The relay site then stores the data stored in the relay database in the disaster recovery database at the disaster recovery site.
[0106] Then the primary site runs at least one service, and when running the first service, obtains first data to be saved and belonging to the first service.
[0107] Step 302: The primary site saves the first data to the primary database and the relay database through a write operation.
[0108] In step 302 , the primary site saves the first data to the primary database and the relay database using a semi-synchronous replication method.
[0109] In some embodiments, referring to FIG4 , the primary site saves the first data to both the primary database and the relay database through a single write operation. In implementation, the primary site simultaneously saves the first data to the primary database and sends the first data to the relay site through a single write operation. The relay site receives the first data and saves it to the relay database.
[0110] Optionally, the primary site sends a write operation request to the relay site, where the write operation request includes 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.
[0111] The primary site completes the write operation only after the first data is successfully saved in the primary database and the relay database. Since the transmission delay between the primary site and the relay site is relatively short, less than the delay threshold, the primary site can save the first data to the relay database at the relay site in a relatively short time through this write operation.
[0112] In some embodiments, referring to FIG5 , the primary site also includes a backup database corresponding to the primary database. The primary site normally operates at least one service and obtains first data of the first service. When the primary site saves the first data to the primary database through the single write operation, it also saves the first data to the backup database. While saving the first data to the backup database, the primary site simultaneously sends the first data to the relay site.
[0113] Step 303: The relay site stores the first data stored in the relay database to the disaster recovery database in the disaster recovery site.
[0114] 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.
[0115] 4 , after saving the first data to the relay database, the relay site 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 it to the disaster recovery database.
[0116] When the primary site fails, semi-synchronous replication is used between the primary site and the relay site, so the data stored in the primary database at the primary site and the data stored in the relay database at the relay site are identical. However, at this point, the relay site may not have yet stored the data stored in the relay database that the primary site acquired during the first time period, which is the most recent time period (e.g., a period of 2-5 minutes). The relay site can continue to use asynchronous replication to store the data stored in the relay database that the primary site acquired during the first time period, into the disaster recovery database at the disaster recovery site, thereby avoiding data loss.
[0117] After a primary site fails, the control device may wait for a first duration, which may be greater than or equal to the duration of the first time period, to allow the relay site to store the data acquired by the primary site during the first time period, stored in the relay database, into the disaster recovery database at the disaster recovery site. After the control device waits for the first duration, 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 and runs the at least one service through the following process.
[0118] Step 304: The disaster recovery site obtains the third data, wherein the relay database stores the third data but the disaster recovery database does not store the third data, and saves the third data into the disaster recovery database.
[0119] 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 a timely manner, and the data may include the third data. The disaster recovery site can audit the relay database and the disaster recovery database to find the data in the relay database that has not been stored in the disaster recovery database.
[0120] In step 304, the audit process is as follows: the disaster recovery site may send identification information of each data item in the disaster recovery database to the relay site. The relay site receives the identification information of each data item in the disaster recovery database, obtains third data based on the identification information of each data item in the disaster recovery database and the identification information of each data item 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.
[0121] 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.
[0122] In some embodiments, the disaster recovery database includes at least one database, the at least one database corresponds to at least one service, and each database is used to store data of the service corresponding to each database.
[0123] The at least one service may include a second service corresponding to the first service. The at least one database includes first data for the first service and a second database for the second service. The disaster recovery site requires the data for the first service when running the second service. In other words, the second database must store the data for the first service.
[0124] For example, if the first business is an order business and the second business is a billing business, the first database is used to store the order information generated by the order business. The billing business requires the use of order information, so the second database needs to store the data in the first database.
[0125] 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 fourth data, which is stored in the first database but not in the second database, and then store the fourth data in the second database.
[0126] 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 yet been stored in the second database, and the data includes the fourth data.
[0127] In some embodiments, the audit process includes: the disaster recovery site may obtain identification information of each data item in the first database and identification information of each data item in the second database; obtain fourth data item based on the identification information of each data item in the first database and the identification information of each data item in the second database; and store the fourth data item in the second database.
[0128] After the disaster recovery site finds that every data stored in the relay database is stored in the disaster recovery database and / or finds that every 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 realize the operation of the at least one business.
[0129] 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.
[0130] 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.
[0131] Step 306: The disaster recovery site stores the second data stored in the disaster recovery database into the relay database.
[0132] In step 306, as shown in Figures 5 and 6 , after saving the second data to the disaster recovery database, the disaster recovery site 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 it to the relay database. In other words, the disaster recovery site uses asynchronous replication to store the second data in the relay database.
[0133] After a master site failure, technicians repair the master site. When the master site returns to normal, the control device sends a reverse semi-synchronous replication command to the relay site and the master site. This reverse semi-synchronous replication command instructs the relay site to transfer the secondary data stored in the relay database to the master database at the master site. This means that the incremental data in the relay database after the master site failure is transferred to the master database.
[0134] 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.
[0135] 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.
[0136] 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.
[0137] The relay site receives the GTID of each data item in the master database and obtains the GTID of each data item in the relay database. Based on the GTID of each data item in the master database and the GTID of each database in the relay database, it determines whether the relay database includes every data item in the master database. If the relay database includes every data item in the master database, there is no need to rebuild the master database in the master site. In this case, the relay site only needs to store the incremental data in the relay database after the master site failure in the master database.
[0138] 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.
[0139] Step 308: The primary site receives the second data and saves the second data into the primary database.
[0140] After the relay site stores all incremental data stored in the relay database in the primary database of the primary site, it may continue to receive fourth data from the disaster recovery site. The fourth data is data of the first service acquired by the disaster recovery site while running the first service. After storing the fourth data in the disaster recovery database, the disaster recovery site reads the fourth data from the disaster recovery database and sends the fourth data to the relay site.
[0141] 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 site uses reverse semi-synchronous replication to save the fourth data in the relay database and the master database when receiving the fourth data.
[0142] In some embodiments, referring to Figures 5 and 6 , the relay site saves the fourth data to the relay database and the master database through a single write operation. During implementation, the relay site simultaneously saves the fourth data to the relay database through a single write operation and sends the fourth data to the master site. The master site receives the fourth data and saves it to the master database.
[0143] 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 saves the fourth data into the master database based on the write operation request.
[0144] The relay site completes the write operation only after the fourth data is successfully stored in the primary database and the relay database. Since the transmission delay between the primary site and the relay site is relatively short, less than the delay threshold, the relay site can quickly store the fourth data in the primary database at the primary site through this write operation.
[0145] As shown in Figure 6, the control device can send a service stop command to the disaster recovery site. After receiving the service stop command, the disaster recovery site stops running the at least one service. Due to the time delay in reverse asynchronous replication, when the disaster recovery site stops running the at least one service, the disaster recovery data contains the fifth data obtained by the disaster recovery site during the second time period. The disaster recovery site has not yet stored the fifth data in the relay database. The second time period is the most recent 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.
[0146] The relay site receives the fifth data, stores the fifth data in the relay database, and simultaneously sends the fifth data to the primary site. The primary site receives the fifth data and stores it in the primary database. This allows the data acquired by the redundancy site while running services after a failure at the primary site to be stored in the primary database. The control device then sends a service switchback command to the primary site. Upon receiving the service switchback command, the primary site runs the at least one service based on the data stored in the primary database.
[0147] 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.
[0148] 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, and 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.
[0149] The primary site 101 is configured to obtain first data to be stored;
[0150] 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;
[0151] The relay site 102 is configured to store the first data in a relay database, and then store the first data stored in the relay database in a disaster recovery database.
[0152] Optionally, the detailed implementation process of the master site 101 acquiring the first data refers to step 301 of the method 300 shown in FIG3 , which will not be described in detail here.
[0153] Optionally, the detailed implementation process of the primary site 101 storing the first data in the primary database and sending the first data to the relay site is shown in step 302 of the method 300 shown in FIG3 , which will not be described in detail here.
[0154] Optionally, the detailed implementation process of the relay site 102 storing the first data stored in the relay database in the disaster recovery database is shown in step 303 of the method 300 shown in FIG3 , which will not be described in detail here.
[0155] Optionally, the relay site is located in the first area.
[0156] Optionally, the first data is data of a first service run by the primary site;
[0157] The disaster recovery site 103 is configured to run the first service after the primary site fails, and obtain the second data of the first service while running the first service;
[0158] The disaster recovery site 103 is further configured to store the second data in a disaster recovery database;
[0159] The disaster recovery site 103 is further configured to store the second data stored in the disaster recovery database into the relay database.
[0160] Optionally, the detailed implementation process of the disaster recovery site 103 acquiring the second data is referred to step 305 of the method 300 shown in FIG3 , which will not be described in detail here.
[0161] Optionally, the detailed implementation process of the disaster recovery site 103 storing the second data in the disaster recovery database is shown in step 305 of the method 300 shown in FIG3 , which will not be described in detail here.
[0162] Optionally, the detailed implementation process of the disaster recovery site 103 storing the second data stored in the disaster recovery database into the relay database is shown in step 306 of the method 300 shown in FIG3 , which will not be described in detail here.
[0163] Optionally, the disaster recovery site 103 is further configured to obtain third data. The relay database stores the third data, but the disaster recovery database does not store the third data.
[0164] The disaster recovery site 103 is further configured to store the third data in the disaster recovery database.
[0165] Optionally, the detailed implementation process of the disaster recovery site 103 acquiring the third data is referred to step 304 of the method 300 shown in FIG3 , which will not be described in detail here.
[0166] Optionally, the detailed implementation process of the disaster recovery site 103 storing the third data in the disaster recovery database is shown in step 304 of the method 300 shown in FIG3 , which will not be described in detail here.
[0167] Optionally, the primary site is further configured to run a second service corresponding to the first service, and the disaster recovery site is further configured to run the second service after a failure of the primary site, and the disaster recovery database includes a first database for the first service and a second database for the second service;
[0168] The disaster recovery site 103 is further configured to obtain fourth data. The first database stores the fourth data, but the second database does not store the fourth data.
[0169] The disaster recovery site 103 is further configured to store the fourth data in the second database.
[0170] Optionally, the detailed implementation process of the disaster recovery site 103 acquiring the fourth data refers to step 304 of the method 300 shown in FIG3 , which will not be described in detail here.
[0171] Optionally, the detailed implementation process of the disaster recovery site 103 storing the fourth data in the second database is shown in step 304 of the method 300 shown in FIG3 , which will not be described in detail here.
[0172] 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;
[0173] The primary site 101 is further configured to store the second data in the primary database.
[0174] Optionally, the detailed implementation process of the relay station 102 sending the second data stored in the relay database refers to step 307 of the method 300 shown in FIG3 , which will not be described in detail here.
[0175] Optionally, the detailed implementation process of the primary site 101 storing the second data in the primary database is referred to step 308 of the method 300 shown in FIG3 , which will not be described in detail here.
[0176] 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;
[0177] The relay site 102 is further configured 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.
[0178] Optionally, the detailed implementation process of the primary site 101 sending the GTID of each data in the primary database is shown in step 307 of the method 300 shown in FIG3 , which will not be described in detail here.
[0179] Optionally, the detailed implementation process of the relay station 102 acquiring the second data stored in the relay database refers to step 307 of the method 300 shown in FIG3 , which will not be described in detail here.
[0180] Optionally, the relay site 102 is further 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.
[0181] Optionally, the relay site 102 determines that the relay database stores each data in the master database based on the GTID of each data in the master database. For a detailed implementation process, see step 307 of the method 300 shown in FIG. 3 , which will not be described in detail here.
[0182] In an embodiment of the present application, because the transmission delay between the primary site and the relay site is less than the delay threshold, the primary site simultaneously stores the first data in the primary database and sends the first data to the relay site. The relay site stores the first data stored in the relay database in the disaster recovery database, ensuring that the data stored in the primary database and the data stored in the relay database are consistent. When the primary site fails, because the data stored in the primary database and the data stored in the relay database are consistent, the relay site can store all the data in the relay database in the disaster recovery database, thereby avoiding data loss.
[0183] Referring to Figure 7, an embodiment of the present application provides a device 700 for backing up data, and the device 700 is applied to the cloud system 100 shown in Figure 1 or Figure 2. The cloud system 100 includes the device 700, a relay site and a disaster recovery site, and the transmission delay between the device 700 and the relay site is less than the delay threshold. The device 700 is located in the first area, and the disaster recovery site is located in the second area, and 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 on the primary site in the cloud system shown in Figure 1 or Figure 2, or on the primary site of the method 300 shown in Figure 3. The device 700 includes a processing unit 701 and a sending unit 702;
[0184] The processing unit 701 is configured to obtain first data to be stored;
[0185] 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.
[0186] Optionally, the detailed implementation process of the processing unit 701 obtaining the first data refers to step 301 of the method 300 shown in FIG3 , which will not be described in detail here.
[0187] 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 step 302 of the method 300 shown in FIG3 , which will not be described in detail here.
[0188] Optionally, the relay site is located in the first area.
[0189] 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.
[0190] A receiving unit 703 is configured to receive second data stored in the relay database when the apparatus 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 obtained when the disaster recovery site runs the first service;
[0191] The processing unit 701 is further configured to store the second data in the main database.
[0192] Optionally, the detailed implementation process of the receiving unit 702 receiving the second data refers to step 308 of the method 300 shown in FIG3 , which will not be described in detail here.
[0193] Optionally, the detailed implementation process of the processing unit 701 storing the second data in the main database refers to step 308 of the method 300 shown in FIG3 , which will not be described in detail here.
[0194] 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.
[0195] Optionally, the detailed implementation process of the sending unit 703 sending the GTID of each data in the master database can be found in step 307 of the method 300 shown in FIG3 , which will not be described in detail here.
[0196] In the embodiment of the present application, because 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 stored, stores the first data in the primary database through a write operation, and sends the first data to the relay site, so that the data stored in the primary database and the data stored in the relay database are consistent. When the device fails, because the data stored in the primary database and the data stored in the relay database are consistent, the relay site can store all the data in the relay database in the disaster recovery database, thereby avoiding data loss.
[0197] Referring to 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 on a relay site in the cloud system shown in Figure 1 or Figure 2, or on a relay site of the method 300 shown in Figure 3. The device 800 includes:
[0198] The receiving unit 801 is configured to receive first data, where the first data is sent by the primary site when saving the first data to the primary database;
[0199] The processing unit 802 is configured to save the first data into a relay database;
[0200] The processing unit 802 is further configured to store the first data stored in the relay database in the disaster recovery database.
[0201] Optionally, the detailed implementation process of the receiving unit 801 receiving the first data refers to step 302 of the method 300 shown in FIG3 , which is not described in detail here.
[0202] Optionally, the detailed implementation process of the processing unit 802 saving the first data into the relay database refers to step 302 of the method 300 shown in FIG3 , which will not be described in detail here.
[0203] 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 step 303 of the method 300 shown in FIG3 , which will not be described in detail here.
[0204] Optionally, the device 800 is located in the first area.
[0205] Optionally, 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 a failure of the primary site;
[0206] The receiving unit 801 is further configured to receive second data, where the second data is data of the first service obtained when the disaster recovery site runs the first service;
[0207] The processing unit is further configured to store the second data in the relay database.
[0208] Optionally, the detailed implementation process of the receiving unit 801 receiving the second data refers to step 306 of the method 300 shown in FIG3 , which will not be described in detail here.
[0209] Optionally, the detailed implementation process of the processing unit 802 storing the second data in the relay database refers to step 306 of the method 300 shown in FIG3 , which will not be described in detail here.
[0210] Optionally, the apparatus 800 further includes a sending unit 803;
[0211] The sending unit 803 is configured to send the second data stored in the relay database to the primary site when the primary site recovers to normal, so that the primary site stores the second data in the primary database.
[0212] Optionally, the detailed implementation process of the sending unit 803 sending the second data stored in the relay database refers to step 307 of the method 300 shown in FIG3 , which will not be described in detail here.
[0213] 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;
[0214] 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.
[0215] Optionally, the detailed implementation process of the receiving unit 801 receiving the GTID of each data in the master database can be found in step 307 of the method 300 shown in FIG3 , which will not be described in detail here.
[0216] Optionally, the detailed implementation process of the processing unit 802 acquiring the second data stored in the relay database refers to step 307 of the method 300 shown in FIG3 , which will not be described in detail here.
[0217] Optionally, the processing unit 802 is 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.
[0218] Optionally, the detailed implementation process of the processing unit 802 determining that the relay database stores each data in the main database based on the GTID of each data in the main database is shown in step 307 of the method 300 shown in Figure 3, which is not described in detail here.
[0219] In the embodiment of the present application, because the transmission delay between the primary site and the device is less than the delay threshold, the receiving unit receives the first data sent by the primary site at the same time as the first data is saved in the primary 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 primary database and the data saved in the relay database are consistent. When the primary site fails, because the data saved in the primary database and the data saved in the relay database are consistent, the processing unit can store all the data in the relay database in the disaster recovery database, thereby avoiding data loss.
[0220] Referring to Figure 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 main site, a relay site, and the device 900, and the transmission delay between the main site and the relay site is less than the delay threshold. The main 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 main site includes a main database, the relay site includes a relay database, and the device 900 includes a disaster recovery database. The device 900 is deployed on the disaster recovery site in the cloud system shown in Figure 1 or Figure 2, or on the disaster recovery site of the method 300 shown in Figure 3. The device 900 includes:
[0221] The receiving unit 901 is configured 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 by the primary site to the relay site when the primary site saves the first data to the primary database through a write operation;
[0222] The processing unit 902 is configured to store the first data in a disaster recovery database.
[0223] Optionally, the detailed implementation process of the receiving unit 901 receiving the first data stored in the relay database sent by the relay station refers to step 303 of the method 300 shown in FIG3 , which will not be described in detail here.
[0224] Optionally, the detailed implementation process of the processing unit 902 storing the first data in the disaster recovery database refers to step 303 of the method 300 shown in FIG3 , which will not be described in detail here.
[0225] Optionally, the relay site is located in the first area.
[0226] Optionally, the first data is data of a first service running at the primary site. The apparatus 900 is configured to run the first service after a failure of the primary site. The processing unit 902 is further configured to:
[0227] Acquiring second data of the first business while running the first business;
[0228] Saving the second data in a disaster recovery database;
[0229] The second data stored in the disaster recovery database is stored in the relay database.
[0230] Optionally, the detailed implementation process of the processing unit 902 acquiring the second data refers to step 305 of the method 300 shown in FIG3 , which will not be described in detail here.
[0231] Optionally, the detailed implementation process of the processing unit 902 storing the second data in the disaster recovery database is shown in step 305 of the method 300 shown in FIG3 , which will not be described in detail here.
[0232] Optionally, the detailed implementation process of the processing unit 902 storing the second data stored in the disaster recovery database into the relay database is shown in step 306 of the method 300 shown in FIG3 , which will not be described in detail here.
[0233] Optionally, the processing unit 902 is further configured to:
[0234] Obtaining the third data. The relay database stores the third data, but the disaster recovery database does not store the third data.
[0235] The third data is stored in the disaster recovery database.
[0236] Optionally, the detailed implementation process of the processing unit 902 acquiring the third data refers to step 304 of the method 300 shown in FIG3 , which will not be described in detail here.
[0237] Optionally, the detailed implementation process of the processing unit 902 storing the third data in the disaster recovery database refers to step 304 of the method 300 shown in FIG3 , which will not be described in detail here.
[0238] Optionally, the primary site is further configured to run a second service corresponding to the first service. The apparatus 900 is further configured to run the second service after a failure of the primary site. The disaster recovery database includes a first database for the first service and a second database for the second service. The processing unit 902 is further configured to:
[0239] Acquire fourth data, where the first database stores the fourth data but the second database does not store the fourth data;
[0240] The fourth data is stored in the second database.
[0241] Optionally, the detailed implementation process of the processing unit 902 acquiring the fourth data refers to step 304 of the method 300 shown in FIG3 , which is not described in detail here.
[0242] Optionally, the detailed implementation process of the processing unit 902 storing the fourth data in the second database refers to step 304 of the method 300 shown in FIG3 , which will not be described in detail here.
[0243] In this embodiment of the present application, because the transmission delay between the primary site and the device is less than the delay threshold, the primary site sends the first data to the relay site when saving the first data to the primary database. This ensures that the data stored in the primary database and the data stored in the relay database are consistent. In the event of a primary site failure, because the data stored in the primary database and the data stored 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.
[0244] 10 , an embodiment of the present application provides a computing device 1000. For example, the computing device 1000 may be a device included in the primary site of the cloud system shown in FIG1 or FIG2 , or a device in the primary site of the method 300 shown in FIG3 .
[0245] As shown in Figure 10, computing device 1000 includes a bus 1002, a processor 1004, a memory 1006, and a communication interface 1008. Processor 1004, memory 1006, and communication interface 1008 communicate with each other via bus 1002. Computing device 1000 may be a server or a terminal device. It should be understood that this application does not limit the number of processors and memories in computing device 1000.
[0246] Bus 1002 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, among others. Buses may be classified as address buses, data buses, control buses, and the like. For ease of illustration, FIG10 illustrates a single bus line, but this does not imply a single bus or type of bus. Bus 1002 may include a path for transmitting information between various components of computing device 1000 (e.g., memory 1006, processor 1004, and communication interface 1008).
[0247] The processor 1004 may include any one or more processors such as a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0248] The memory 1006 may include volatile memory, such as random access memory (RAM). The processor 1004 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state drive (SSD).
[0249] Referring to FIG10 , the memory 1006 stores executable program code, and the processor 1004 executes the executable program code to respectively implement the functions of the processing unit 701, the sending unit 702, and the receiving unit 703 in the apparatus 700 shown in FIG7 , thereby implementing the method provided by any of the above embodiments. In other words, the memory 1006 stores instructions for executing the method provided by any of the above embodiments. Alternatively,
[0250] 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.
[0251] Embodiments of the present application also provide 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 smartphone.
[0252] As shown in Figure 11, the cluster includes at least one computing device 1000. The memory 1006 of 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.
[0253] 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 can jointly execute instructions for executing the method provided in any of the above-mentioned embodiments.
[0254] In some possible implementations, one or more computing devices in the cluster can be connected via a network. The network can be a wide area network (WAN), a local area network (LAN), or the like. FIG12 illustrates one possible implementation. As shown in FIG12 , two computing devices 1000A and 1000B are connected via a network. Specifically, each computing device is connected to the network via a communication interface within the computing device.
[0255] In this type of possible implementation, the memory 1006 in the computing device 1000A stores instructions for executing the functions of the processing unit 701 in the embodiment shown in FIG7 . Simultaneously, the memory 1006 in the computing device 1000B stores instructions for executing the functions of the sending unit 702 and the receiving unit 703 in the embodiment shown in FIG7 .
[0256] It should be understood that the functionality of the computing device 1000A shown in FIG12 may also be accomplished by multiple computing devices 1000. Similarly, the functionality of the computing device 1000B may also be accomplished by multiple computing devices 1000.
[0257] The present application also provides another cluster. The connection relationship between the computing devices in the cluster can be similar to the connection method of the cluster for obtaining the function described in Figure 12. The difference is that the memory 1006 in one or more computing devices 1000 in the cluster can store the same instructions for executing the method provided in any of the above embodiments.
[0258] 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 can jointly execute instructions for executing the method provided in any of the above embodiments.
[0259] 13 , an embodiment of the present application provides a computing device 1300. For example, the computing device 1300 may be a device included in a relay station in the cloud system shown in FIG1 or FIG2 , or a device in a relay station in the method 300 shown in FIG3 .
[0260] As shown in Figure 13 , computing device 1300 includes a bus 1302, a processor 1304, a memory 1306, and a communication interface 1308. Processor 1304, memory 1306, and communication interface 1308 communicate with each other via bus 1302. Computing device 1300 may be a server or a terminal device. It should be understood that this application does not limit the number of processors and memories in computing device 1300.
[0261] Bus 1302 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, among others. Buses may be classified as address buses, data buses, control buses, and the like. For ease of illustration, FIG13 shows a single line, but this does not imply a single bus or type of bus. Bus 1302 may include a path for transmitting information between various components of computing device 1300 (e.g., memory 1306, processor 1304, and communication interface 1308).
[0262] The processor 1304 may include any one or more processors such as a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0263] The memory 1306 may include volatile memory, such as random access memory (RAM). The processor 1304 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state drive (SSD).
[0264] Referring to FIG13 , the memory 1306 stores executable program code, and the processor 1304 executes the executable program code to respectively implement the functions of the processing unit 802, the receiving unit 801, and the sending unit 703 in the apparatus 800 shown in FIG8 , thereby implementing the method provided by any of the above embodiments. In other words, the memory 1306 stores instructions for executing the method provided by any of the above embodiments. Alternatively,
[0265] 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 a communication network.
[0266] Embodiments of the present application also provide 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 smartphone.
[0267] As shown in Figure 14, the cluster includes at least one computing device 1300. The memory 1306 of 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.
[0268] 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-described 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-described embodiments.
[0269] In some possible implementations, one or more computing devices in the cluster can be connected via a network. The network can be a wide area network (WAN) or a local area network (LAN), among others. FIG. 15 illustrates one possible implementation. As shown in FIG. 15 , two computing devices 1300A and 1300B are connected via a network. Specifically, each computing device is connected to the network via a communication interface within the computing device.
[0270] In this type of possible implementation, the memory 1306 in the computing device 1300A stores instructions for executing the functions of the processing unit 802 in the embodiment shown in FIG8 . Simultaneously, the memory 1306 in the computing device 1300B stores instructions for executing the functions of the receiving unit 801 and the sending unit 803 in the embodiment shown in FIG8 .
[0271] It should be understood that the functionality of the computing device 1300A shown in FIG15 may also be implemented by multiple computing devices 1300. Similarly, the functionality of the computing device 1300B may also be implemented by multiple computing devices 1300.
[0272] The present application also provides another cluster. The connection relationship between the computing devices in the cluster can be similar to the connection method of the cluster for obtaining the function described in Figure 15. The difference is that the memory 1306 in one or more computing devices 1300 in the cluster can store the same instructions for executing the method provided in any of the above embodiments.
[0273] 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 can jointly execute instructions for executing the method provided in any of the above embodiments.
[0274] 16 , an embodiment of the present application provides a computing device 1600. For example, the computing device 1600 may be a device included in a disaster recovery site in the cloud system shown in FIG1 or FIG2 , or a device in a disaster recovery site in the method 300 shown in FIG3 .
[0275] As shown in Figure 16 , computing device 1600 includes a bus 1602, a processor 1604, a memory 1606, and a communication interface 1608. Processor 1604, memory 1606, and communication interface 1608 communicate with each other via bus 1602. Computing device 1600 may be a server or a terminal device. It should be understood that this application does not limit the number of processors and memories in computing device 1600.
[0276] Bus 1602 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, among others. Buses may be classified as address buses, data buses, control buses, and the like. For ease of illustration, FIG16 shows only one line, but this does not imply a single bus or type of bus. Bus 1602 may include a path for transmitting information between various components of computing device 1600 (e.g., memory 1606, processor 1604, and communication interface 1608).
[0277] The processor 1604 may include any one or more processors such as a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0278] The memory 1606 may include volatile memory, such as random access memory (RAM). The processor 1604 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state drive (SSD).
[0279] Referring to FIG16 , the memory 1606 stores executable program code, and the processor 1604 executes the executable program code to respectively implement the functions of the processing unit 902 and the receiving unit 901 in the apparatus 900 shown in FIG9 , thereby implementing the method provided by any of the above embodiments. In other words, the memory 1606 stores instructions for executing the method provided by any of the above embodiments. Alternatively,
[0280] 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 a communication network.
[0281] Embodiments of the present application also provide 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 smartphone.
[0282] As shown in Figure 17, the cluster includes at least one computing device 1600. The memory 1606 of 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.
[0283] 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-described method for backing up data. In other words, a combination of one or more computing devices 1600 may jointly execute instructions for executing the method provided in any of the above-described embodiments.
[0284] In some possible implementations, one or more computing devices in the cluster can be connected via a network. The network can be a wide area network (WAN) or a local area network (LAN), among others. FIG. 18 illustrates one possible implementation. As shown in FIG. 18 , two computing devices 1600A and 1600B are connected via a network. Specifically, each computing device is connected to the network via a communication interface within the computing device.
[0285] In this type of possible implementation, the memory 1606 in the computing device 1600A stores instructions for executing the functions of the processing unit 902 in the embodiment shown in Figure 9. Simultaneously, the memory 1606 in the computing device 1600B stores instructions for executing the functions of the receiving unit 901 in the embodiment shown in Figure 9.
[0286] It should be understood that the functionality of the computing device 1600A shown in FIG18 may also be implemented by multiple computing devices 1600. Similarly, the functionality of the computing device 1600B may also be implemented by multiple computing devices 1600.
[0287] The present application also provides another embodiment of a cluster. The connection relationship between the computing devices in the cluster can be similar to the connection method of the cluster for obtaining the function described in Figure 18. The difference is that the memory 1606 of one or more computing devices 1600 in the cluster can store the same instructions for executing the method provided in any of the above embodiments.
[0288] 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 can jointly execute instructions for executing the method provided in any of the above embodiments.
[0289] The present application also provides a computer program product comprising instructions. The computer program product may be software or a program product comprising instructions that can be run on a computing device or stored on 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.
[0290] The present application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that can be stored by a computing device or a data storage device such as a data center that contains one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive). The computer-readable storage medium includes instructions that instruct the computing device to execute the method provided in any of the above embodiments.
[0291] Those 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 a program to instruct the relevant hardware, and the program may be stored in a computer-readable storage medium, which may be a read-only memory, a disk, or an optical disk, etc.
[0292] The above description is merely an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the principles of the present application shall be included in the scope of protection 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.
Citation Information
Patent Citations
Disaster-tolerant method of storage system, storage system and related device
CN109062735A
Disaster recovery system and disaster recovery methods
CN109361769A
A disaster recovery platform and a disaster recovery method
CN109597718A
Trusted disaster recovery backup system based on SAN and data processing method thereof
CN109634783A
Data disaster recovery method, system, device and equipment
CN114610526A
Cited By
Data reading method and device, equipment, storage medium and product
CN119668862A
