A data replication method based on user state
By performing data replication in user mode, using virtual block equipment and bitmap management system, the problems of low data replication efficiency and insufficient reliability in the prior art are solved, and efficient and reliable data replication and rapid recovery are achieved.
Patent Information
- Application Number
- CN202411261117.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-10
- Publication Date
- 2025-04-01
- Estimated Expiration
- 2044-09-10
AI Technical Summary
When the main volume has a large capacity, the initial synchronization time is long, the transmission link failure and the transmission rate are low, resulting in untimely and unreliable data replication, and the efficiency of bitmap management decreases when the capacity increases.
Using a user-based data replication method, by uniformly partitioning the volume address space on the remote device, creating a virtual block device, and creating a snapshot copy on the local device, establishing a bitmap management system to achieve efficient and reliable data replication.
It realizes efficient access to data in user mode, avoids data backup failure caused by kernel crashes, improves replication efficiency and data reliability, and quickly restores the data replication process in abnormal situations.
Smart Images

Figure CN118779157B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of computers, and in particular relates to a user-mode-based data replication method. Background Art
[0002] With the advent of the big data era, the amount of data is increasing. In order to ensure that data is not lost when a disaster occurs, disaster recovery backup of data is a necessary protection measure.
[0003] During the data backup process, in order to ensure the data consistency between the primary volume and the backup volume, all the data of the primary volume needs to be transferred to the backup volume through the IP network.
[0004] In the existing data transmission process, it is usually necessary to go through the system kernel processing. When the system kernel crashes, the data reading and writing of the source volume and the backup volume fail, resulting in the inability to perform data replication. At the same time, the primary volume generally copies data to the backup volume through a replication link. When the primary volume capacity is large, the time for the primary volume to initially synchronize data to the backup volume is long, and during the data transmission process, there are problems such as transmission link failure and low transmission rate. It cannot be guaranteed that the primary volume data is quickly and reliably copied to the backup volume, and the data loss RPO (Recovery Point Objective) that the business system can tolerate becomes larger. In the existing technology, the primary volume is divided into blocks and managed with a bitmap, so that the new and old data can be distinguished during periodic data synchronization. However, when the primary volume capacity increases, the generated bitmap also increases, and the time to distinguish new and old data increases. Summary of the invention
[0005] The purpose of the present invention is to solve the problem raised in the background technology and to propose a data replication method based on user mode.
[0006] To achieve the above object, the technical solution adopted by the present invention is:
[0007] The present invention proposes a user-state-based data replication method, which is applied to data replication from a primary volume of a local device to a backup volume of a remote device. The user-state-based data replication method includes:
[0008] Evenly partitioning the address space of the backup volume of the remote device according to a first preset size, and creating a preset number of virtual block devices on the remote device;
[0009] Create a snapshot copy of the primary volume at the current moment on the local device, and partition the snapshot copy according to the partition method of the backup volume;
[0010] Create a corresponding bitmap for each partition of the snapshot copy and initialize the bits on each bitmap;
[0011] Map the addresses of each virtual block device to different unmapped partitions of the backup volume;
[0012] Mount each virtual block device to the local device, establish a transmission link corresponding to each virtual block device on the local device, and generate an NVMe block device corresponding to each transmission link to achieve the connection between the remote device and the local device;
[0013] According to each backup volume partition after the mapping address, select the data of the corresponding partition in the snapshot copy and copy it to the NVMe block device, and indicate whether the partition data of each snapshot copy has been copied by updating the bit of the corresponding bitmap;
[0014] Each NVMe block device transmits the received data to the partition corresponding to the backup volume in real time according to the corresponding transmission link and the address mapping relationship of the corresponding virtual block device, so as to copy the data in the snapshot copy partition to the partition of the backup volume;
[0015] Finally, the mapping relationship between the address of each virtual block device and the backup volume partition is released, and each transmission link and NVMe block device is deleted.
[0016] Preferably, all snapshot copies have the same capacity as the backup volume, and the partitions of the backup volume and the snapshot copies are numbered in the order of 1 to n;
[0017] The number of virtual block devices created on the remote device is m, and m is less than or equal to n.
[0018] Preferably, after partitioning the snapshot copy, each partition of the snapshot copy is evenly divided into blocks according to a second preset size, each bitmap includes a first bit and remaining bits corresponding to each block one by one, and the first bit is a status bit of the bitmap, wherein the status bit indicates whether the data of the entire partition on the snapshot copy is copied to the NVMe block device, and the remaining bits indicate whether the data of the corresponding blocks on the snapshot copy partition are copied to the NVMe block device.
[0019] Preferably, the step of mounting each virtual block device to the local device and generating an NVMe block device corresponding to each virtual block device on the local device to establish each transmission link between the remote device and the local device includes:
[0020] Create a subsystem on the remote device that corresponds to the virtual block device one by one;
[0021] Add the numbers of each virtual block device and the backup volume partition mapped by each virtual block device to the subsystem one by one;
[0022] The local device establishes a transmission link corresponding to each subsystem one by one, and generates an NVMe block device corresponding to each transmission link on the local device, and the NVMe block device has a number consistent with the number of the backup volume partition added in the corresponding subsystem, completing the connection between the remote device and the local device.
[0023] Preferably, in the process of copying the data in each snapshot copy partition to the partition of the backup volume, according to the number of each backup volume partition added in the subsystem, the data of each partition with the same number on the snapshot copy is copied to each NVMe block device with the corresponding number, and then each NVMe block device finds the address mapping relationship of the virtual block device according to the corresponding transmission link and the virtual block device added in the corresponding subsystem, and then transmits the received data in real time to the partition corresponding to the backup volume, thereby realizing the replication of data from the primary volume to the backup volume.
[0024] Preferably, after the copying is completed, the mapping relationship between the address of each virtual block device and the backup volume partition is released, and each transmission link and NVMe block device is deleted, and the virtual block devices added in the subsystem and the numbers of the backup volume partitions mapped by each virtual block device are deleted.
[0025] Preferably, the user-state-based data replication method further includes, after all data on the snapshot copy are copied to the backup volume, establishing a new replication task according to a preset mode, and the new replication task includes:
[0026] After the data on the first snapshot copy is copied, a new snapshot copy is created if there is a new copy task on the primary volume. For each newly created snapshot copy: the data of the current snapshot copy is compared with the data of the previous snapshot copy, and the bits corresponding to the changed data in the current snapshot copy are updated to the initialization state, and the status bits of the partition of the snapshot copy where the changed data is located are updated to the initialization state;
[0027] According to the partition updated to the initialized state on the snapshot copy, the address of the virtual block device is mapped to the corresponding partition of the backup volume on the remote device;
[0028] Then, the virtual block device with the mapped address is mounted to the local device, and the NVMe block device corresponding to each virtual block device is generated on the local device;
[0029] Then copy the bit data updated to the initialized state on the snapshot copy to the corresponding NVMe block device, and then synchronize it to the corresponding partition of the backup volume.
[0030] Preferably, the preset mode is periodic replication or threshold replication, wherein periodic replication is to establish a new replication task at every preset time interval, and threshold replication is to establish a new replication task when the new data on the primary volume reaches a preset amount.
[0031] Preferably, if one of the transmission links is abnormally disconnected during the replication process, first delete the NVMe block device corresponding to the local device and the abnormally disconnected transmission link, and delete the number of the backup volume partition and the virtual block device in the corresponding subsystem, select another idle transmission link, and add the number of the backup volume partition and the virtual block device in the subsystem of the abnormal transmission link to the subsystem of the selected idle transmission link, and generate a new NVMe block device, and the number of the new NVMe block device is the same as the number of the NVMe block device corresponding to the abnormally disconnected transmission link, and then copy the data of the partition on the snapshot copy corresponding to the abnormal transmission link to the new NVMe block device, and the new NVMe block device then transmits the data to the partition corresponding to the backup volume according to the selected idle transmission link.
[0032] Preferably, the user-state-based data replication method further includes: saving each bitmap according to a preset time period, and when an abnormality occurs during the process of copying data in the snapshot copy partition to the partition of the backup volume, after the abnormality is restored, re-obtaining the saved bitmap so that the data replication process is restored to the state before the abnormality.
[0033] Compared with the prior art, the present invention has the following beneficial effects:
[0034] 1. This user-state data replication method eliminates kernel overhead based on the SPDK architecture. The RDMA replication link bypasses the kernel's data replication and transmission, achieving efficient data access in user state and avoiding the problem of data backup failure caused by kernel crashes.
[0035] 2. This user-mode data replication method partitions the snapshot copy and backup volume address space and establishes multiple replication links to achieve multiple replication tasks between the primary and backup volumes at the same time, thereby improving replication efficiency. When a replication link is abnormally disconnected, replication can continue through the remaining transmission links, thereby improving data reliability;
[0036] 3. Set the corresponding bitmap for the snapshot address segment partition to manage. The bitmap includes status bits and other bits. The status bit is used to distinguish whether the data of the entire partition has been copied. Other bits are used to distinguish whether the data corresponding to each bit in the partition has been copied. In case of abnormal recovery, the data copy process is restored to the state before the abnormality through the bitmap, ensuring rapid recovery of abnormalities during the data copy process. At the same time, in the process of adding a new copy task, the bitmap can be used to identify whether the data has been modified, which also improves the efficiency of identifying new and old data in the new copy task. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1It is a module block diagram of the data replication method based on user state of the present invention;
[0038] Figure 2 The present invention is a flowchart of a method for copying data in user mode. DETAILED DESCRIPTION
[0039] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0040] The present application provides a user-mode data replication method that can be applied in an SPDK application environment; wherein SPDK (Storage Performance Development Kit) is a software library for improving storage performance. In this patent, Figure 1 As shown in the figure, an SPDK application environment is built between the local device and the remote device: for example, four NVMe SSD disks are used to create aio bdev devices on the local and remote devices respectively, and then logical volumes are created on the aio bdev devices. The capacity of the two logical volumes is the same, such as 500G. The upper-layer application selects the logical volume of the local device as the primary volume and the logical volume of the remote device as the backup volume. This method is based on user-state data replication and eliminates kernel overhead based on the SPDK architecture. The RDMA replication link bypasses the kernel's data replication and transmission, realizes efficient data access in the user state, and avoids the problem of data backup failure caused by kernel crash.
[0041] like Figure 2 As shown, a user-state-based data replication method is provided, which is applied to data replication from a primary volume of a local device to a backup volume of a remote device. The user-state-based data replication method includes:
[0042] S1, evenly partitioning the address space of the backup volume of the remote device according to a first preset size, and creating a preset number of virtual block devices on the remote device;
[0043] First of all, it should be noted that when data is written to the primary volume, the upper-layer application transmits the information to the remote device, and evenly partitions the address space of the backup volume of the remote device according to the first preset size, such as dividing a 500G backup volume into 50 partitions with 10G as one partition, and creating virtual block devices on the computing device. The number of virtual block devices is not limited and can be set according to actual conditions, such as creating 10 10G virtual block devices (the capacity of the virtual block device is consistent with the capacity of each partition), such as Figure 1 As shown, the virtual block device is represented as vbdev.
[0044] S2. Create a snapshot copy of the primary volume at the current moment on the local device, and partition the address space of the snapshot copy according to the partitioning method of the backup volume;
[0045] It should be noted that the snapshot copy is a copy of the main volume at the current moment. When data is written to the main volume, the upper-layer application creates a snapshot copy of the main volume at the current moment on the local device (the capacity of the snapshot copy is consistent with the capacity of the main volume, and the capacity of the snapshot copy is also consistent with the capacity of the backup volume. In this embodiment, both are 500G in size), and the address space of the snapshot copy is partitioned according to the partition method of the backup volume. That is, in this embodiment, the snapshot copy is divided into 50 partitions with a size of 10G per partition.
[0046] The partitions of the backup volume and the snapshot copies are numbered in the order of 1 to n (n is 50 in this embodiment); the number of virtual block devices created on the remote device is m (m is 10 in this embodiment), and m is less than or equal to n. When m is less than n, the data on a snapshot copy needs to be copied to the backup volume in batches, and the batches are equal to ,in Indicates the round-up sign; when m is equal to n, the data on a snapshot copy only needs to be copied to the backup volume in one batch.
[0047] S3. Create a corresponding bitmap (i.e., bitmap) for each partition of the snapshot copy and initialize the bits on each bitmap, including:
[0048] After partitioning the snapshot copy, each partition of the snapshot copy is evenly divided into blocks according to the second preset size (such as 1M data size), each bitmap includes a first bit and the remaining bits corresponding to each block one by one, and the first bit is the status bit of the bitmap, where the status bit indicates whether the data of the entire partition on the snapshot copy is copied to the NVMe block device, and the remaining bits indicate whether the data of the corresponding blocks on the snapshot copy partition are copied to the NVMe block device;
[0049] It should be noted that each partition bitmap on the snapshot copy includes a status bit and a bit corresponding to each block. In this embodiment, each bit corresponds to 1M data size. Since the size of a partition is 10G, a bitmap has a total of (10240+1) bits (that is, 10240 remaining bits plus a status bit, a total of 10241 bits); setting the bit position to 0 or 1 indicates whether the corresponding data is copied to the NVMe block device. In this embodiment, the bit position is 1 to indicate that the data is not copied, and setting it to 0 indicates that the data is copied. Therefore, when initializing the bits on each bitmap, each bit position is 1 (including the status bit and the remaining bits).
[0050] S4, mapping the address of each virtual block device to a different unmapped partition of the backup volume;
[0051] It should be noted that the upper layer application sets whether the data on the snapshot copy is copied in batches or only one batch is needed according to the number of m and n. In each batch copying process, a virtual block device with the same number of partitions as the snapshot copy needs to copy in the current batch copying process is selected, and the address of each selected virtual block device is mapped to the partition corresponding to the backup volume (the backup volume partition corresponding to the partition that the snapshot copy needs to copy in the current batch copying process). For example, in this embodiment, the partitions numbered 1 to 10 on the snapshot copy are copied to the partitions 1 to 10 on the backup volume, and the partition numbers on the snapshot copy and the partition numbers on the backup volume are copied one by one, then the addresses of the 10 virtual block devices are mapped one by one to the partitions numbered 1 to 10 on the backup volume;
[0052] At the same time, the capacity of each virtual block device is consistent with that of each partition, and the capacity of each M of the mutually mapped virtual block devices and the partition of the backup volume corresponds one to one.
[0053] S5, mount each virtual block device to the local device, establish a transmission link corresponding to each virtual block device on the local device, and generate an NVMe block device corresponding to each transmission link (such as Figure 1 As shown in the figure, NVMe block device is represented as NVMe bdev), realizing the connection between the remote device and the local device (the transmission link is the RDMA transmission link, RDMA: Remote Direct Memory Access), specifically including:
[0054] Create a subsystem on the remote device that corresponds to the virtual block device one by one (that is, in this batch replication process, create a subsystem that corresponds to the virtual block device after address mapping. In this embodiment, 10 subsystems are created on the remote device);
[0055] Add the numbers of each virtual block device and the backup volume partition mapped by each virtual block device to the subsystem one by one (that is, add the numbers of the corresponding virtual block devices and the backup volume partition mapped by the virtual block device addresses in the current batch replication process to the corresponding subsystem one by one);
[0056] The local device establishes a transmission link corresponding to each subsystem one by one (specifically calling the attach controllerRPC command to establish a network connection with different remote subsystems), and generates an NVMe block device corresponding to each transmission link on the local device, and the NVMe block device has a number consistent with the number of the backup volume partition added in the corresponding subsystem (for example, if the number added in each subsystem is 1~10, the NVMe block device also has the same number in the corresponding subsystem, and the capacity of each NVMe block device is consistent with the capacity of each partition), completing the connection between the remote device and the local device (that is, 10 connections are established, and the corresponding subsystem, NVMe block device and transmission link correspond to one connection).
[0057] S6. According to each backup volume partition after the mapping address, select the data of the corresponding partition in the snapshot copy and copy it to the NVMe block device, and indicate whether the partition data of each snapshot copy has been copied by updating the bit of the corresponding bitmap (for the snapshot copy partition whose data has been copied to the corresponding NVMe block device, the remaining bits of the bitmap corresponding to the snapshot copy partition are set to 0, and when all data on the partition is copied, the status bit of the bitmap corresponding to the partition is set to 0).
[0058] S7. Each NVMe block device transmits the received data to the partition corresponding to the backup volume in real time according to the corresponding transmission link and the address mapping relationship of the corresponding virtual block device, so as to copy the data in the snapshot copy partition to the partition of the backup volume;
[0059] Among them, in the process of copying the data in each snapshot copy partition to the partition of the backup volume, according to the number of each backup volume partition added in the subsystem, the data of each partition with the same number on the snapshot copy is copied to each NVMe block device with the corresponding number, and then each NVMe block device finds the address mapping relationship of the virtual block device according to the corresponding transmission link and the virtual block device added in the corresponding subsystem, and then transmits the received data in real time to the partition corresponding to the backup volume, so as to realize the replication of data from the primary volume to the backup volume.
[0060] S8. Finally, the mapping relationship between the address of each virtual block device and the backup volume partition is released, and each transmission link and NVMe block device is deleted;
[0061] It should be noted that after each batch of replication is completed, the mapping relationship between the address of each virtual block device and the backup volume partition is released, and each transmission link and NVMe block device is deleted, as well as the virtual block devices added in the subsystem and the backup volume partition numbers mapped by each virtual block device are deleted (each NVMe block device is deleted, the local device disconnects the transmission link with each subsystem, and the virtual block devices in the subsystem and the backup volume partition numbers mapped by each virtual block device are deleted). During the next replication process, the virtual block device needs to be re-mapped, the transmission link and NVMe block device need to be re-established, and new virtual block devices and the backup volume partition numbers mapped by each virtual block device need to be added to the subsystem.
[0062] The user-mode-based data replication method further includes, after all data on the snapshot copy are copied to the backup volume, establishing a new replication task according to a preset mode, and the new replication task includes:
[0063] First of all, it should be noted that when data is written to the primary volume for the first time, the upper-layer application creates the first snapshot copy on the local device. When all the data on the first snapshot copy is copied, in order to ensure the data consistency between the primary and backup volumes as much as possible, the upper-layer application copies the newly added data on the primary volume to the backup volume by adding a replication task, which includes:
[0064] After the data on the first snapshot copy is copied, a new snapshot copy is created if there is a new copy task on the primary volume. For each newly created snapshot copy: the data of the current snapshot copy is compared with the data of the previous snapshot copy, and the bit corresponding to the changed data in the current snapshot copy is updated to the initialization state (that is, the bit is set to 1), and the status bit of the partition of the snapshot copy where the changed data is located is updated to the initialization state (that is, the status bit is set to 1);
[0065] According to the partition updated to the initialized state on the snapshot copy, the address of the virtual block device is mapped to the corresponding partition of the backup volume on the remote device (that is, according to the number of the partition updated to the initialized state on the snapshot copy, the number of virtual block devices corresponding to the partition in the updated state is selected on the remote device, and the address of each selected virtual block device is mapped to the partition with the corresponding number of the backup volume);
[0066] Then, the virtual block device with the mapped address is mounted to the local device, and at the same time, an NVMe block device corresponding to each virtual block device is generated on the local device (the specific process is the same as S5 and will not be described again, and the NVMe block device also has a corresponding number);
[0067] Then copy the bit data updated to the initialized state on the snapshot copy to the corresponding NVMe block device (that is, copy the changed data in the current snapshot copy to the NVMe block device with the corresponding number separately), and then synchronize it to the corresponding partition of the backup volume;
[0068] The preset mode is periodic replication or threshold replication, where periodic replication is to create a new replication task at every preset time interval, and threshold replication is to create a new replication task when the new data on the primary volume reaches the preset amount. It should be noted that periodic replication is to create a new replication task at every preset time interval (the preset time is not limited and is set according to actual conditions) by the upper-layer application, and threshold replication is to create a new replication task when the upper-layer application detects that the new data on the primary volume has reached the preset amount (the preset amount is not limited and is set according to actual conditions).
[0069] The user-mode-based data replication method also includes: if one of the transmission links is abnormally disconnected during the replication process, firstly, the NVMe block device corresponding to the local device and the abnormally disconnected transmission link is deleted, and the number of the backup volume partition and the virtual block device in the corresponding subsystem are deleted, and another idle transmission link is selected, and the number of the backup volume partition and the virtual block device in the subsystem of the abnormal transmission link are re-added to the subsystem of the selected idle transmission link, and a new NVMe block device is generated, and the number of the new NVMe block device is the same as the number of the NVMe block device corresponding to the abnormally disconnected transmission link (the NVMe block device corresponding to the original abnormal output link has been deleted, and the number of this new NVMe block device is the same as the number of the NVMe block device corresponding to the original abnormal output link), and then the data of the partition on the snapshot copy corresponding to the abnormal transmission link is copied to the new NVMe block device, and the new NVMe block device then transmits the data to the partition corresponding to the backup volume according to the selected idle transmission link.
[0070] The user-mode-based data replication method further includes: saving each bitmap according to a preset time period (the preset time period can be set according to actual conditions), and when an abnormality occurs during the process of copying data in the snapshot copy partition to the partition of the backup volume, after the abnormality is restored, reacquire the saved bitmap, so that the data replication process is restored to the state before the abnormality. Wherein, after the abnormality is restored, if the data of each partition on the snapshot copy is not completely copied, then according to the bit on the bitmap on the saved bitmap, continue to copy the data corresponding to the bit that has not been copied.
[0071] This user-state-based data replication method eliminates kernel overhead based on the SPDK architecture. The RDMA replication link bypasses the kernel's data replication and transmission, realizes efficient data access in the user state, and avoids the problem of data backup failure caused by kernel crash; This user-state-based data replication method partitions the snapshot copy and the backup volume address space, and at the same time, by establishing multiple replication links, realizes multiple replication tasks between the primary and backup volumes at the same time, improves replication efficiency, and when a replication link is abnormally disconnected, the replication can be continued through the remaining transmission links, thereby improving data reliability; The snapshot address segment partition is set to a corresponding bitmap for management, and the bitmap includes a status bit and other bits. The status bit is used to distinguish whether the data of the entire partition is copied, and the other bits are used to distinguish whether the data corresponding to each bit in the partition is copied. In the case of abnormal recovery, the data replication process is restored to the state before the abnormality through the bitmap, ensuring rapid recovery during abnormalities in the data replication process. At the same time, in the process of adding a replication task, the bitmap can be used to identify whether the data is modified, which also improves the efficiency of identifying new and old data in the new replication task.
[0072] It should be understood that although Figure 2 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0073] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A user-mode-based data replication method, characterized in that: Applied to copying data from a primary volume of a local device to a backup volume of a remote device, the user-mode-based data copying method includes: Evenly partitioning the address space of the backup volume of the remote device according to a first preset size, and creating a preset number of virtual block devices on the remote device; Create a snapshot copy of the primary volume at the current moment on the local device, and partition the snapshot copy according to the partition method of the backup volume; Create a corresponding bitmap for each partition of the snapshot copy and initialize the bits on each bitmap; Map the addresses of each virtual block device to different partitions that are not mapped on the backup volume; Mount each virtual block device to the local device, establish a transmission link corresponding to each virtual block device on the local device, and generate an NVMe block device corresponding to each transmission link to achieve the connection between the remote device and the local device; According to each backup volume partition after the mapping address, select the data of the corresponding partition in the snapshot copy and copy it to the NVMe block device, and indicate whether the partition data of each snapshot copy has been copied by updating the bit of the corresponding bitmap; Each NVMe block device transmits the received data to the partition corresponding to the backup volume in real time according to the corresponding transmission link and the address mapping relationship of the corresponding virtual block device, so as to copy the data in the snapshot copy partition to the partition of the backup volume; Finally, the mapping relationship between the address of each virtual block device and the backup volume partition is released, and each transmission link and NVMe block device is deleted.
2. The user-mode based data replication method according to claim 1, characterized in that: All snapshot copies have the same capacity as the backup volume, and the partitions of the backup volume and the snapshot copies are numbered in the order of 1 to n; The number of virtual block devices created on the remote device is m, and m is less than or equal to n.
3. The user-mode based data replication method according to claim 1, characterized in that: After partitioning the snapshot copy, each partition of the snapshot copy is evenly divided into blocks according to the second preset size, each bitmap includes a first bit and the remaining bits corresponding to each block one by one, and the first bit is the status bit of the bitmap, wherein the status bit indicates whether the data of the entire partition on the snapshot copy is copied to the NVMe block device, and the remaining bits indicate whether the data of the corresponding blocks on the snapshot copy partition are copied to the NVMe block device.
4. The user-mode based data replication method according to claim 1, characterized in that: The method of mounting each virtual block device to the local device and generating an NVMe block device corresponding to each virtual block device on the local device to establish each transmission link between the remote device and the local device includes: Create a subsystem on the remote device that corresponds to the virtual block device one by one; Add the numbers of each virtual block device and the backup volume partition mapped by each virtual block device to the subsystem one by one; The local device establishes a transmission link corresponding to each subsystem one by one, and generates an NVMe block device corresponding to each transmission link on the local device, and the NVMe block device has a number consistent with the number of the backup volume partition added in the corresponding subsystem, completing the connection between the remote device and the local device.
5. The user-mode based data replication method according to claim 4, characterized in that: In the process of copying the data in each snapshot copy partition to the partition of the backup volume, according to the number of each backup volume partition added in the subsystem, the data of each partition with the same number on the snapshot copy is copied to each NVMe block device with the corresponding number. Then each NVMe block device finds the address mapping relationship of the virtual block device according to the corresponding transmission link and the virtual block device added in the corresponding subsystem, and then transmits the received data to the partition corresponding to the backup volume in real time, realizing the replication of data from the primary volume to the backup volume.
6. The user-mode based data replication method according to claim 4, characterized in that: After the copying is completed, the mapping relationship between the address of each virtual block device and the backup volume partition is released, and each transmission link and NVMe block device are deleted, and the virtual block devices added in the subsystem and the numbers of the backup volume partitions mapped by each virtual block device are deleted.
7. The user-mode based data replication method according to claim 1, characterized in that: The user-state-based data replication method further includes, after all data on the snapshot copy are copied to the backup volume, establishing a new replication task according to a preset mode, and the new replication task includes: After the data on the first snapshot copy is copied, a new snapshot copy is created if there is a new copy task on the primary volume. For each newly created snapshot copy: the data of the current snapshot copy is compared with the data of the previous snapshot copy, and the bits corresponding to the changed data in the current snapshot copy are updated to the initialization state, and the status bits of the partition of the snapshot copy where the changed data is located are updated to the initialization state; According to the partition updated to the initialized state on the snapshot copy, the address of the virtual block device is mapped to the corresponding partition of the backup volume on the remote device; Then, the virtual block device with the mapped address is mounted to the local device, and the NVMe block device corresponding to each virtual block device is generated on the local device; Then copy the bit data updated to the initialized state on the snapshot copy to the corresponding NVMe block device, and then synchronize it to the corresponding partition of the backup volume.
8. The user-mode based data replication method according to claim 7, characterized in that: The preset mode is periodic replication or threshold replication, wherein periodic replication is to create a new replication task at every preset time interval, and threshold replication is to create a new replication task when the new data on the primary volume reaches a preset amount.
9. The user-mode based data replication method according to claim 1, characterized in that: If one of the transmission links is abnormally disconnected during the replication process, first delete the NVMe block device corresponding to the local device and the abnormally disconnected transmission link, delete the number of the backup volume partition and the virtual block device in the corresponding subsystem, select another idle transmission link, add the number of the backup volume partition and the virtual block device in the subsystem of the abnormal transmission link to the subsystem of the selected idle transmission link, generate a new NVMe block device, and the number of the new NVMe block device is the same as the number of the NVMe block device corresponding to the abnormally disconnected transmission link, then copy the data of the partition on the snapshot copy corresponding to the abnormal transmission link to the new NVMe block device, and the new NVMe block device transmits the data to the partition corresponding to the backup volume according to the selected idle transmission link.
10. The user-mode based data replication method according to claim 1, characterized in that: The user-mode-based data replication method further includes: saving each bitmap according to a preset time period, and when an abnormality occurs during the process of copying data in the snapshot copy partition to the partition of the backup volume, after the abnormality is restored, re-obtaining the saved bitmap, so that the data replication process is restored to the state before the abnormality.
Citation Information
Patent Citations
Information management method and device, equipment and medium
CN109960602A
Method and system for enabling data backups for virtual machines reliant on raw device mapping disks
CN110413370A