Data replication method and device and electronic equipment
By creating multiple replica LUNs for source LUNs in storage devices and using differential bitmaps and incremental replication technologies, the problem that data replication schemes in the prior art cannot recover historical data is solved, and more efficient and reliable data recovery is achieved.
Patent Information
- Application Number
- CN202411972346.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2044-12-30
AI Technical Summary
Existing one-to-one data replication schemes cannot recover their historical data in the event of a disaster in the source LUN, affecting the availability of the data.
Using a one-to-many data replication scheme, by creating multiple replica LUNs for source LUNs in storage devices, saving their historical data, and using differential bitmaps and incremental replication technologies during the replication process, ensuring that data can be recovered in the event of disaster.
Improves the reliability of data recovery, and can retrieve data from multiple historical moments through multiple replica LUNs when a disaster occurs in the source LUN, avoiding data loss, and reducing the impact of data replication on the source LUN.
Smart Images

Figure CN119883736A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a data replication method, device and electronic device. Background Art
[0002] With the advent of the big data era, the amount of data is increasing, and data protection is becoming more and more important. Replication is one of the common means of data protection, and it is also a common solution for dealing with "hard disasters" and "soft disasters"; the so-called hard disaster, that is, "hard" disaster, usually refers to the physical damage or unreadable production data due to factors such as disk array (Redundant Arrays of Independent Disks, RAID) failure, earthquake, fire, etc. The so-called soft disaster usually refers to the situation where data is logically damaged due to viruses, misoperation, software bugs, etc.
[0003] At present, in actual applications, a logical unit number (LUN) is usually created on a storage device to write data generated by a front-end application server. The LUN can be called a source LUN. The so-called LUN refers to an independent and available storage space created based on RAID. Then a one-to-one replication scheme is adopted, that is, through replication technology, a replica LUN is created for the source LUN to replicate the data in the source LUN. The source LUN and the replica LUN are physically independent, so that when a hard disaster or a soft disaster occurs to the source LUN, the data in the replica LUN can be used for data recovery. However, with the above-mentioned one-to-one replication scheme, when a disaster such as a hard disaster or a soft disaster occurs to the source LUN, the historical data of the source LUN before the disaster cannot be retrieved using only one replica LUN, thereby affecting the availability of data. Summary of the invention
[0004] In view of this, the present application provides a data replication method, device and electronic device to improve the reliability of data recovery.
[0005] An embodiment of the present application provides a data replication method, which is applied to a storage device, wherein the storage device includes a source LUN to be replicated; the method includes:
[0006] When it is determined to start a replication of data in the storage space corresponding to the source LUN, a replica LUN in the available state of the master state is obtained from the current replica LUN list corresponding to the source LUN as the target LUN to which the data is replicated this time; if the available state of any replica LUN in the current replica LUN list is the master state, it indicates that the replica LUN is currently allowed to perform data replication;
[0007] When the status of the difference bitmap corresponding to the source LUN is valid, and it is determined based on the current copy LUN list that there is at least one copy LUN that has completed data replication, the copy LUN that has completed the latest data replication is determined based on the current copy LUN list as a reference LUN, and it is checked whether the reference LUN and the target LUN are the same LUN. If so, the data in the storage space corresponding to the source LUN is incrementally copied to the target LUN based on the difference bitmap corresponding to the source LUN. Otherwise, the data in the storage space corresponding to the reference LUN is fully copied to the target LUN, and the data in the storage space corresponding to the source LUN is incrementally copied to the target LUN based on the difference bitmap corresponding to the source LUN; the difference bitmap indicates the data that has changed in the source LUN from the time when the replication of the data in the storage space corresponding to the source LUN was determined to be started last time to the time when the replication of the data in the storage space corresponding to the source LUN is determined to be started this time;
[0008] When it is determined based on the current copy LUN list that there is currently no copy LUN that has completed data replication, or the status of the difference bitmap corresponding to the source LUN is invalid, all the data in the storage space corresponding to the source LUN is copied to the target LUN; wherein, when it is determined that there is currently no copy LUN that has completed data replication, the status of the difference bitmap corresponding to the source LUN is modified from a valid state to an invalid state.
[0009] The embodiment of the present application further provides a data replication device, which is applied to a storage device, wherein the storage device includes a source LUN to be replicated; the device includes:
[0010] An acquisition module is used to, when determining to start a replication of data in the storage space corresponding to the source LUN, obtain a replica LUN in the available state of the master state from the current replica LUN list corresponding to the source LUN as the target LUN to which the data is replicated this time; if the available state of any replica LUN in the current replica LUN list is the master state, it indicates that the replica LUN currently allows data replication;
[0011] A first replication module is used for, when the state of the difference bitmap corresponding to the source LUN is a valid state and it is determined based on the current copy LUN list that there is currently at least one copy LUN that has completed data replication, to determine the latest copy LUN that has completed data replication as a reference LUN based on the current copy LUN list, and to check whether the reference LUN and the target LUN are the same LUN; if so, to incrementally replicate the data in the storage space corresponding to the source LUN to the target LUN based on the difference bitmap corresponding to the source LUN; otherwise, to fully replicate the data in the storage space corresponding to the reference LUN to the target LUN, and to incrementally replicate the data in the storage space corresponding to the source LUN to the target LUN based on the difference bitmap corresponding to the source LUN; the difference bitmap indicates the data that has changed in the source LUN from the time when the replication of the data in the storage space corresponding to the source LUN was determined to be started last time to the time when the replication of the data in the storage space corresponding to the source LUN is determined to be started this time;
[0012] The second replication module is used to copy all the data in the storage space corresponding to the source LUN to the target LUN when it is determined based on the current replica LUN list that there is currently no replica LUN that has completed data replication, or the status of the difference bitmap corresponding to the source LUN is invalid; wherein, when it is determined that there is currently no replica LUN that has completed data replication, the status of the difference bitmap corresponding to the source LUN is modified from a valid state to an invalid state.
[0013] The present application also provides an electronic device, the electronic device comprising:
[0014] Processor; and
[0015] A computer-readable storage medium stores computer program instructions, which, when executed by a processor, cause the processor to execute the steps of the above method.
[0016] An embodiment of the present application further provides a computer-readable storage medium, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the processor executes the steps in the above method.
[0017] It can be seen from the above technical scheme that in the embodiment of the present application, multiple copy LUNs are created corresponding to the source LUN for subsequent replication of data in the storage space corresponding to the source LUN. It can be seen that the present embodiment adopts a one-to-many replication scheme, that is, a replication scheme in which one source LUN corresponds to multiple copy LUNs. The multiple copy LUNs store the historical data of the source LUN at multiple historical moments. In this way, when a disaster occurs to the source LUN, the historical data of multiple historical moments can be retrieved through the multiple copy LUNs, thereby improving the availability of data; and when a disaster also occurs to one or more of the copy LUNs corresponding to the source LUN, the copy LUNs corresponding to the source LUN other than the copy LUN where the disaster occurred can also be used to recover data, thereby avoiding the situation in which the data is completely lost due to a disaster in the copy LUN in the one-to-one replication scheme, thereby improving the reliability of data recovery.
[0018] Furthermore, when determining to start a replication, the embodiment of the present application first uses the available status of each replica LUN corresponding to the source LUN to select the target LUN to which the data is replicated this time; then, if the difference bitmap of the source LUN is valid, if the replica LUN that has recently completed data replication, that is, the target LUN to which the data was replicated last time, is the same LUN as the current target LUN, it means that the last data replication and the current data replication are to the same LUN. At this time, only the data changed in the source LUN since the last replication needs to be copied to the current target LUN using the incremental replication method. Otherwise, the last target LUN is first copied to the target LUN. The data on the target LUN to which the data was copied is fully copied to the current target LUN, and then the data changed in the source LUN since the last copy is copied to the current target LUN using the incremental copy method; when the difference bitmap of the source LUN is invalid or the copy LUNs have never been copied, the full copy method is used to copy the data on the source LUN to the target LUN to complete this copy; in this way, a large number of data copy operations can be completed between the copy LUNs as much as possible, effectively reducing the impact of data copy on the source LUN and improving the processing performance of the source LUN for the IO requests of the front-end application server.
[0019] Furthermore, the embodiment of the present application utilizes a storage device including a source LUN to perform replication of data in the storage space corresponding to the source LUN. The replication process does not need to pass through the front-end application server, but directly reads the data locally for corresponding replication. This will not affect the normal business operation of the front-end application server, but can also effectively improve the efficiency of data replication. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The accompanying drawings, which are incorporated in the specification and constitute a part of this application, illustrate embodiments consistent with the application and, together with the description, serve to explain the principles of the application.
[0021] Figure 1 A flow chart of the method provided in an embodiment of the present application.
[0022] Figure 2 Another method flow chart provided for an embodiment of the present application.
[0023] Figure 3 Another method flow chart provided for an embodiment of the present application.
[0024] Figure 4 A schematic diagram of the device structure provided in an embodiment of the present application.
[0025] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0026] In order to enable those skilled in the art to better understand the technical solutions provided by the embodiments of the present application and to make the above-mentioned purposes, features and advantages of the embodiments of the present application more obvious and understandable, the technical solutions in the embodiments of the present application are further described in detail below in conjunction with the accompanying drawings.
[0027] See also Figure 1 , Figure 1 A flowchart of a method provided in an embodiment of the present application. The method is applied to a storage device, which includes a source LUN to be copied. As an embodiment, the storage device can be an electronic device such as a computer or a server, which is not specifically limited in this embodiment.
[0028] like Figure 1 As shown, the process may include the following steps:
[0029] Step 101, when it is determined to start a replication of data in the storage space corresponding to the source LUN, a replica LUN whose available state is the primary state is obtained from the current replica LUN list corresponding to the source LUN as the target LUN to which the data is replicated this time.
[0030] In this embodiment, the source LUN refers to the LUN whose data needs to be replicated. In this embodiment, the source LUN supports the configuration of a one-to-many replication relationship, that is, the source LUN supports the configuration of multiple replica LUNs for subsequent use in replicating data in the storage space corresponding to the source LUN. Here, there is no specific limitation on the number of replica LUNs corresponding to the source LUN, for example, it can be 10, 20, or 30.
[0031] The above-mentioned source LUN is deployed in the above-mentioned storage device. As an embodiment, the source LUN and the multiple replica LUNs corresponding to the source LUN can be deployed in the same storage device (that is, the above-mentioned storage device); or, the source LUN and the multiple replica LUNs corresponding to the source LUN can be deployed in different storage devices, in which case the multiple replica LUNs corresponding to the source LUN can be deployed in the same storage device or in different storage devices; this embodiment does not specifically limit this.
[0032] In this embodiment, a corresponding replication trigger policy can be configured in advance for the replication of data in the storage space corresponding to the source LUN based on actual needs; for example, as an embodiment, the replication trigger policy can be set for the source LUN to set a scheduled task for triggering data replication, and specifically, it can be set to trigger the replication of data in the storage space corresponding to the source LUN once at 8 pm every day, etc. Based on this, when the time reaches 8 pm every day, it is determined to start the replication of data in the storage space corresponding to the source LUN.
[0033] In this embodiment, a copy LUN list corresponding to the source LUN can be maintained in the storage device where the source LUN is located. The copy LUN list can be used to record LUN information such as availability status of each copy LUN corresponding to the source LUN, and the information recorded in the copy LUN list can change dynamically.
[0034] In this embodiment, the replica LUNs corresponding to the source LUN are used cyclically, that is, one data replication only copies the data in the storage space corresponding to the source LUN to one of the replica LUNs. Based on this, when it is determined to start a replication of the data in the storage space corresponding to the source LUN, if the available status of any replica LUN in the current replica LUN list corresponding to the source LUN is in the primary status, it indicates that the replica LUN currently allows data replication; under this premise, this embodiment can determine the replica LUN to which the data is replicated this time, that is, the above-mentioned target LUN, by the available status of each replica LUN. Specifically, the replica LUN that is currently allowed to replicate data, that is, the replica LUN whose available status is in the primary status, can be obtained from the current replica LUN list corresponding to the source LUN as the target LUN to which the data is replicated this time.
[0035] Step 102, when the status of the differential bitmap corresponding to the source LUN is valid, and it is determined based on the current replica LUN list that there is currently at least one replica LUN that has completed data replication, the replica LUN that has most recently completed data replication is determined based on the current replica LUN list as a reference LUN, and a check is made as to whether the reference LUN and the target LUN are the same LUN; if so, the data in the storage space corresponding to the source LUN is incrementally copied to the target LUN based on the differential bitmap corresponding to the source LUN; otherwise, the data in the storage space corresponding to the reference LUN is fully copied to the target LUN, and the data in the storage space corresponding to the source LUN is incrementally copied to the target LUN based on the differential bitmap corresponding to the source LUN.
[0036] In this embodiment, the difference bitmap indicates the data that has changed from the last time the replication of the data in the storage space corresponding to the source LUN was started to the time when the replication of the data in the storage space corresponding to the source LUN was started; it can be seen that the difference bitmap can be changed dynamically. For example, assuming that the replication of the data in the storage space corresponding to the source LUN is triggered once every night at 8 o'clock, when the time reaches 8 o'clock this evening, the difference bitmap corresponding to the source LUN indicates the data that changed between 8 o'clock last night and 8 o'clock this evening; and at 8 o'clock yesterday evening, the difference bitmap corresponding to the source LUN indicates the data that changed between 8 o'clock the night before yesterday and 8 o'clock yesterday evening.
[0037] In this embodiment, if the state of the above-mentioned difference bitmap is a valid state, it indicates that the difference bitmap corresponding to the source LUN can be used to incrementally copy the data in the storage space corresponding to the source LUN; correspondingly, if the state of the above-mentioned difference bitmap is an invalid state, such as the difference bitmap is empty, then at this time, the difference bitmap corresponding to the source LUN cannot be used to incrementally copy the data in the storage space corresponding to the source LUN.
[0038] Furthermore, it should be noted that the source LUN will record the corresponding data difference for each write IO transmitted by the front-end application server only after the first full data replication is triggered, such as recording the data difference by using a difference bitmap; it can be seen that before the source LUN triggers the first full data replication, there is no corresponding difference bitmap for the source LUN. If the difference bitmap is empty, it can be considered that the state of the difference bitmap corresponding to the source LUN is invalid. Based on this, in this embodiment, when the state of the difference bitmap corresponding to the source LUN is invalid, when the source LUN starts a replication, a full replication will be performed, and before the full replication is performed, the state of the difference bitmap corresponding to the source LUN will be automatically triggered to change from an invalid state to a valid state.
[0039] The above-mentioned full replication refers to a replication method in which all data in the storage space corresponding to the source LUN is copied to the corresponding target LUN. The above-mentioned incremental replication refers to a replication method in which only the data in the storage space corresponding to the source LUN that has changed since the last data replication is copied to the corresponding target LUN during each data replication. During the full replication or incremental replication process, the space in the target LUN data that has been replicated corresponds to the new data, and the space that has not been replicated corresponds to the old data, that is, the data in the target LUN is not the complete and consistent data of the source LUN at the time of starting this replication.
[0040] Based on the above description, after determining the target LUN to which the data is copied, this embodiment first checks whether the status of the difference bitmap corresponding to the source LUN is valid;
[0041] Afterwards, if the status of the differential bitmap corresponding to the source LUN is valid, determine whether there is at least one replica LUN that has completed data replication based on the current replica LUN list; when there is at least one replica LUN that has completed data replication, determine the latest replica LUN that has completed data replication (that is, the LUN to which the data was last replicated) based on the current replica LUN list as a reference LUN, and check whether the reference LUN and the target LUN are the same LUN. If the reference LUN and the target LUN are the same LUN, it means that the LUN to which the data was last replicated and the LUN to which the data is currently replicated are the same LUN. At this time, only the data that has changed in the source LUN since the last replication needs to be copied to the current target LUN. Specifically, for example, the data in the storage space corresponding to the source LUN is incrementally copied to the target LUN based on the differential bitmap corresponding to the source LUN to complete this data replication;
[0042] If the reference LUN and the target LUN are not the same LUN, then you can first copy all the data in the storage space corresponding to the reference LUN to the target LUN. This means that the data from the last data copy to the source LUN has been copied to the target LUN. Based on this, you can copy the data in the source LUN that has changed since the last copy to the current target LUN. Specifically, you can copy the data in the storage space corresponding to the source LUN to the target LUN based on the difference bitmap corresponding to the source LUN. In this way, the data in the storage space corresponding to the target LUN is consistent with the data in the storage space corresponding to the current source LUN, and the data copying is completed.
[0043] As for how to determine in this step 102 whether there is at least one replica LUN that has completed data replication based on the current replica LUN list, how to determine the replica LUN that has recently completed data replication based on the current replica LUN list, and how to incrementally copy the data in the storage space corresponding to the source LUN to the target LUN based on the difference bitmap corresponding to the source LUN, the following will give examples and descriptions, which will not be repeated here.
[0044] Step 103, when it is determined based on the current copy LUN list that there is currently no copy LUN that has completed data replication, or the status of the difference bitmap corresponding to the source LUN is invalid, all the data in the storage space corresponding to the source LUN is copied to the target LUN; wherein, when it is determined that there is currently no copy LUN that has completed data replication, the status of the difference bitmap corresponding to the source LUN is modified from a valid state to an invalid state.
[0045] In this embodiment, if the state of the difference bitmap corresponding to the source LUN is invalid, or it is determined based on the current copy LUN list that there is currently no copy LUN that has completed data replication (that is, it means that each copy LUN in the current copy LUN list has not been replicated), then at this time, the data in the storage space corresponding to the source LUN needs to be fully replicated to the target LUN. In addition, when it is determined that there is currently no copy LUN that has completed data replication, the state of the difference bitmap corresponding to the source LUN is modified from a valid state to an invalid state to indicate that it is currently impossible to perform incremental replication of the data in the storage space corresponding to the source LUN, that is, a full replication method is to be used.
[0046] So far, completed Figure 1 The process shown.
[0047] pass Figure 1 It can be seen from the shown process that in the embodiment of the present application, multiple replica LUNs are created corresponding to the source LUN for subsequent replication of data in the storage space corresponding to the source LUN. It can be seen that the present embodiment adopts a one-to-many replication scheme, that is, a replication scheme in which one source LUN corresponds to multiple replica LUNs. The multiple replica LUNs store the historical data of the source LUN at multiple historical moments. In this way, when a disaster occurs to the source LUN, the historical data of multiple historical moments can be retrieved through the multiple replica LUNs, thereby improving the availability of data; and when a disaster also occurs to one or more of the replica LUNs corresponding to the source LUN, the replica LUNs corresponding to the source LUN other than the replica LUN where the disaster occurred can also be used to recover data, thereby avoiding the situation in which the data is completely lost due to a disaster in the replica LUN in the one-to-one replication scheme, thereby improving the reliability of data recovery.
[0048] Furthermore, when determining to start a replication, the embodiment of the present application first uses the available status of each replica LUN corresponding to the source LUN to select the target LUN to which the data is replicated this time; then, if the difference bitmap of the source LUN is valid, if the replica LUN that has recently completed data replication, that is, the target LUN to which the data was replicated last time, is the same LUN as the current target LUN, it means that the last data replication and the current data replication are to the same LUN. At this time, only the data changed in the source LUN since the last replication needs to be copied to the current target LUN using the incremental replication method. Otherwise, the last target LUN is first copied to the target LUN. The data on the target LUN to which the data was copied is fully copied to the current target LUN, and then the data changed in the source LUN since the last copy is copied to the current target LUN using the incremental copy method; when the difference bitmap of the source LUN is invalid or the copy LUNs have never been copied, the full copy method is used to copy the data on the source LUN to the target LUN to complete this copy; in this way, a large number of data copy operations can be completed between the copy LUNs as much as possible, effectively reducing the impact of data copy on the source LUN and improving the processing performance of the source LUN for the IO requests of the front-end application server.
[0049] Furthermore, the embodiment of the present application utilizes a storage device including a source LUN to perform replication of data in the storage space corresponding to the source LUN. The replication process does not need to pass through the front-end application server, but directly reads the data locally for corresponding replication. This will not affect the normal business operation of the front-end application server, but can also effectively improve the efficiency of data replication.
[0050] The following further describes the processing of the target LUN after determining the target LUN to which the data is copied in step 101:
[0051] In this embodiment, the current replica LUN list also records the timestamp value of each replica LUN corresponding to the source LUN; wherein, the timestamp value corresponding to any replica LUN in the current replica LUN list that is determined as the target LUN and has a timestamp value of a specified value is used to indicate that the replica LUN is currently being replicated, which can indicate that the data in the replica LUN is not the complete and consistent data of the source LUN at the time of starting this replication, and cannot be used to restore the data of the source LUN. Here, the specified value is pre-configured based on actual needs, such as the specified value can be configured as 0, etc.; based on this, the non-specified value refers to non-zero values such as 1, 2, 3, etc.
[0052] Based on the above description, as an embodiment, in order to indicate the available status of the replica LUN, after this embodiment obtains a replica LUN with an available status of primary status from the current replica LUN list corresponding to the source LUN as the target LUN to which the data is copied this time, it means that the current data replication corresponding to the source LUN will use the target LUN to perform data replication. At this time, the target LUN can be marked as incomplete in the target LUN by modifying the timestamp value of the target LUN, and the data cannot be used to restore the data of the source LUN; specifically, for example, if the timestamp value corresponding to the target LUN in the current replica LUN list is a non-specified value, the timestamp value corresponding to the target LUN in the current replica LUN list is modified from the non-specified value to the specified value; if the timestamp value corresponding to the target LUN in the current replica LUN list is a specified value, the timestamp value corresponding to the target LUN continues to be maintained as the specified value.
[0053] The above step 102 is further described below:
[0054] In this embodiment, the timestamp value corresponding to any replica LUN in the current replica LUN list whose timestamp value is not a specified value is used to indicate the timestamp when data replication was last performed on the replica LUN; and the timestamp value corresponding to any replica LUN in the current replica LUN list that is not a target LUN and whose timestamp value is a specified value is used to indicate that data replication has never been performed on the replica LUN, the data of the source LUN is not saved in the replica LUN, and cannot be used to restore the data of the source LUN.
[0055] As described above, in this embodiment, for the replication of data in the storage space corresponding to the source LUN, the replica LUNs corresponding to the source LUN are used cyclically, and only one of the replica LUNs will be used for one data replication; based on this, in this embodiment, for any replica LUN whose timestamp value is a non-specified value in the current replica LUN list, the smaller the timestamp value of the replica LUN, the earlier the last time the data replication was performed on the replica LUN, and correspondingly, the larger the timestamp value of the replica LUN, the later the last time the data replication was performed on the replica LUN. And, as described above, in this embodiment, the timestamp value is not represented by the time on the storage device, but by the numerical values 0, 1, 2, etc., so as to avoid the situation where the order of cyclic use of the replica LUNs corresponding to the source LUN is incorrect due to the modifiable time on the storage device.
[0056] For example, assuming that the timestamp values corresponding to replica LUN1 and replica LUN2 are 1 and 2 respectively, and 1 is less than 2, then the time when data replication was last performed on replica LUN1 (such as the starting time) is earlier than the time when data replication was last performed on replica LUN2 (such as the starting time); for example, when the replication of data in the storage space corresponding to the source LUN is triggered once every night at 8 o'clock, the starting time of the last data replication performed on replica LUN1 was 8 o'clock yesterday evening, and the starting time of the last data replication performed on replica LUN2 was 8 o'clock this evening.
[0057] Based on the above description, as an embodiment, the above step 102 determines that there is currently at least one replica LUN that has completed data replication based on the current replica LUN list. In specific implementation, for example, it may include: searching from the current replica LUN list whether there is at least one replica LUN with a timestamp value that is not a specified value. If so, it is determined that there is currently at least one replica LUN that has completed data replication. Otherwise, it is determined that there is currently no replica LUN that has completed data replication. Based on this, the above step 102 determines the replica LUN that has recently completed data replication based on the current replica LUN list. In specific implementation, for example, it may include: obtaining from the current replica LUN list a replica LUN with a timestamp value that is a non-specified value and the largest timestamp value as the replica LUN that has recently completed data replication.
[0058] In this embodiment, the available status of the above-mentioned replica LUN also includes the standby copying state and the standby state; wherein, if the available status of any replica LUN in the current replica LUN list is the standby copying state, it indicates that the data in the storage space corresponding to the replica LUN is currently being fully copied to the current target LUN, and the replica LUN is currently not allowed to perform other data replication except for fully copying the data in the corresponding storage space to the current target LUN; if the available status of any replica LUN in the current replica LUN list is the standby state, it indicates that the replica LUN is currently not allowed to perform data replication. Based on this, as described above, if the reference LUN and the target LUN are not the same LUN, it means that at this time, the data replication needs to use the reference LUN for full replication first, and then use the source LUN for incremental replication. Under this premise, as an embodiment, the available status of the reference LUN in the current replica LUN list can be modified to the standby copying state; thereafter, after the data in the storage space corresponding to the reference LUN is fully copied to the target LUN, it means that the reference LUN has been fully utilized, so the available status of the reference LUN in the current replica LUN list can be modified from the standby copying state to the standby state.
[0059] As an embodiment, in the above step 102, the data increments in the storage space corresponding to the source LUN are copied to the target LUN based on the difference bitmap corresponding to the source LUN. In a specific implementation, for example, the difference bitmap corresponding to the source LUN is first converted into a transmission bitmap, and then the data increments in the storage space corresponding to the source LUN are copied to the target LUN based on the transmission bitmap.
[0060] In this embodiment, as described above, the difference bitmap is used to record the data that has changed on the source LUN since the last data replication; specifically, the difference bitmap is a data structure, and each bit (i.e., bit) corresponds to a storage block that has been divided on the source LUN, wherein the value of each bit in the difference bitmap is used to indicate whether the data on the corresponding storage block has changed, for example, if the value of any bit in the difference bitmap is 0, it indicates that the data on the storage block corresponding to the bit has not changed, and if the value of any bit in the difference bitmap is 1, it indicates that the data on the storage block corresponding to the bit has changed.
[0061] In incremental replication, the transmission bitmap is also a data structure, and the transmission bitmap is used to indicate which storage blocks on the source LUN need to have their data copied. Based on the working principle of incremental replication, it can be seen that the changed data needs to be copied, so the transmission bitmap can also be similar to the difference bitmap. For example, each bit (i.e., bit) in the transmission bitmap corresponds to a storage block that has been divided on the source LUN, and the value of each bit in the transmission bitmap is used to indicate whether the data on the corresponding storage block needs to be copied. For example, if the value of any bit in the transmission bitmap is 0, it indicates that the data on the storage block corresponding to the bit does not need to be copied. If the value of any bit in the difference bitmap is 1, it indicates that the data on the storage block corresponding to the bit needs to be copied. This embodiment does not limit this.
[0062] Based on the above description, in this embodiment, based on the difference bitmap of the source LUN, it can be known which storage blocks on the source LUN have changed data. Based on this, it can be known which storage blocks on the source LUN need to be copied data, so that the transmission bitmap can be obtained based on the difference bitmap.
[0063] The following further describes how to process the target LUN after the data in the storage space corresponding to the source LUN is copied:
[0064] In this embodiment, as an embodiment, after the completion of this data replication, if there are at least two replica LUNs (including the target LUN) in the current replica LUN list, at this time, the target LUN has been used in this data replication. Based on the scheme of using replica LUNs in sequence in this embodiment as described above, the replica LUN used for the next data replication is another replica LUN other than the target LUN, then the available state of the target LUN in the current replica LUN list can be changed from the primary state to the standby state, and the timestamp value of the target LUN can be modified according to the sum of the maximum timestamp value and the set value in the current replica LUN list. Specifically, the sum of the maximum timestamp value and the set value in the current replica LUN list can be used as the timestamp value corresponding to the target LUN, which is not specifically limited in this embodiment. In addition, in order to ensure the selection of the target LUN in the next data replication, the available state of the replica LUN in the current replica LUN list with the smallest timestamp value and the standby state is also changed from the standby state to the primary state, so that when the next data replication is triggered, the replica LUN with the largest timestamp value and the smallest timestamp value is selected as the target LUN.
[0065] It can be seen that in this embodiment, the multiple copy LUNs corresponding to the source LUN are used cyclically in sequence, which can not only improve the resource utilization of the copy LUNs, but also enable the multiple copy LUNs to store copy data of the latest data on multiple source LUNs, thereby ensuring the availability and comprehensiveness of the copy data.
[0066] If, after completing this data replication, only the target LUN exists in the current replica LUN list, then in order to ensure the normal operation of the next data replication, the available status corresponding to the target LUN in the current replica LUN list must continue to be maintained as the primary status, so that the target LUN can continue to be used for data replication during the next data replication.
[0067] The following is a further description of the replica LUN in this embodiment:
[0068] In this embodiment, the replica LUN corresponding to the source LUN supports configuration, for example, at least one LUN can be added as the replica LUN corresponding to the source LUN, and at least one LUN can be removed from the replica LUN corresponding to the source LUN. The following is an example of how to add at least one LUN as the replica LUN corresponding to the source LUN:
[0069] First, before describing how to add at least one LUN as a replica LUN corresponding to a source LUN, the replica LUN list maintained by the above storage device is described:
[0070] In this embodiment, the information recorded in the replica LUN list corresponding to the source LUN maintained by the above storage device is not specifically limited. For example, as shown in Table 1, the replica LUN list may include the device identifier (such as the IP address of the storage device), the replica LUN identifier (such as the replica LUN name), the available status, and the timestamp value of the storage device to which each replica LUN corresponding to the source LUN belongs. It should be noted that, initially, the timestamp value of each replica LUN in the replica LUN list is 0 (i.e., the above-mentioned specified value) to indicate that data replication has never been performed on the replica LUN.
[0071] Table 1: Example 1 of a replica LUN list
[0072]
[0073] Afterwards, as an embodiment, when an addition instruction is received indicating the addition of at least one LUN to be added as a replica LUN corresponding to the source LUN, for each LUN to be added, the LUN to be added, the available status of the LUN to be added, and the timestamp value of the LUN to be added are added to the current replica LUN list; wherein, if there is a replica LUN in the current replica LUN list that meets the set conditions, the available status of the LUN to be added is a standby status, and the timestamp value of the LUN to be added is a specified value; otherwise, the available status of the LUN to be added is a primary status, and the timestamp value of the LUN to be added is a specified value. Here, the above-mentioned set conditions are any of the following conditions: the available status is a standby status and the timestamp value is a specified value, the timestamp value is a non-specified value and the timestamp value is the smallest, and the available status is a primary status.
[0074] In this embodiment, the above-mentioned adding instruction may be, for example, an instruction manually triggered by relevant management personnel based on actual needs, and this embodiment does not make any specific limitation.
[0075] Exemplarily, it is assumed that the replica LUNs in the current replica LUN list corresponding to the source LUN are arranged in a specified order, where the specified order may be, for example, the order of the replica LUN names, such as LUN A1, LUN A2, LUN A3, LUNA4, ..., LUN An, where n is greater than 1. Initially, the available state of LUN A1 is the primary state, and the available states of the other replica LUNs except LUN A1 in the current replica LUN list are all in the standby state; the timestamp value of each replica LUN in the current replica LUN list is 0 to indicate that data replication has never been performed on the corresponding replica LUN.
[0076] Based on the above description, see Figure 2 As shown, when receiving an addition instruction indicating to add LUN Ax as a replica LUN corresponding to the source LUN, how to process the LUN Ax may include the following steps in specific implementation:
[0077] Step 201 , searching in the current copy LUN list corresponding to the source LUN whether there is a copy LUN whose available state is the standby state and whose timestamp value is 0; if so, executing step 202 ; otherwise, executing step 203 .
[0078] Step 202: determine the record corresponding to the replica LUN with the highest LUN name in the replica LUN list found in the current replica LUN list as the target record, and insert a record corresponding to LUN Ax with an available state of standby and a timestamp value of 0 before the target record.
[0079] In this embodiment, if at least one replica LUN is found whose available state is standby state and whose timestamp value is 0, the record corresponding to the replica LUN with the highest LUN name in the replica LUNs found in the current replica LUN list is determined as the target record. As shown in Table 2, the record corresponding to LUN A3 ("127.0.0.1, LUN A3, standby state, 0") is the found target record. At this time, the IP address of the storage device to which the LUN Ax to be added belongs, the replica LUN name, the available state, and the timestamp value can be added as a new record to the current replica LUN list, wherein the available state of LUN Ax is standby state and the timestamp value is 0; as shown in Table 3, the record corresponding to LUN Ax ("127.0.0.1, LUN Ax, standby state, 0") can be inserted before the target record.
[0080] Table 2: Example 2 of replica LUN list
[0081]
[0082] Table 3: Example 3 of replica LUN list
[0083]
[0084] Step 203 , searching in the current copy LUN list whether there is a copy LUN with a timestamp value other than 0, if yes, executing step 204 , otherwise executing step 205 .
[0085] Step 204: determine the record corresponding to the replica LUN with a non-zero timestamp value and the smallest timestamp value in the previous replica LUN list as the target record, and insert a record corresponding to LUN Ax with an available state of standby and a timestamp value of 0 before the target record.
[0086] In this embodiment, if at least one replica LUN with a timestamp value other than 0 is found, the record corresponding to the replica LUN with a timestamp value other than 0 and the smallest timestamp value in the previous replica LUN list (that is, the replica LUN with the earliest timestamp when data replication was last performed) is determined as the target record, as shown in Table 4, the record corresponding to LUN A1 ("127.0.0.1, LUN A1, standby state, 1") is the found target record. At this time, as described above, the record corresponding to the LUN Ax to be added can be added to the current replica LUN list, where the available state of LUN Ax is standby state and the timestamp value is 0; as shown in Table 5, the record corresponding to LUN Ax ("127.0.0.1, LUN Ax, standby state, 0") can be inserted before the target record.
[0087] Table 4: Example 4 of replica LUN list
[0088]
[0089] Table 5: Example 5 of replica LUN list
[0090]
[0091] Step 205, when there is a replica LUN in the current replica LUN list whose available status is the primary status, determine the record corresponding to the replica LUN in the current replica LUN list as the target record, and insert a record corresponding to LUN Ax whose available status is the backup status and whose timestamp value is 0 before the target record; otherwise, add the record corresponding to LUN Ax whose available status is the primary status and whose timestamp value is 0 to the current replica LUN list.
[0092] In this embodiment, if a replica LUN with a timestamp value other than 0 is not found, then the current replica LUN list is searched for a replica LUN with an available status of primary status; if a replica LUN with an available status of primary status is found, then this actually means that the current replica LUN list only contains a replica LUN with an available status of primary status, and then the record corresponding to the replica LUN in the current replica LUN list is determined as the target record, as shown in Table 6, the record corresponding to LUN A1 ("127.0.0.1, LUN A1, primary status, 0") is the target record found. At this time, the record corresponding to the LUNAx to be added can be added to the current replica LUN list, where the available status of LUN Ax is the standby status and the timestamp value is 0; as shown in Table 7, the record corresponding to LUN Ax ("127.0.0.1, LUN Ax, standby status, 0") can be inserted before the target record.
[0093] Table 6: Example 6 of replica LUN list
[0094]
[0095] Table 7: Example of replica LUN list 7
[0096]
[0097] If no replica LUN with the available status of the primary state is found, it actually means that the current replica LUN list is an empty list. Then, the record corresponding to the LUN Ax to be added can be added to the current replica LUN list as the first record in the current replica LUN list, wherein the available status of LUN Ax is the primary state and the timestamp value is 0. As shown in Table 8, the record corresponding to LUN Ax is "127.0.0.1, LUN Ax, primary state, 0".
[0098] Table 8: Example of replica LUN list 8
[0099]
[0100] This completes the above description of how to add at least one LUN as a replica LUN corresponding to a source LUN. The following describes how to remove at least one LUN from a replica LUN corresponding to a source LUN:
[0101] In this embodiment, as an embodiment, when a removal instruction indicating the removal of at least one replica LUN in the replica LUN corresponding to the source LUN is received, the removal instruction includes at least one LUN to be removed, and for each LUN to be removed, the LUN to be removed is removed from the current replica LUN list, as well as the available state and timestamp value of the LUN to be removed. Here, this embodiment does not specifically limit the triggering method of the removal instruction. For example, similar to the above-mentioned addition instruction, it can be an instruction manually triggered by relevant management personnel based on actual needs.
[0102] Among them, if there are at least two replica LUNs in the current replica LUN list, and the available status of the LUN to be removed in the current replica LUN list is the primary status, then the available status of the replica LUN in the current replica LUN list that is in the non-primary status and has the smallest timestamp value is modified to the primary status to ensure the selection of the target LUN during the next data replication, thereby ensuring the normal operation of the next data replication;
[0103] If there are at least two replica LUNs in the current replica LUN list, and the available status of the LUN to be removed in the current replica LUN list is in the standby copying status, it means that the LUN to be removed is currently copying all the data in the corresponding storage space to the current target LUN. Since the LUN to be removed is to be removed, it is necessary to stop copying all the data to the current target LUN, and to use the full copy method to copy the data on the source LUN to the target LUN to complete the data copy. Based on this, when the status of the difference bitmap corresponding to the source LUN is valid, the status of the difference bitmap corresponding to the source LUN is modified from valid to invalid. When the status of the difference bitmap corresponding to the source LUN is invalid, the status of the difference bitmap corresponding to the source LUN is maintained unchanged, so that the source LUN cannot perform incremental copying but uses full copying to complete the data copying. Also, the replication relationship between the LUN to be removed and the current target LUN corresponding to the LUN to be removed is modified to a disabled replication relationship, so that the LUN to be removed stops the current data replication.
[0104] If the replication relationship between any replica LUN in the current replica LUN list and any other replica LUN except the replica LUN is a disabled replication relationship, it indicates that the replica LUN is currently prohibited from replicating data in the corresponding storage space to the other replica LUN.
[0105] For example, see Figure 3 As shown, when receiving an instruction to remove the copy LUN Ax corresponding to the source LUN, how to process LUN Ax may include the following steps in specific implementation:
[0106] Step 301, when the current copy LUN list corresponding to the source LUN includes a copy LUN, check whether the current copy LUN list corresponding to the source LUN includes only a record corresponding to one copy LUN, if so, execute step 302, otherwise, execute steps 303, 304 and 305.
[0107] Step 302: directly remove the record corresponding to LUN Ax.
[0108] In this embodiment, if the current copy LUN list corresponding to the source LUN includes only one record, that is, a record corresponding to LUN Ax, the record corresponding to LUN Ax is directly removed.
[0109] Step 303: when the available state of LUN Ax is the master state, the available state of the next record corresponding to LUN Ax in the current replica LUN list is modified to the master state, and then the record corresponding to LUN Ax is removed.
[0110] In this embodiment, if the current replica LUN list includes records corresponding to multiple replica LUNs, when the available status of LUNAx is the primary status, the available status of the next record corresponding to LUN Ax in the current replica LUN list (that is, the record corresponding to the replica LUN whose available status is the standby status and has the smallest timestamp value) is modified to the primary status to ensure the normal operation of the next data replication, and then the record corresponding to LUN Ax is removed.
[0111] It should be noted that, if the record corresponding to the above LUN Ax is the last record in the current copy LUN list, the next record of the record corresponding to LUN Ax may be the first record in the current copy LUN list.
[0112] Step 304: When the available state of LUN Ax is the standby state, directly remove the corresponding record of LUN Ax in the current copy LUN list.
[0113] Step 305, when the available state of LUN Ax is in the standby replication state, if the state of the difference bitmap corresponding to the source LUN is in the valid state, the state of the difference bitmap corresponding to the source LUN is changed from the valid state to the invalid state; if the state of the difference bitmap corresponding to the source LUN is in the invalid state, the state of the difference bitmap corresponding to the source LUN is maintained unchanged; and, the replication relationship between the LUN to be removed and the current target LUN corresponding to the LUN to be removed is changed to a disabled replication relationship; and then the record corresponding to LUN Ax is removed.
[0114] This completes the above description of how to remove at least one LUN from the copy LUN corresponding to the source LUN.
[0115] In this embodiment, as an embodiment, if the reference LUN and the target LUN are not the same LUN, the method further includes: if it is found that the replication relationship between the reference LUN and the target LUN is a disabled replication relationship, based on the above description, it can be known that the reference LUN may be removed at this time, and because the LUN to be removed is to be removed, it is necessary to stop copying the full amount of data to the current target LUN, and instead use the full copy method to copy the data on the source LUN to the target LUN to complete this data copy; based on this, the state of the difference bitmap corresponding to the source LUN can be modified from a valid state to an invalid state, so that the source LUN cannot perform incremental replication but uses full replication to complete this data replication, and then, the data in the storage space corresponding to the source LUN is fully copied to the target LUN to complete this data replication.
[0116] At this point, the description of the method provided in the embodiment of the present application is completed. The following is a description of the device provided in the embodiment of the present application:
[0117] See also Figure 4 , Figure 4 The present invention provides a schematic diagram of a data replication device. The device is applied to a storage device, and the storage device includes a source LUN to be replicated. Figure 4 As shown, the device 400 includes an obtaining module 401, a first copying module 402 and a second copying module 403;
[0118] The obtaining module 401 is used to obtain a copy LUN in the primary state from the current copy LUN list corresponding to the source LUN when determining to start a copy of the data in the storage space corresponding to the source LUN, as the target LUN to which the data is copied this time; if the available state of any copy LUN in the current copy LUN list is the primary state, it indicates that the copy LUN currently allows data copying;
[0119] The first replication module 402 is used for, when the state of the difference bitmap corresponding to the source LUN is valid and it is determined based on the current replica LUN list that there is currently at least one replica LUN that has completed data replication, to determine the latest replica LUN that has completed data replication as a reference LUN based on the current replica LUN list, and to check whether the reference LUN and the target LUN are the same LUN; if so, to incrementally replicate the data in the storage space corresponding to the source LUN to the target LUN based on the difference bitmap corresponding to the source LUN; otherwise, to fully replicate the data in the storage space corresponding to the reference LUN to the target LUN, and to incrementally replicate the data in the storage space corresponding to the source LUN to the target LUN based on the difference bitmap corresponding to the source LUN; the difference bitmap indicates the data that has changed in the source LUN from the time when the replication of the data in the storage space corresponding to the source LUN was determined to be enabled last time to the time when the replication of the data in the storage space corresponding to the source LUN is determined to be enabled this time;
[0120] The second replication module 403 is used to replicate the data in the storage space corresponding to the source LUN to the target LUN in full when it is determined based on the current replica LUN list that there is currently no replica LUN that has completed data replication, or the status of the difference bitmap corresponding to the source LUN is invalid; wherein, when it is determined that there is currently no replica LUN that has completed data replication, the status of the difference bitmap corresponding to the source LUN is modified from a valid state to an invalid state.
[0121] As an embodiment, after obtaining a copy LUN in the active state from the current copy LUN list corresponding to the source LUN as the target LUN to which the data is copied, the device further includes:
[0122] A modification module is used for modifying the timestamp value corresponding to the target LUN in the current copy LUN list from the non-specified value to the specified value if the timestamp value corresponding to the target LUN in the current copy LUN list is a non-specified value; and for continuing to maintain the timestamp value corresponding to the target LUN as the specified value if the timestamp value corresponding to the target LUN in the current copy LUN list is a specified value;
[0123] Among them, the timestamp value corresponding to any replica LUN in the current replica LUN list whose timestamp value is not a specified value is used to indicate the timestamp when data replication was last performed on the replica LUN; the timestamp value corresponding to any replica LUN in the current replica LUN list that is determined as a target LUN and whose timestamp value is a specified value is used to indicate that data replication is currently being performed on the replica LUN; the timestamp value corresponding to any replica LUN in the current replica LUN list that is not a target LUN and whose timestamp value is a specified value is used to indicate that data replication has never been performed on the replica LUN.
[0124] As an embodiment, determining that there is currently at least one replica LUN that has completed data replication based on the current replica LUN list includes: searching from the current replica LUN list whether there is at least one replica LUN whose timestamp value is a non-specified value; if so, determining that there is currently at least one replica LUN that has completed data replication; otherwise, determining that there is currently no replica LUN that has completed data replication.
[0125] As an embodiment, determining the replica LUN that has most recently completed data replication based on the current replica LUN list includes: obtaining a replica LUN whose timestamp value is a non-specified value and has the largest timestamp value from the current replica LUN list as the replica LUN that has most recently completed data replication.
[0126] As an embodiment, if the reference LUN and the target LUN are not the same LUN, the modification module is further used to: modify the available status of the reference LUN in the current copy LUN list to the standby copying status; if the available status of any copy LUN in the current copy LUN list is the standby copying status, it indicates that the data in the storage space corresponding to the copy LUN is currently being copied in full to the current target LUN, and the copy LUN currently does not allow any other data copying except copying the data in the corresponding storage space to the current target LUN.
[0127] As an embodiment, after all the data in the storage space corresponding to the reference LUN is copied to the target LUN, the modification module is further used to: change the available status of the reference LUN in the current copy LUN list from the standby copy status to the standby status; if the available status of any copy LUN in the current copy LUN list is the standby status, it indicates that data replication is not currently allowed for the copy LUN.
[0128] As an embodiment, after the data in the storage space corresponding to the source LUN is copied, the modification module is further used to:
[0129] If there are at least two replica LUNs in the current replica LUN list, the available state of the target LUN in the current replica LUN list is changed from the primary state to the backup state, and the timestamp value of the target LUN is changed according to the sum of the largest timestamp value in the current replica LUN list and the set value; and the available state of the replica LUN in the current replica LUN list whose available state is the backup state and whose timestamp value is the smallest is changed from the backup state to the primary state;
[0130] If only the target LUN exists in the current replica LUN list, the available state corresponding to the target LUN in the current replica LUN list continues to be maintained as the primary state.
[0131] As an embodiment, the device further comprises:
[0132] An adding module, configured to, upon receiving an adding instruction indicating to add at least one LUN to be added as a replica LUN corresponding to a source LUN, add, for each LUN to be added, the LUN to be added, the available status of the LUN to be added, and the timestamp value of the LUN to be added to a current replica LUN list;
[0133] Among them, if there is a replica LUN that meets the set conditions in the current replica LUN list, the available state of the LUN to be added is the standby state, and the timestamp value of the LUN to be added is the specified value; otherwise, the available state of the LUN to be added is the primary state, and the timestamp value of the LUN to be added is the specified value; the set condition is any one of the following conditions: the available state is the standby state and the timestamp value is the specified value, the timestamp value is a non-specified value and the timestamp value is the smallest, and the available state is the primary state.
[0134] As an embodiment, the device further comprises:
[0135] A removal module, configured to, upon receiving a removal instruction indicating removal of at least one replica LUN among the replica LUNs corresponding to the source LUN, wherein the removal instruction includes at least one LUN to be removed, remove the LUN to be removed from the current replica LUN list, as well as the available status and timestamp value of the LUN to be removed for each LUN to be removed;
[0136] If there are at least two replica LUNs in the current replica LUN list, and the available state of the LUN to be removed in the current replica LUN list is the master state, then the available state of the replica LUN in the current replica LUN list that is in the non-master state and has the smallest timestamp value is changed to the master state;
[0137] If there are at least two replica LUNs in the current replica LUN list, and the available status of the LUN to be removed in the current replica LUN list is in the standby replication status, then when the status of the difference bitmap corresponding to the source LUN is in the valid status, the status of the difference bitmap corresponding to the source LUN is modified from the valid status to the invalid status, and when the status of the difference bitmap corresponding to the source LUN is in the invalid status, the status of the difference bitmap corresponding to the source LUN is maintained unchanged; and, the replication relationship between the LUN to be removed and the current target LUN corresponding to the LUN to be removed is modified to a disabled replication relationship; if the replication relationship between any replica LUN in the current replica LUN list and any other replica LUN except the replica LUN is a disabled replication relationship, it indicates that the replica LUN is currently prohibited from copying data in the corresponding storage space to the other replica LUN.
[0138] As an embodiment, if the reference LUN and the target LUN are not the same LUN, the modification module is further used to:
[0139] If it is found that the replication relationship between the reference LUN and the target LUN is a disabled replication relationship, the state of the difference bitmap corresponding to the source LUN is changed from a valid state to an invalid state, and the data in the storage space corresponding to the source LUN is fully copied to the target LUN.
[0140] So far, completed Figure 4 Structural description of the device shown.
[0141] The implementation process of the functions and effects of each module in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, which will not be repeated here.
[0142] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present application scheme. A person of ordinary skill in the art can understand and implement it without paying creative labor.
[0143] See also Figure 5, is a schematic diagram of the hardware structure of an electronic device provided by an exemplary embodiment of the present application. The electronic device may include a processor 501, a communication interface 502, a computer-readable storage medium 503 and a communication bus 504. The processor 501, the communication interface 502 and the computer-readable storage medium 503 communicate with each other through the communication bus 504. Among them, computer program instructions are stored on the computer-readable storage medium 503; the processor 501 can execute the steps of the method described in the above embodiment by executing the computer program instructions stored on the computer-readable storage medium 503. The electronic device may also include other hardware according to the actual function of the electronic device, which will not be described in detail.
[0144] Correspondingly, an embodiment of the present application further provides a computer-readable storage medium, on which a number of computer program instructions are stored. When the computer program instructions are executed by a processor, the method disclosed in the above example of the present application can be implemented.
[0145] Exemplarily, the computer-readable storage medium may be any electronic, magnetic, optical or other physical storage device that may contain or store information, such as executable instructions, data, etc. For example, the computer-readable storage medium may be: RAM (Radom Access Memory), volatile memory, non-volatile memory, flash memory, storage drive (such as hard disk drive), solid state drive, any type of storage disk (such as optical disk, DVD, etc.), or similar storage medium, or a combination thereof. The processor and memory may be supplemented by or incorporated into a dedicated logic circuit.
[0146] The above are only preferred embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the scope of protection of the present application.
Claims
1. A data replication method, characterized in that: The method is applied to a storage device, wherein the storage device includes a source logical unit number LUN to be copied; the method includes: When determining to start a replication of data in the storage space corresponding to the source LUN, a replica LUN in the available state of the master state is obtained from the current replica LUN list corresponding to the source LUN as the target LUN to which the data is replicated this time; if the available state of any replica LUN in the current replica LUN list is the master state, it indicates that the replica LUN currently allows data replication; When the status of the difference bitmap corresponding to the source LUN is valid, and it is determined based on the current copy LUN list that there is at least one copy LUN that has completed data replication, the copy LUN that has completed the latest data replication is determined based on the current copy LUN list as a reference LUN, and it is checked whether the reference LUN and the target LUN are the same LUN. If so, the data in the storage space corresponding to the source LUN is incrementally copied to the target LUN based on the difference bitmap corresponding to the source LUN; otherwise, the data in the storage space corresponding to the reference LUN is fully copied to the target LUN, and the data in the storage space corresponding to the source LUN is incrementally copied to the target LUN based on the difference bitmap corresponding to the source LUN; the difference bitmap indicates the data changed from the time when the replication of the data in the storage space corresponding to the source LUN was determined to be started last time to the time when the replication of the data in the storage space corresponding to the source LUN is determined to be started this time; When it is determined based on the current copy LUN list that there is currently no copy LUN that has completed data replication, or the status of the difference bitmap corresponding to the source LUN is invalid, all the data in the storage space corresponding to the source LUN is copied to the target LUN; wherein, when it is determined that there is currently no copy LUN that has completed data replication, the status of the difference bitmap corresponding to the source LUN is modified from a valid state to an invalid state.
2. The method according to claim 1, characterized in that After obtaining a copy LUN in an available state and in a primary state from the current copy LUN list corresponding to the source LUN as a target LUN to which the data is copied, the method further includes: If the timestamp value corresponding to the target LUN in the current copy LUN list is a non-specified value, the timestamp value corresponding to the target LUN in the current copy LUN list is modified from the non-specified value to the specified value; if the timestamp value corresponding to the target LUN in the current copy LUN list is a specified value, the timestamp value corresponding to the target LUN continues to be maintained at the specified value; Among them, the timestamp value corresponding to any replica LUN in the current replica LUN list whose timestamp value is not a specified value is used to indicate the timestamp when data replication was last performed on the replica LUN; the timestamp value corresponding to any replica LUN in the current replica LUN list that is determined as a target LUN and whose timestamp value is a specified value is used to indicate that data replication is currently being performed on the replica LUN; the timestamp value corresponding to any replica LUN in the current replica LUN list that is not a target LUN and whose timestamp value is a specified value is used to indicate that data replication has never been performed on the replica LUN.
3. The method according to claim 2, characterized in that The step of determining, based on the current copy LUN list, that there is currently at least one copy LUN that has completed data replication comprises: Check from the current copy LUN list whether there is at least one copy LUN whose timestamp value is not the specified value. If so, determine that there is currently at least one copy LUN that has completed data replication. Otherwise, determine that there is currently no copy LUN that has completed data replication.
4. The method according to claim 2, characterized in that: Determining the replica LUN that has most recently completed data replication based on the current replica LUN list includes: A replica LUN whose timestamp value is not a specified value and has the largest timestamp value is obtained from the current replica LUN list as the replica LUN that has completed data replication most recently.
5. The method according to claim 2, characterized in that: If the reference LUN and the target LUN are not the same LUN, the method further includes: The available status of the reference LUN in the current copy LUN list is changed to the standby copying status; if the available status of any copy LUN in the current copy LUN list is the standby copying status, it indicates that the data in the storage space corresponding to the copy LUN is currently being copied in full to the current target LUN, and the copy LUN currently does not allow any other data copying except copying the data in the corresponding storage space to the current target LUN.
6. The method according to claim 5, characterized in that After all the data in the storage space corresponding to the reference LUN is copied to the target LUN, the method further includes: The availability status of the reference LUN in the current copy LUN list is changed from the standby copying status to the standby status; if the availability status of any copy LUN in the current copy LUN list is the standby status, it indicates that data replication is not currently allowed for the copy LUN.
7. The method according to claim 6, characterized in that After the data in the storage space corresponding to the source LUN is copied, the method further includes: If there are at least two replica LUNs in the current replica LUN list, the available state of the target LUN in the current replica LUN list is changed from the primary state to the standby state, and the timestamp value of the target LUN is changed according to the sum of the largest timestamp value in the current replica LUN list and the set value; and the available state of the replica LUN in the current replica LUN list whose available state is the standby state and whose timestamp value is the smallest is changed from the standby state to the primary state; If only the target LUN exists in the current replica LUN list, the available state corresponding to the target LUN in the current replica LUN list continues to be maintained as the primary state.
8. The method according to claim 6, characterized in that The method further comprises: When receiving an addition instruction indicating to add at least one LUN to be added as a replica LUN corresponding to the source LUN, for each LUN to be added, adding the LUN to be added, the available status of the LUN to be added, and the timestamp value of the LUN to be added to the current replica LUN list; Among them, if there is a replica LUN that meets the set conditions in the current replica LUN list, the available state of the LUN to be added is the standby state, and the timestamp value of the LUN to be added is the specified value; otherwise, the available state of the LUN to be added is the primary state, and the timestamp value of the LUN to be added is the specified value; the set conditions are any of the following conditions: the available state is the standby state and the timestamp value is the specified value, the timestamp value is a non-specified value and the timestamp value is the smallest, and the available state is the primary state.
9. The method according to claim 6, characterized in that The method further comprises: When a removal instruction indicating removal of at least one of the replica LUNs corresponding to the source LUN is received, the removal instruction includes at least one LUN to be removed, and for each LUN to be removed, the LUN to be removed, and the available status and timestamp value of the LUN to be removed are removed from the current replica LUN list; If there are at least two replica LUNs in the current replica LUN list, and the available state of the LUN to be removed in the current replica LUN list is the master state, then the available state of the replica LUN in the current replica LUN list that is in the non-master state and has the smallest timestamp value is changed to the master state; If there are at least two replica LUNs in the current replica LUN list, and the available status of the LUN to be removed in the current replica LUN list is in the standby replication status, then when the status of the difference bitmap corresponding to the source LUN is in the valid status, the status of the difference bitmap corresponding to the source LUN is modified from the valid status to the invalid status, and when the status of the difference bitmap corresponding to the source LUN is in the invalid status, the status of the difference bitmap corresponding to the source LUN is maintained unchanged; and, the replication relationship between the LUN to be removed and the current target LUN corresponding to the LUN to be removed is modified to a disabled replication relationship; if the replication relationship between any replica LUN in the current replica LUN list and any other replica LUN except the replica LUN is a disabled replication relationship, it indicates that the replica LUN is currently prohibited from copying data in the corresponding storage space to the other replica LUN.
10. The method according to claim 9, characterized in that If the reference LUN and the target LUN are not the same LUN, the method further includes: If it is found that the replication relationship between the reference LUN and the target LUN is a disabled replication relationship, the state of the difference bitmap corresponding to the source LUN is modified from a valid state to an invalid state, and all data in the storage space corresponding to the source LUN is copied to the target LUN.
11. A data replication device, characterized in that: The device is applied to a storage device, wherein the storage device includes a source logical unit number LUN to be copied; The device includes: An acquisition module is used to, when determining to start a replication of data in the storage space corresponding to the source LUN, obtain a replica LUN in the primary state from the current replica LUN list corresponding to the source LUN as the target LUN to which the data is replicated this time; if the available state of any replica LUN in the current replica LUN list is the primary state, it indicates that the replica LUN currently allows data replication; A first replication module is used for, when the state of the differential bitmap corresponding to the source LUN is a valid state and it is determined based on the current replica LUN list that there is currently at least one replica LUN that has completed data replication, to determine the latest replica LUN that has completed data replication based on the current replica LUN list as a reference LUN, and to check whether the reference LUN and the target LUN are the same LUN; if so, to incrementally replicate the data in the storage space corresponding to the source LUN to the target LUN based on the differential bitmap corresponding to the source LUN; otherwise, to fully replicate the data in the storage space corresponding to the reference LUN to the target LUN, and to incrementally replicate the data in the storage space corresponding to the source LUN to the target LUN based on the differential bitmap corresponding to the source LUN; the differential bitmap indicates the data of the source LUN that has changed from the time when the replication of the data in the storage space corresponding to the source LUN was determined to be started last time to the time when the replication of the data in the storage space corresponding to the source LUN is determined to be started this time; The second replication module is used to copy all the data in the storage space corresponding to the source LUN to the target LUN when it is determined based on the current replica LUN list that there is currently no replica LUN that has completed data replication, or the status of the difference bitmap corresponding to the source LUN is invalid; wherein, when it is determined that there is currently no replica LUN that has completed data replication, the status of the difference bitmap corresponding to the source LUN is modified from a valid state to an invalid state.
12. An electronic device, characterized in that: The electronic device includes: Processor; and A computer-readable storage medium, wherein computer program instructions are stored in the computer-readable storage medium, and when the computer program instructions are executed by the processor, the processor is caused to execute the steps in any one of the methods of claims 1 to 10.
Citation Information
Patent Citations
Data replication method, data replication device and storage device
CN104363977A
Data processing method and storage device
CN116339609A
Verification and restore of replicated data using a cloud storing chunks of data and a plurality of hashes
US10372554B1
Automated restart of asynchronous remote replication after failures
US12086036B1
Data replication method and storage system
US20160292250A1