Patent ID: 12216544

DESCRIPTION OF EMBODIMENTS

To make the objectives, technical solutions, and advantages of the embodiments of the present disclosure clearer, the following clearly describes the technical solutions in the embodiments of the present disclosure with reference to the accompanying drawings in the embodiments of the present disclosure. The described embodiments are some but not all of the embodiments of the present disclosure. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present disclosure without creative efforts shall fall within the protection scope of the present disclosure.

The embodiments of the present disclosure provide a data replication method, apparatus, and system. As shown inFIG.1, the data replication system includes a system host, a primary storage array, and a secondary storage array. The system host and the primary storage array establish a communications connection, and the primary storage array and the secondary storage array establish a communications connection. Data sent by the system host to the primary storage array is stored in a primary volume of a primary storage pool, and backup replication data of data in the primary volume is stored in a secondary volume of a secondary storage pool. The primary storage pool and the secondary storage pool are respectively provided with a snapshot volume of the primary volume and a snapshot volume of the secondary volume, which are respectively used to store snapshot data of the primary volume and the secondary volume. The primary storage array further includes a primary data storage controller that controls data stored in the primary storage pool, and the secondary storage array further includes a secondary data storage controller that controls data stored in the secondary storage pool.

Further, the data sent by the system host to the primary storage array is stored in the primary volume, and the primary data storage controller records storage information of the foregoing data that is located in the primary volume, such as a storage address of the foregoing data that is located in the primary volume and a data amount of the foregoing data. In addition, the primary data storage controller implements a preset data replication policy, and replicates the foregoing data from the primary storage pool to the secondary volume according to the storage data of the foregoing data that is located in the primary volume, where the storage information is recorded in the primary data storage controller. During a process of replication, snapshot data that is generated due to starting of a snapshot for the primary volume is stored in the snapshot volume of the primary volume. The secondary data storage controller records storage information that is in the secondary volume and is of data replicated from the primary storage pool to the secondary volume. During a process in which the secondary volume receives the data that is replicated from the primary storage pool to the secondary volume, snapshot data that is generated by starting a snapshot for the secondary volume is stored in the snapshot volume of the secondary volume.

Based on the foregoing content, the embodiments of the present disclosure provide a data replication method, apparatus, and system.

Method Embodiment 1

Method Embodiment 1 of the present disclosure provides a data replication method, of which a flowchart is shown inFIG.2. The method includes the following steps.

Step201: Obtain differential data information corresponding to differential data that differentiates a primary volume from a secondary volume, where the differential data information includes a storage address of the differential data that is located in the primary volume, and a differential data determining value of the differential data, where the differential data determining value includes a data amount of the differential data or a ratio of the differential data amount of the differential data to a bandwidth for replication between the primary volume and the secondary volume.

A primary data storage controller obtains, according to data information that is sent by a system host to the primary volume and recorded by the primary data storage controller and data information replicated from the primary volume to the secondary volume, the differential data information of the differential data differentiating the primary volume from the secondary volume. The foregoing differential data information includes the storage address of the differential data that is located in the primary volume and the differential data determining value of the differential data. The foregoing differential data determining value includes the data amount of the differential data. In addition, if the primary data storage controller records the bandwidth for replication between the primary volume and the secondary volume, with reference to the foregoing data amount of the differential data, time required for replicating the differential data from the primary volume to the secondary volume, that is, a ratio of the foregoing data amount of the differential data to the bandwidth for replication between the primary volume and the secondary volume, may be obtained. The ratio can also be used as the differential data determining value, and the foregoing bandwidth for replication is a communication bandwidth used when data is replicated between the primary volume and the secondary volume.

Step202Replicate the differential data from the primary volume to the secondary volume according to the storage address of the differential data that is located in the primary volume when the differential data determining value is not less than a preset threshold.

The preset threshold refers to a threshold corresponding to the differential data determining value in step201. That is, the foregoing preset threshold is a data amount if the data amount of the differential data is selected as the differential data determining value in step201, or the foregoing preset threshold is a ratio if the ratio of the differential data amount of the differential data to the bandwidth for replication between the primary volume and the secondary volume is selected as the differential data determining value in step201. After the primary data storage controller determines that the foregoing differential data determining value is greater than or equal to the foregoing preset threshold, the differential data is replicated from the primary volume to the secondary volume according to the storage address of the differential data that is located in the primary volume. During a process of replication, the primary data storage controller records the differential data information of the differential data replicated from the primary volume to the secondary volume. In addition, the primary data storage controller also records data information corresponding to the data sent by the system host to the primary volume if the system host sends data to the primary volume during the process of replication. The data information includes a data amount corresponding to the data sent by the system host to the primary volume during the process of replication and a storage location that is in the primary volume and is of the data sent by the system host to the primary volume such that during the process of replication, the primary data storage controller can update the differential data information of the differential data differentiating the primary volume from the secondary volume.

Step203Take a snapshot for the primary volume and replicate the differential data to the secondary volume according to the snapshot when the differential data determining value is less than the preset threshold.

After the primary data storage controller determines that the foregoing differential data determining value is less than the foregoing preset threshold, a snapshot is taken for the foregoing primary volume, where the foregoing snapshot may be a COW snapshot or a split-mirror snapshot, and the differential data is replicated to secondary volume according to the snapshot.

A process of taking a COW snapshot for the primary volume is as follows. A mapping table and a resource volume are established in a snapshot volume of the primary volume when a COW snapshot is established, and a pointer recorded in the mapping table points to a data block in the primary volume, where the pointer recorded in the mapping table includes a pointer that points to the differential data. During existence of the COW snapshot, original primary volume data stored in storage space that is allocated to the foregoing data and is in the primary volume is replicated to the resource volume if the system host sends data to the primary volume, and then the foregoing data is stored into the storage space allocated in the primary volume. In addition, a pointer that is recorded in the mapping table and points to the original primary volume data stored in the primary volume is changed to point to original primary volume data that is replicated to the resource volume for storage. During the existence of the COW snapshot, regardless of whether there is data stored, during the process of replication, into storage space that stores the differential data and is in the primary volume, it can be ensured that the pointer that is recorded in the mapping table and points to the differential data points to differential data to which the pointer points when the COW snapshot is established, and the differential data is replicated to the secondary volume using the pointer that is recorded in the mapping table and points to the differential data. When differential data existing when the COW snapshot is established is all replicated from the primary volume to the secondary volume, the COW snapshot is canceled.

Taking a split-mirror snapshot for the primary volume is as follows. Primary volume data is replicated to the snapshot volume of the primary volume when a split-mirror snapshot is established. Then the differential data that differentiates the primary volume from the secondary volume is converted into differential data that differentiates the snapshot volume of the primary volume from the secondary volume, and the differential data that differentiates the snapshot volume of the primary volume from the secondary volume is replicated from the snapshot volume of the primary volume to the secondary volume. During existence of the split-mirror snapshot, the foregoing data is directly stored in the primary volume if the system host sends data to the primary volume, and the split-mirror snapshot is canceled when differential data existing when the split-mirror snapshot is established is all replicated from the snapshot volume of the primary volume to the secondary volume.

In this method embodiment, a primary data storage controller directly replicates differential data from a primary volume to a secondary volume when a differential data determining value is greater than or equal to a preset threshold, thereby greatly reducing a quantity of times of starting a snapshot for the primary volume, and diminishing impact caused by frequently starting a snapshot on performance of a system host and a primary storage array.

Method Embodiment 2

In Method Embodiment 2 of the present disclosure, based on Method Embodiment 1 of the present disclosure, before the differential data determining value is compared with the preset threshold, that is, before it is determined in step202that the differential data determining value is greater than or equal to the preset threshold or it is determined in step203that the differential data determining value is less than the preset threshold, a snapshot is taken for the secondary volume, where the foregoing snapshot may be a COW snapshot or a split-mirror snapshot. After differential data existing when the snapshot for the primary volume is started is all replicated to the secondary volume, that is, after the differential data is replicated to the secondary volume according to the snapshot in step203, a snapshot for the secondary volume is canceled.

In this method embodiment, before differential data is replicated from a primary volume to a secondary volume, a snapshot is taken for the secondary volume, and a snapshot for the secondary volume is canceled after the differential data existing when a snapshot for the primary volume is started is all replicated to the secondary volume, thereby ensuring that during a process in which the secondary volume receives the differential data, data in the secondary volume may be rolled back to a state at a moment when the snapshot for the secondary volume is started.

Method Embodiment 3

In Method Embodiment 3 of the present disclosure, based on Method Embodiment 1, replicating the differential data from the primary volume to the secondary volume according to the storage address of the differential data that is located in the primary volume in step202in Method Embodiment 1 further includes performing each round of differential data replication according to a sequence in which a data replication pointer points to from a start address in the primary volume to an end address in the primary volume. As shown inFIG.3A, the data replication pointer runs according to a sequence from A1to A5and points to an address of differential data currently being replicated, and the differential data is replicated from the primary volume to the secondary volume according to a storage address of the differential data that is located in the primary volume.

Within a period when the differential data is replicated from the primary volume to the secondary volume, the system host sends data to the primary volume. If a storage address of the data sent by the system host that is located in the primary volume is located after an address to which the data replication pointer currently points, that is, as shown inFIG.3A, the data sent by the system host is stored in a location of A4in the primary volume and the data replication pointer currently points to a location of A3, the foregoing data sent by the system host is replicated in a current round of replication. If the storage address of the data sent by the system host that is located in the primary volume is located before the address to which the data replication pointer currently points, that is, as shown inFIG.3B, the data sent by the system host is stored in a location of A2in the primary volume and the data replication pointer currently points to the location of A3, the foregoing data sent by the system host is not replicated in the current round of replication. After being stored at the location of A2, the foregoing data sent by the system host is replicated to the secondary volume during a process of a next round of differential data replication.

Device Embodiment 1 of the present disclosure provides a primary data storage controller, and as shown inFIG.4, the primary data storage controller at least includes a processor401, a memory402, a communications interface403, and a bus404, where the processor401, the memory402, and the communications interface403communicate using the bus404.

The memory402is configured to store a program. Further, the program may include program code, where the program code includes a computer operation instruction. The memory402may be a high-speed random access memory (RAM) memory, or may be a non-volatile memory, such as at least one disk storage.

The processor401is configured to execute the operation instruction stored in the memory402, and may be a single-core or a multi-core central processing unit (CPU), an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement this embodiment of the present disclosure.

The communications interface403is configured to communicate with a primary storage pool and a secondary storage pool, where the primary storage pool includes a primary volume and the secondary storage pool includes a secondary volume.

The processor401runs the program, to execute any one of the foregoing Method Embodiment 1, Method Embodiment 2, and Method Embodiment 3 when the controller runs.

Corresponding to the foregoing method embodiments of the present disclosure, Apparatus Embodiment 2 of the present disclosure provides a data replication control apparatus, and as shown inFIG.5, the apparatus includes a differential data information acquiring module501configured to obtain differential data information corresponding to differential data that differentiates a primary volume from a secondary volume, where the differential data information includes a storage address of the differential data that is located in the primary volume, and a differential data determining value of the differential data, where the differential data determining value includes a data amount of the differential data or a ratio of the data amount of the differential data to a bandwidth for replication between the primary volume and the secondary volume, a data replication module502configured to replicate the differential data from the primary volume to the secondary volume according to the storage address of the differential data that is located in the primary volume when the differential data determining value is not less than a preset threshold, and a snapshot replication module503configured to take a snapshot for the primary volume and replicate the differential data to the secondary volume using the snapshot when the differential data determining value is less than the preset threshold.

The present disclosure further provides an embodiment of a data replication system as shown inFIG.6, and the system includes a primary data storage controller601, a primary storage pool602, and a secondary storage pool603that are provided in the foregoing apparatus embodiment, where the primary storage pool602includes a primary volume6021and the secondary storage pool603includes a secondary volume6031. The primary data storage controller601establishes communication with the primary storage pool602, and the primary storage pool602establishes communication with the secondary storage pool603.

An embodiment of the present disclosure further provides a computer-readable medium, including a computer operation instruction, where the computer operation instruction is configured to execute the methods described in any one of method embodiments of the present disclosure by a controller.

It should be noted that, for ease of description, the foregoing method embodiments are described as a series of action combinations. However, a person skilled in the art should understand that the present disclosure is not limited to the described sequence of the actions, because some steps may be performed in another sequence or performed at the same time according to the present disclosure. In addition, a person skilled in the art should also understand that all the embodiments described in this specification belong to exemplary embodiments, and the involved actions and modules are not necessarily mandatory to the present disclosure.

In the foregoing embodiments, the description of each embodiment has respective focuses. For a part that is not described in detail in an embodiment, reference may be made to related descriptions in other embodiments.

With descriptions of the foregoing embodiments, a person skilled in the art may clearly understand that the present disclosure may be implemented by hardware, firmware or a combination thereof. When the present disclosure is implemented by software, the foregoing functions may be stored in a computer-readable medium or transmitted as one or more instructions or code in the computer-readable medium. The computer-readable medium includes a computer storage medium and a communications medium, where the communications medium includes any medium that enables a computer program to be transmitted from one place to another. The storage medium may be any available medium accessible to a computer. The following provides an example but does not impose a limitation. The computer-readable medium may include a RAM, a read-only memory (ROM), an electrically erasable programmable ROM (EEPROM), a compact disc-ROM (CD-ROM), or another optical disc storage or a disk storage medium, or another magnetic storage device, or any other medium that can carry or store expected program code in a form of an instruction or a data structure and can be accessed by a computer. In addition, any connection may be appropriately defined as a computer-readable medium. For example, if software is transmitted from a web site, a server or another remote source using a coaxial cable, an optical fiber/cable, a twisted pair, a digital subscriber line (DSL) or wireless technologies such as infrared ray, radio and microwave, the coaxial cable, optical fiber/cable, twisted pair, DSL or wireless technologies such as infrared ray, radio and microwave are included in fixation of a medium to which they belong. For example, a disk and a disc used by the present disclosure includes a compact disc (CD), a laser disc, an optical disc, a digital versatile disc (DVD), a floppy disk and a BLU-RAY DISC, where the disk generally copies data by a magnetic means, and the disc copies data optically by a laser means. The foregoing combination should also be included in the protection scope of the computer-readable medium.

Finally, it should be noted that the foregoing embodiments are merely intended for describing the technical solutions of the present disclosure but not for limiting the present disclosure. Although the present disclosure is described in detail with reference to the foregoing embodiments, persons of ordinary skill in the art should understand that they may still make modifications to the technical solutions described in the foregoing embodiments or make equivalent replacements to some technical features thereof, without departing from the spirit and scope of the technical solutions of the embodiments of the present disclosure.