Business data synchronization method and device, equipment and storage medium
By determining and separating the overlapping areas between the target host's operating system startup data and the newly added business synchronization data during the data synchronization process, the problem of the target host failing to start after restart is solved, and efficient data synchronization and system recovery are achieved.
Patent Information
- Application Number
- CN202511187820.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-25
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2045-08-25
AI Technical Summary
During the disaster recovery primary and backup data synchronization process, after the target host restarts, the disk data of the target host is incomplete and cannot be started normally, resulting in a restart failure.
When receiving the new business synchronization data from the source host, determine whether there is an overlapping area between the first disk area corresponding to the operating system startup data of the target host and the second disk area corresponding to the new business synchronization data. If there is an overlapping area, synchronize the new business synchronization data outside the overlapping area to the target host to avoid data overwriting in the overlapping area.
By identifying and separating data synchronization in overlapping areas, the operating system startup data is prevented from being overwritten after the target host is restarted, ensuring that the system can start normally and improving the reliability and efficiency of data synchronization.
Smart Images

Figure CN120687527A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data disaster recovery technology, and in particular to a business data synchronization method, apparatus, device, and storage medium. Background Art
[0002] To ensure the continuity of computer business systems, many critical business systems require active-standby disaster recovery. Existing active-standby disaster recovery technology typically first transfers the first-level hot data to the target host. This hot data allows the target host system to boot normally. At a certain stage (after kernel network initialization is complete and before all system volumes are mounted), the active-standby disaster recovery kernel driver pauses the system boot, connects to the backup server, and continuously obtains synchronization data from the source server from the backup server, writing it to the target host's disk. Upon receiving a service switch command, the operating system boot is resumed, completing system and business startup. However, if the target host reboots during data synchronization, it will be unable to boot after the reboot. This is because the first-level hot data on the target host is overwritten by subsequent synchronization data, leaving the target host's disk data in an incomplete state, making it impossible for the operating system to boot and perform subsequent data synchronization. Summary of the Invention
[0003] The main purpose of this application is to provide a business data synchronization method, device, equipment and storage medium, aiming to solve the technical problem of restart failure when the target host is restarted during the disaster recovery primary and backup data synchronization process.
[0004] To achieve the above objectives, the present application proposes a service data synchronization method, which includes: Upon receiving the newly added service synchronization data from the source host, determining whether there is an overlapping area, where the overlapping area represents an overlapping area between a first disk area and a second disk area, where the first disk area is a disk area corresponding to the operating system startup data of the target host, and the second disk area is a disk area corresponding to the newly added service synchronization data; If the overlapping area exists, the newly added business synchronization data outside the overlapping area in the second disk area is synchronized to the target host.
[0005] In one embodiment, before the step of determining whether there is an overlapping area when receiving the newly added service synchronization data from the source host, the method further includes: Receiving whole-machine backup data sent by a source host, and generating a whole-machine backup point based on the whole-machine backup data, wherein the whole-machine backup data includes at least one of an operating system, an application, business data, and disk metadata; Obtaining hardware configuration information of the target host, and generating operating system startup data of the target host based on the whole-machine backup point and the hardware configuration information; The first disk area is determined as the disk area corresponding to the operating system startup data, and the operating system startup data is pushed to the target host.
[0006] In one embodiment, the step of obtaining hardware configuration information of the target host and generating operating system startup data of the target host based on the entire host backup point and the hardware configuration information includes: Creating a virtual machine according to the hardware configuration information, and starting the operating system of the virtual machine based on the whole machine backup point, wherein the hardware configuration of the virtual machine is consistent with the hardware configuration of the target host; Monitor the disk read and write behavior occurring in the virtual machine, obtain the virtual disk area and virtual read and write data corresponding to the disk read and write behavior, and determine the operating system startup data of the target host as the virtual disk area and the virtual read and write data.
[0007] In one embodiment, the step of monitoring the disk read and write behavior occurring in the virtual machine and obtaining the virtual disk area and virtual read and write data corresponding to the disk read and write behavior includes: Dividing the disk area of the virtual machine into a plurality of virtual data blocks of equal size according to the disk offset; Monitoring whether disk read and write behavior occurs in each virtual data block in the virtual machine, and marking the virtual data block for reading and writing when disk read and write behavior occurs in the monitoring virtual data block; A virtual disk area and virtual read-write data are determined in the disk of the virtual machine according to the read-write tag.
[0008] In one embodiment, the step of determining whether there is an overlapping area when receiving the newly added service synchronization data from the source host includes: Upon receiving the newly added service synchronization data from the source host, the newly added service synchronization data is divided into a plurality of newly added data blocks according to the disk offset of the newly added service synchronization data, wherein the size of the newly added data block is not greater than the size of the virtual data block; Determining whether the disk area of each newly added data block overlaps with the first disk area; If there is overlap, the overlap area is determined according to the disk area of the newly added data block.
[0009] In one embodiment, after the step of determining the overlapping area according to the disk area of the newly added data block if there is overlap, the method further includes: Determining whether the size of the newly added data block is equal to the size of the virtual data block; If it is equal to the size of the virtual data block, the newly added data block is cached in a sparse file, and a write mark is added to the cache area corresponding to the newly added data block in the sparse file. The size of the sparse file is consistent with the disk size of the virtual machine. The sparse file is used to record the data synchronized to the target host when a disaster recovery service switching instruction is received; If it is smaller than the size of the virtual data block, determining whether a write mark exists in the cache area corresponding to the newly added data block in the sparse file; If there is a write mark, the newly added data block is cached in the sparse file; If it is smaller than the size of the virtual data block and there is no write mark in the cache area corresponding to the newly added data block in the sparse file, the operating system startup data corresponding to the disk area of the virtual data block in the first disk area is cached in the sparse file, and a write mark is added to the cache area corresponding to the startup data in the sparse file, and the newly added data block is cached in the sparse file.
[0010] In one embodiment, if the overlapping area exists, the step of synchronizing the newly added service synchronization data outside the overlapping area in the second disk area to the target host includes: If the overlapping area exists, dividing the newly added service synchronization data outside the overlapping area in the second disk area into a plurality of continuous synchronization data blocks, wherein the data volume of the synchronization data blocks does not exceed a preset data volume threshold; Taking the first synchronized data block as the current data block in a preset order, synchronizing the current data block to the target host, and sending a disk write confirmation message to the target host; Upon receiving the feedback information sent by the target host after writing the current data block to the disk, continue to use the next synchronization data block as the current data block, and execute the steps of synchronizing the current data block to the target host and sending disk write confirmation information to the target host until all the new business synchronization data are synchronized to the target host.
[0011] In addition, to achieve the above-mentioned purpose, the present application also proposes a service data synchronization device, which includes: an overlapping area determination module, configured to determine whether an overlapping area exists upon receiving newly added service synchronization data from a source host, wherein the overlapping area represents an overlapping area between a first disk area and a second disk area, where the first disk area is a disk area corresponding to the operating system startup data of the target host, and the second disk area is a disk area corresponding to the newly added service synchronization data; The non-overlapping data synchronization module is used to synchronize the newly added business synchronization data outside the overlapping area in the second disk area to the target host if the overlapping area exists.
[0012] In addition, to achieve the above-mentioned purpose, the present application also proposes a business data synchronization device, which includes: a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the computer program is configured to implement the steps of the business data synchronization method described above.
[0013] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium. A computer program is stored on the storage medium, and when the computer program is executed by the processor, the steps of the business data synchronization method described above are implemented.
[0014] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program. When the computer program is executed by a processor, it implements the steps of the business data synchronization method described above.
[0015] The present application provides a business data synchronization method, which determines whether there is an overlap between the first disk area corresponding to the operating system startup data of the target host and the second disk area corresponding to the new business synchronization data when receiving the new business synchronization data from the source host; if there is a business data synchronization overlap area, the business data outside the business data synchronization overlap area in the second disk area is synchronized to the target host. The present application determines whether there is an overlap between the operating system startup data of the target host and the disk area corresponding to the new business synchronization data when receiving the new business synchronization data from the source host. If there is an overlap, the synchronization data in the overlapping area is not synchronized first, and only the new business synchronization data outside the overlapping area is synchronized to the target host. If the target host restarts during the synchronization process, the operating system startup data in the target host will not be overwritten by the synchronization data, thereby avoiding the problem of restart failure. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0017] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0018] Figure 1 A flowchart of the first embodiment of the method for synchronizing business data in this application is provided; Figure 2 A flowchart of the second embodiment of the business data synchronization method of this application is provided; Figure 3 A flowchart of the third embodiment of the business data synchronization method of this application is provided; Figure 4 This is a schematic diagram of the module structure of the service data synchronization device according to an embodiment of the present application; Figure 5 This is a schematic diagram of the device structure of the hardware operating environment involved in the business data synchronization method in the embodiment of the present application.
[0019] The purpose, features and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0020] It should be understood that the specific embodiments described herein are merely used to explain the technical solutions of the present application and are not intended to limit the present application.
[0021] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0022] The main solution of the embodiment of the present application is: when receiving the new business synchronization data from the source host, determine whether there is an overlapping area, the overlapping area represents the overlapping area between the first disk area and the second disk area, the first disk area is the disk area corresponding to the operating system startup data of the target host, and the second disk area is the disk area corresponding to the new business synchronization data; if the overlapping area exists, the new business synchronization data outside the overlapping area in the second disk area is synchronized to the target host.
[0023] To ensure the continuity of computer business systems, existing technologies require active-standby disaster recovery for many important business systems. Existing active-standby disaster recovery technology typically first transfers the first-level hot data to the target host. This hot data allows the target host system to boot normally. At a certain stage (after kernel network initialization is complete and before all system volume devices are mounted), the active-standby disaster recovery kernel driver pauses the system boot, connects to the backup server, and continuously obtains synchronization data from the source host from the backup server, writing it to the target host's disk. Upon receiving a service switch command, the operating system boot is resumed, completing system and business startup. However, if the target host reboots during data synchronization, it will be unable to boot after the reboot because the first-level hot data on the target host will be overwritten by subsequent synchronization data, leaving the target host's disk data in an intermediate state—incomplete data—and unable to boot the operating system or perform subsequent data synchronization.
[0024] The present application provides a solution, which determines whether there is an overlap between the first disk area corresponding to the operating system startup data of the target host and the second disk area corresponding to the new business synchronization data when receiving the new business synchronization data of the source host; if there is a business data synchronization overlap area, the business data outside the business data synchronization overlap area in the second disk area will be synchronized to the target host. The present application determines whether there is an overlap between the operating system startup data of the target host and the disk area corresponding to the new business synchronization data when receiving the new business synchronization data of the source host. If there is an overlap, the synchronization data in the overlapping area will not be synchronized first, and only the new business synchronization data outside the overlapping area will be synchronized to the target host. If the target host restarts during the synchronization process, the operating system startup data in the target host will not be overwritten by the synchronization data, thereby avoiding the problem of restart failure.
[0025] It should be noted that in the active-standby disaster recovery, it is generally composed of three parts: a backup server, a source host, and a target host. The source host has a main business system that carries the customer's specific business. The source host is the host that performs data backup and data synchronization operations, and sends the basic data and incremental data on the disk to the backup server on a regular or real-time basis. The backup server is used to receive and save the backup data and synchronization data sent by the source host. When performing recovery and synchronization operations, it provides the target host with the data to be restored; when performing synchronization operations, it pushes the incremental data of the source host to the target host on a regular or real-time basis. The target host is the backup system for business disaster recovery. When the main business system of the source host fails, the customer's business will be switched to the backup business system of the target host to ensure business continuity. The executor of the method of this embodiment can be a backup server.
[0026] Based on this, the embodiment of the present application provides a business data synchronization method, referring to Figure 1 , Figure 1 This is a flowchart of the first embodiment of the business data synchronization method of this application.
[0027] In this embodiment, the service data synchronization method includes steps S10 to S20: Step S10, when receiving the new business synchronization data from the source host, determine whether there is an overlapping area, the overlapping area represents the overlapping area between the first disk area and the second disk area, the first disk area is the disk area corresponding to the operating system startup data of the target host, and the second disk area is the disk area corresponding to the new business synchronization data.
[0028] It should be noted that active-standby disaster recovery data synchronization is a data synchronization technology that first pushes the data required for system startup (primary hot data) to the target host. When the system boots up to a certain stage (after kernel network initialization is complete and before all system volumes and devices are mounted), the active-standby disaster recovery kernel driver pauses the system boot and connects to the backup server. It then continuously retrieves data from the backup server to synchronize business data. Upon receiving the service switchover command, the system boot and startup are resumed. Once the operating system boots up, the services on the system are subsequently started and provided externally, completing the takeover of the source host's services and completing the service switchover.
[0029] It's understandable that during primary-backup disaster recovery data synchronization, the operating system boot data (i.e., first-level hot data) is generated based on the source host's full-machine backup point. The disk area corresponding to this first-level hot data is recorded as the first disk area. This first-level hot data is then pushed to the target host, and the target host waits for a connection to receive the synchronized data. Upon receiving the newly synchronized service data from the source host, the backup server determines whether the second disk area corresponding to this newly synchronized service overlaps with the first disk area.
[0030] Step S20: If the overlapping area exists, the newly added service synchronization data outside the overlapping area in the second disk area is synchronized to the target host.
[0031] It is understood that if there is an overlapping area, the data in the overlapping area is first cached on the backup server and not pushed. The newly added service synchronization data outside the overlapping area in the second disk area is synchronized to the target host. Later, when the user's service switch command is received, the cached newly added service synchronization data in the overlapping area is synchronized to the target host. After the synchronization is complete, the target host is notified to resume booting, completing the system and service startup.
[0032] In a feasible implementation, step S20 may include steps S201 to S203: Step S201: if the overlapping area exists, dividing the newly added business synchronization data outside the overlapping area in the second disk area into multiple continuous synchronization data blocks, and the data size of the synchronization data blocks does not exceed a preset data volume threshold.
[0033] It should be noted that with the above process, if the target host reboots during data synchronization, there will be no system startup failure and data synchronization failure. However, if the target host reboots, the time at which incremental data should be resynchronized after the reboot is uncertain. This is because the target host has a cache (without cache, synchronization efficiency will be very low), and data successfully sent by the backup server to the target host may not be successfully written to the target host disk.
[0034] It can be understood that in order to confirm the time from which to start synchronizing incremental data after the target host is restarted, if there is an overlapping area, the new business synchronization data outside the overlapping area in the second disk area will be divided into multiple continuous synchronization data blocks, and the data size of the synchronization data block shall not exceed the preset data volume threshold (for example, 100~150MB).
[0035] Step S202: taking the first synchronized data block as the current data block in a preset order, synchronizing the current data block to the target host, and sending disk write confirmation information to the target host.
[0036] Step S203, when receiving the feedback information sent by the target host after writing the current data block to the disk, continue to use the next synchronization data block as the current data block, and execute the steps of synchronizing the current data block to the target host and sending disk write confirmation information to the target host until all the new business synchronization data are synchronized to the target host.
[0037] It should be understood that the synchronization data blocks can be sent one by one in the chronological order of the newly added business synchronization data. Every time the backup server sends a certain amount of incremental synchronization data to the target host, it sends a disk write confirmation message to the target host to refresh the disk cache, confirming that the target host has written the data to the disk. After receiving the feedback message sent by the target host after writing the current data block to the disk, the synchronization of subsequent data will continue until all the newly added business synchronization data is synchronized to the target host. With this method, if the target host is restarted during the period, the backup server does not need to re-synchronize the data that has been synchronized before the confirmation command, but only needs to re-synchronize the data after the confirmation command. In this way, the amount of retransmitted data will not exceed 100MB, which saves time and improves efficiency.
[0038] This embodiment provides a business data synchronization method, which determines whether there is an overlapping area between the first disk area corresponding to the operating system startup data of the target host and the second disk area corresponding to the new business synchronization data when receiving the new business synchronization data from the source host; if there is an overlapping area for business data synchronization, the business data outside the overlapping area in the second disk area will be synchronized to the target host. This embodiment determines whether there is an overlap between the operating system startup data of the target host and the disk area corresponding to the new business synchronization data when receiving the new business synchronization data from the source host. If there is an overlap, the synchronization data in the overlapping area will not be synchronized first, and only the new business synchronization data outside the overlapping area will be synchronized to the target host. If the target host restarts during the synchronization process, the operating system startup data in the target host will not be overwritten by the synchronization data, thereby avoiding the problem of restart failure.
[0039] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above embodiment 1 can be referred to the above introduction and will not be described in detail later. Figure 2 Before step S10, the business data synchronization method further includes steps S01 to S03: Step S01: receiving whole-machine backup data sent by a source host, and generating a whole-machine backup point according to the whole-machine backup data, wherein the whole-machine backup data includes at least one of an operating system, an application, business data, and disk metadata.
[0040] It is understandable that a full backup of the source server can be performed. The server receives full backup data from the source server, such as the source server's operating system, applications, business data, and metadata such as disk partitions, volumes, and file systems. This data is then backed up to a backup server for storage, forming a full backup point.
[0041] Step S02: Acquire the hardware configuration information of the target host, and generate the operating system startup data of the target host according to the whole-machine backup point and the hardware configuration information.
[0042] It should be understood that the hardware configuration information of the target host can be obtained, including hardware information such as the network card controller and disk controller, and the first-level hot data of the target host can be generated based on the whole-machine backup point of the source host and the hardware configuration information of the target host. The first-level hot data represents the programs, configurations, and data required to start the operating system of the target host. Here, the first-level hot data is the operating system startup data of the target host.
[0043] Step S03: determining the first disk area as the disk area corresponding to the operating system startup data, and pushing the operating system startup data to the target host.
[0044] It can be understood that the disk area corresponding to the operating system startup data is recorded as the first disk area, and the first-level hot data is pushed to the target host.
[0045] In a feasible implementation, step S02 may include steps S021 and S022: Step S021: Create a virtual machine according to the hardware configuration information, and start the operating system of the virtual machine based on the whole machine backup point. The hardware configuration of the virtual machine is consistent with the hardware configuration of the target host.
[0046] It should be noted that since the source server performs a full-machine backup, including the complete operating system and business data, virtualization technology can be used to create a virtual machine and boot the corresponding operating system for the virtual machine. Copy-on-write (COW) technology can be used to create a virtual disk. When the virtual machine modifies a disk data block at a certain offset, the original data block is first copied to the new data block, and then a write operation is performed on the copied data block. Subsequent read and write operations on the disk offset are converted to read and write operations on the new data block. In order to construct a first-level hot data that can be booted on the target host, when creating the virtual machine, it is necessary to simulate the same hardware configuration as the target host on the virtual machine. That is, the virtual machine is created based on the hardware configuration information of the target host, and the virtual machine's operating system is booted based on the full-machine backup point.
[0047] Step S022, monitor the disk read and write behavior occurring in the virtual machine, obtain the virtual disk area and virtual read and write data corresponding to the disk read and write behavior, and determine the operating system startup data of the target host as the virtual disk area and the virtual read and write data.
[0048] It is understandable that after the virtual machine's operating system is started, the system can be configured, such as installing hardware drivers, configuring the network card's IP address, writing the backup server's address, and implanting the active / standby disaster recovery kernel driver. The operating system is then shut down to complete the construction of the first-level hot data.
[0049] It should be understood that during the above process, the virtualization engine can monitor the read and write activity of all disks in the virtual machine, recording the virtual disk areas and virtual read and write data corresponding to these read and write activities. The data of all disk areas read and written by the virtual machine monitored by the virtualization engine is considered the primary hot data. After this primary hot data is pushed to the target host, the target host can boot normally, configure the network, connect to the backup server, block the operating system boot, and receive synchronization data.
[0050] In a feasible implementation, step S022 may include steps S0221 to S0223: Step S0221: Divide the disk area of the virtual machine into multiple virtual data blocks of equal size according to the disk offset.
[0051] It's worth noting that when generating primary hot data, a virtual disk is created based on the backup point data using COW technology, and the virtualization engine monitors all read and write operations on the virtual disk. The data in the backup point is original data and can only be read, not written. All write operations are based on the copied data blocks. Therefore, to facilitate tracking of disk read and write areas, the entire disk area can be divided into a series of equal-sized virtual data blocks (for example, 64KB per block) based on disk offsets.
[0052] Step S0222: monitor whether each virtual data block in the virtual machine has disk read / write behavior, and if it is monitored that the virtual data block has disk read / write behavior, mark the virtual data block as read / write.
[0053] It should be understood that each virtual data block in the virtual machine is monitored for disk read / write activity, and if a disk read / write activity is detected for a virtual data block, the virtual data block is marked as read / write. For example, a bitmap method can be used to identify whether a virtual data block has undergone a read / write operation. If a read or write operation has occurred, the bitmap corresponding to the virtual data block is set to 1. Other marking methods can also be used, for example, adding a "write" or "read" mark to the virtual data block where a read / write operation has occurred.
[0054] Step S0223: determining the virtual disk area and virtual read / write data in the disk of the virtual machine according to the read / write tag.
[0055] As you can understand, after virtual data blocks are marked for read and write operations, when the virtual machine is shut down, a bitmap (let's call this bitmap A) can be used to determine which disk areas have undergone read and write operations, thereby identifying the virtual disk areas and virtual read and write data, which is also known as the first-level hot data. After pushing the first-level hot data to the target host, the operating system can be booted and subsequent synchronization data can be received.
[0056] In this embodiment, whole-machine backup data sent by a source host is received, and a whole-machine backup point is generated based on the whole-machine backup data. The whole-machine backup data includes at least one of an operating system, applications, business data, and disk metadata. Hardware configuration information of a target host is obtained, and operating system startup data for the target host is generated based on the whole-machine backup point and the hardware configuration information. A first disk area is identified as the disk area corresponding to the operating system startup data, and the operating system startup data is pushed to the target host. By creating a virtual machine, operating system startup data can be constructed for startup on the target host.
[0057] Based on the first embodiment of the present application, in the third embodiment of the present application, the same or similar contents as those in the first embodiment can be referred to the above introduction and will not be described in detail later. Figure 3 , step S10, the business data synchronization method further includes steps S101 to S103: Step S101 : upon receiving new service synchronization data from a source host, dividing the new service synchronization data into a plurality of new data blocks according to the disk offset of the new service synchronization data, wherein the size of the new data block is not greater than the size of the virtual data block.
[0058] It's worth noting that upon receiving new service synchronization data from the source server, the backup server first determines the overlapping area. Specifically, it divides the new service synchronization data into multiple new data blocks based on their disk offsets. The size of the new data blocks is no larger than the size of the virtual data blocks, meaning each block is also 64KB in size.
[0059] Step S102 , determining whether the disk area of each newly added data block overlaps with the first disk area.
[0060] Step S103: If there is overlap, the overlap area is determined according to the disk area of the newly added data block.
[0061] It is understood that the disk area of each newly added data block is determined to determine whether it overlaps with the first disk area corresponding to the primary hot data. If not, the newly added data block can be directly sent to the target host. If there is overlap, the newly added data block is not sent and the data in the newly added data block is cached on the backup server first, awaiting subsequent service switch commands.
[0062] In a feasible implementation manner, after step S103, steps S104 to S108 may also be included: Step S104, determining whether the size of the newly added data block is equal to the size of the virtual data block; It's important to note that when the source server writes data to disk, the data block size is not fixed, and the offset written to disk may not align with the data block size boundary. This means that the offset and data size written to disk may not be integer multiples of the virtual data block size of 64KB. This also applies to the disk offset and data size of newly synchronized data. Therefore, first check whether the size of the newly added data block is equal to the virtual data block size of 64KB.
[0063] Step S105: If it is equal to the size of the virtual data block, the newly added data block is cached in a sparse file, and a write mark is added to the cache area corresponding to the newly added data block in the sparse file. The size of the sparse file is consistent with the disk size of the virtual machine. The sparse file is used to record the data synchronized to the target host when a disaster recovery service switching instruction is received.
[0064] As you can understand, a sparse file of equal size can be created based on the size of the virtual disk (created when creating the virtual machine). Unwritten areas of this sparse file will not occupy disk space. The sparse file is used to record data synchronized to the target host when a disaster recovery service switchover command is received. This cache is used to synchronize new services in the overlapping area. A new bitmap (bitmap B) is also constructed to track which areas of the sparse file have been written to. Each bit in the bitmap also has a 64KB data block.
[0065] It should be understood that if the size of the newly added data block is equal to the size of the virtual data block (64K), the newly added data block is directly cached in the sparse file, and a write mark is added to the cache area corresponding to the newly added data block in the sparse file. For example, the bitmap corresponding to the newly added data block in bitmap B can be set to 1.
[0066] Step S106: If the size is smaller than the size of the virtual data block, it is determined whether there is a write mark in the cache area corresponding to the newly added data block in the sparse file.
[0067] Step S107: If there is a write mark, the newly added data block is cached in the sparse file.
[0068] It is understandable that if the size of the newly added data block is less than 64K, it is determined whether there is a write mark in the cache area corresponding to the newly added data block in the sparse file, for example, checking whether the bitmap of the area is set to 1. If there is a write mark, the newly added data block is directly cached in the sparse file.
[0069] Step S108: If the size of the new data block is smaller than the size of the virtual data block and there is no write mark in the cache area corresponding to the newly added data block in the sparse file, the operating system startup data corresponding to the disk area of the virtual data block in the first disk area is cached in the sparse file, and a write mark is added to the cache area corresponding to the startup data in the sparse file, and the newly added data block is cached in the sparse file.
[0070] It is understandable that if the previous conditions are not met, that is, the synchronization data block size is not 64K, and the data in the area has not yet been written to the sparse file (there is no write mark), then it is necessary to first read the first-level hot data corresponding to the disk area of the virtual data block in the first disk area, write it to the sparse file, set the corresponding area bitmap to 1, and then write the newly added data block to the sparse file.
[0071] This example illustrates the process of writing to a sparse file. Assume that the disk offset of the newly synchronized data block is 32K, the data size is 128K, and the corresponding disk area range is [32K, 160K]. First, divide the data block according to the 64K boundary, resulting in three data blocks, with the disk area ranges of [32K, 64K), [64K, 128K), and [128K, 160K]. For the first data block, assuming the corresponding disk area does not overlap with the disk area of the first-level hot data (that is, bit 0 of bitmap A is 0, equivalent to the first data block of the virtual disk having no read or write operations), then the 32K data block is directly synchronized to the target host. For the second data block, assuming its corresponding disk area overlaps with the first-level hot data, since its size is 64K, it is directly written to the sparse file, and bit 1 of bitmap B is set to 1. For the third data block, assuming that the corresponding disk area overlaps with the first-level hot data, since the size is not 64K and the data in the disk area has not been written to the sparse file (that is, the second bit of bitmap B is 0), then it is necessary to first read the data block from the first-level hot data, write it to the sparse file, set the second bit of bitmap B to 1, and then write the 32K data to the sparse file.
[0072] Assume the backup server receives a newly added synchronization data block with a disk offset of 132KB and a data size of 4KB. The corresponding disk region is [132KB, 136KB]. As mentioned earlier, this disk region overlaps with the primary hot data. Since this region has already been written to the sparse file (that is, bit 2 of bitmap B is 1), the synchronization data can be written directly to the sparse file.
[0073] It should be noted that after synchronizing the newly added service data in the cache overlap area, the server awaits the user's disaster recovery switch command. Upon receiving the switch command, the backup server sends the newly synchronized data (i.e., the data stored in the sparse file) from the primary hot data disk area to the target host, notifying the target host to resume system boot and service startup, completing the service switch. Because bitmap B stores which areas of the sparse file contain synchronized data, the remaining data can be synchronized by scanning bitmap B, reading the corresponding data from the sparse file, and sending it to the target host.
[0074] This method ensures that if an abnormal restart occurs during data synchronization on the target host, data synchronization can be quickly restored. This is simple and efficient. It avoids the existing solution of rebuilding the first-level hot data, pushing it to the target host, and synchronizing all incremental synchronization data, thus avoiding the existing costly problem.
[0075] In this embodiment, when the newly added business synchronization data is received from the source host, the newly added business synchronization data is divided into multiple newly added data blocks according to the disk offset of the newly added business synchronization data, and the size of the newly added data block is not greater than the size of the virtual data block; it is determined whether the disk area of each newly added data block overlaps with the first disk area; if there is an overlap, the overlapping area is determined according to the disk area of the newly added data block. It is determined whether the size of the newly added data block is equal to the size of the virtual data block, and the newly added data block is cached in a sparse file in different ways according to the judgment result. In this way, the newly added data blocks in the overlapping area can be accurately cached, and when a business switching command is subsequently received, the cached data in the overlapping area is synchronized to the target host. After the synchronization is completed, the target host is notified to resume booting, completing the startup of the system and business.
[0076] It should be noted that the above examples are only used to understand this application and do not constitute a limitation on the business data synchronization method of this application. More simple transformations based on this technical concept are all within the scope of protection of this application.
[0077] This application also provides a business data synchronization device, please refer to Figure 4 , the service data synchronization device includes: The overlapping area determination module 10 is configured to determine whether an overlapping area exists upon receiving the newly added service synchronization data from the source host, wherein the overlapping area represents an overlapping area between a first disk area and a second disk area, where the first disk area is a disk area corresponding to the operating system startup data of the target host, and the second disk area is a disk area corresponding to the newly added service synchronization data; The non-overlapping data synchronization module 20 is configured to synchronize the newly added service synchronization data outside the overlapping area in the second disk area to the target host if the overlapping area exists.
[0078] The business data synchronization device provided in this application adopts the business data synchronization method in the above-mentioned embodiment to solve the technical problem. Compared with the existing technology, the beneficial effects of the business data synchronization device provided in this application are the same as the beneficial effects of the business data synchronization method provided in the above-mentioned embodiment. The other technical features of the business data synchronization device are the same as those disclosed in the above-mentioned embodiment method, and are not further described here.
[0079] The present application provides a business data synchronization device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the business data synchronization method in the above-mentioned embodiment one.
[0080] Reference below Figure 5 , which shows a schematic diagram of the structure of a service data synchronization device suitable for implementing embodiments of the present application. The service data synchronization device in the embodiments of the present application may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), in-vehicle terminals (such as in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 5 The business data synchronization device shown is merely an example and should not limit the functions and scope of use of the embodiments of the present application.
[0081] like Figure 5As shown, the business data synchronization device may include a processing device 1001 (e.g., a central processing unit, graphics processing unit, etc.), which can perform various appropriate actions and processes based on programs stored in a read-only memory 1002 or programs loaded from a storage device 1003 into a random access memory 1004. The random access memory 1004 also stores various programs and data required for the operation of the business data synchronization device. The processing device 1001, the read-only memory 1002, and the random access memory 1004 are interconnected via a bus 1005. An input / output interface 1006 is also connected to the bus. Typically, the following systems may be connected to the input / output interface 1006: an input device 1007 including, for example, a touchscreen, touchpad, keyboard, mouse, image sensor, microphone, accelerometer, gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; a storage device 1003 including, for example, a magnetic tape or hard disk; and a communication device 1009. The communication device 1009 can allow the service data synchronization device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows a service data synchronization device with various systems, it should be understood that it is not required to implement or have all of the systems shown. More or fewer systems can be implemented or have alternatively.
[0082] In particular, according to the embodiments disclosed in the present application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, the embodiments disclosed in the present application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program comprising program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via a communication device, or installed from a storage device 1003, or installed from a read-only memory 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are performed.
[0083] The business data synchronization device provided in this application utilizes the business data synchronization method described in the above-mentioned embodiments to resolve the technical issues surrounding business data synchronization. Compared to the prior art, the beneficial effects of the business data synchronization device provided in this application are the same as those of the business data synchronization method described in the above-mentioned embodiments. Other technical features of the business data synchronization device are the same as those disclosed in the above-mentioned embodiments and are not further elaborated upon here.
[0084] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0085] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.
[0086] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, the computer-readable program instructions being used to execute the business data synchronization method in the above-mentioned embodiment.
[0087] The computer-readable storage medium provided herein may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems, or devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to, an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including, but not limited to, wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.
[0088] The computer-readable storage medium may be included in the business data synchronization device; or may exist independently without being assembled into the business data synchronization device.
[0089] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by the business data synchronization device, the business data synchronization device: when receiving the new business synchronization data from the source host, determines whether there is an overlapping area, and the overlapping area represents the overlapping area between the first disk area and the second disk area. The first disk area is the disk area corresponding to the operating system startup data of the target host, and the second disk area is the disk area corresponding to the new business synchronization data; if the overlapping area exists, the new business synchronization data outside the overlapping area in the second disk area is synchronized to the target host.
[0090] Computer program code for performing the operations of the present application may be written in one or more programming languages, or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0091] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, program segment or a part of code, and the module, program segment or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented by a dedicated hardware-based system that performs the specified function or operation, or can be implemented by a combination of dedicated hardware and computer instructions.
[0092] The modules described in the embodiments of the present application may be implemented in software or hardware, wherein the name of a module does not necessarily limit the unit itself.
[0093] The computer-readable storage medium provided in this application stores computer-readable program instructions (i.e., a computer program) for executing the aforementioned business data synchronization method, thereby resolving the technical problem. Compared to the prior art, the beneficial effects of the computer-readable storage medium provided in this application are similar to those of the business data synchronization method provided in the aforementioned embodiments, and are not further elaborated here.
[0094] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned business data synchronization method when executed by a processor.
[0095] The computer program product provided in this application can solve technical problems. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as those of the service data synchronization method provided in the above embodiment, and will not be described in detail here.
[0096] The above description is only part of the embodiments of the present application and does not limit the scope of protection of the present application. All equivalent structural transformations made by using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect application in other related technical fields are included in the scope of protection of the present application.
Claims
1. A business data synchronization method, characterized in that: The method includes: Upon receiving the newly added service synchronization data from the source host, determining whether there is an overlapping area, where the overlapping area represents an overlapping area between a first disk area and a second disk area, where the first disk area is a disk area corresponding to the operating system startup data of the target host, and the second disk area is a disk area corresponding to the newly added service synchronization data; If the overlapping area exists, the newly added business synchronization data outside the overlapping area in the second disk area is synchronized to the target host.
2. The method according to claim 1, wherein Before the step of determining whether there is an overlapping area when receiving the newly added service synchronization data from the source host, the method further includes: Receiving whole-machine backup data sent by a source host, and generating a whole-machine backup point based on the whole-machine backup data, wherein the whole-machine backup data includes at least one of an operating system, an application, business data, and disk metadata; Obtaining hardware configuration information of the target host, and generating operating system startup data of the target host based on the whole-machine backup point and the hardware configuration information; The first disk area is determined as the disk area corresponding to the operating system startup data, and the operating system startup data is pushed to the target host.
3. The method according to claim 2, wherein The step of obtaining the hardware configuration information of the target host and generating the operating system startup data of the target host according to the whole-machine backup point and the hardware configuration information includes: Creating a virtual machine according to the hardware configuration information, and starting the operating system of the virtual machine based on the whole machine backup point, wherein the hardware configuration of the virtual machine is consistent with the hardware configuration of the target host; Monitor the disk read and write behavior occurring in the virtual machine, obtain the virtual disk area and virtual read and write data corresponding to the disk read and write behavior, and determine the operating system startup data of the target host as the virtual disk area and the virtual read and write data.
4. The method according to claim 3, wherein The step of monitoring the disk read and write behavior occurring in the virtual machine and obtaining the virtual disk area and virtual read and write data corresponding to the disk read and write behavior includes: Dividing the disk area of the virtual machine into a plurality of virtual data blocks of equal size according to the disk offset; Monitoring whether disk read and write behavior occurs in each virtual data block in the virtual machine, and marking the virtual data block for reading and writing when disk read and write behavior occurs in the monitoring virtual data block; A virtual disk area and virtual read-write data are determined in the disk of the virtual machine according to the read-write tag.
5. The method according to claim 4, wherein The step of determining whether there is an overlapping area when receiving the newly added service synchronization data from the source host includes: Upon receiving the newly added service synchronization data from the source host, the newly added service synchronization data is divided into a plurality of newly added data blocks according to the disk offset of the newly added service synchronization data, wherein the size of the newly added data block is not greater than the size of the virtual data block; Determining whether the disk area of each newly added data block overlaps with the first disk area; If there is overlap, the overlap area is determined according to the disk area of the newly added data block.
6. The method according to claim 5, wherein After the step of determining the overlapping area according to the disk area of the newly added data block if there is overlap, the method further includes: Determining whether the size of the newly added data block is equal to the size of the virtual data block; If it is equal to the size of the virtual data block, the newly added data block is cached in a sparse file, and a write mark is added to the cache area corresponding to the newly added data block in the sparse file. The size of the sparse file is consistent with the disk size of the virtual machine. The sparse file is used to record the data synchronized to the target host when a disaster recovery service switching instruction is received; If it is smaller than the size of the virtual data block, determining whether a write mark exists in the cache area corresponding to the newly added data block in the sparse file; If there is a write mark, the newly added data block is cached in the sparse file; If it is smaller than the size of the virtual data block and there is no write mark in the cache area corresponding to the newly added data block in the sparse file, the operating system startup data corresponding to the disk area of the virtual data block in the first disk area is cached in the sparse file, and a write mark is added to the cache area corresponding to the startup data in the sparse file, and the newly added data block is cached in the sparse file.
7. The method according to claim 1, wherein If the overlapping area exists, the step of synchronizing the newly added service synchronization data outside the overlapping area in the second disk area to the target host includes: If the overlapping area exists, dividing the newly added service synchronization data outside the overlapping area in the second disk area into a plurality of continuous synchronization data blocks, wherein the data volume of the synchronization data blocks does not exceed a preset data volume threshold; Taking the first synchronized data block as the current data block in a preset order, synchronizing the current data block to the target host, and sending a disk write confirmation message to the target host; Upon receiving the feedback information sent by the target host after writing the current data block to the disk, continue to use the next synchronization data block as the current data block, and execute the steps of synchronizing the current data block to the target host and sending disk write confirmation information to the target host until all the new business synchronization data are synchronized to the target host.
8. A service data synchronization device, characterized in that: The service data synchronization device includes: an overlapping area determination module, configured to determine whether an overlapping area exists upon receiving newly added service synchronization data from a source host, wherein the overlapping area represents an overlapping area between a first disk area and a second disk area, where the first disk area is a disk area corresponding to the operating system startup data of the target host, and the second disk area is a disk area corresponding to the newly added service synchronization data; The non-overlapping data synchronization module is used to synchronize the newly added business synchronization data outside the overlapping area in the second disk area to the target host if the overlapping area exists.
9. A business data synchronization device, characterized in that: The device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the service data synchronization method according to any one of claims 1 to 7.
10. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the business data synchronization method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Host backup reconstruction method and device, server and storage medium
CN110941515A
Cloud hard disk data synchronization method and electronic equipment
CN113726861A
Data synchronization method and device, equipment and storage medium
CN118012677A
Virtual machine image disk usage
GB201304912D0
Method and system for providing instant access of backup data
US10108647B1