Data protection method and device, computer equipment and storage medium
By virtualizing the volumes of multiple storage clusters as disk mirroring devices on the host side and saving metadata in each sub-device, data protection and business continuity of heterogeneous storage systems are achieved, and complex design and business in the prior art are solved. The problem of interruption improves data reliability.
Patent Information
- Application Number
- CN202411034304.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-30
- Publication Date
- 2024-11-08
AI Technical Summary
The existing technology cannot realize data disaster recovery and backup in heterogeneous storage systems, and the design is complex and the operation and maintenance costs are high. Remote replication technology can only ensure data security after a single-ended failure of the storage system and cannot guarantee business continuity.
Real-time consistency of data is achieved by virtualizing the volumes of multiple storage clusters into a disk mirroring device on the host side and saving metadata in each sub-device. When any storage cluster or storage volume fails, it automatically switches to Other sub-device provide services to ensure data loss and business continuity.
It reduces design complexity, is compatible with heterogeneous storage systems, improves data reliability and business continuity, and solves the problems of data protection and business interruption in heterogeneous storage systems.
Smart Images

Figure CN118915971A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of storage disaster recovery, and in particular to a data protection method, device, computer equipment and storage medium. Background Art
[0002] In order to solve the single point failure problem of a single storage system and realize data disaster recovery protection function, most of the existing technologies provide remote replication technology based on two storage systems. When the back-end storage is a heterogeneous storage system, such as the storage devices of storage vendor A and storage vendor B, the data disaster recovery backup function cannot be realized. At the same time, the remote replication technology requires data synchronization and backup between the two storage systems. On the one hand, it is necessary to add additional links to synchronize data. On the other hand, under normal circumstances, the backup storage does not provide services. When the primary storage fails, manual intervention is required to enable the backup storage. In summary, the existing technology has the following problems:
[0003] (1) Most existing technologies require that the backend storage be from the same storage vendor and support remote replication. If the backend storage is composed of two heterogeneous storage systems or does not support remote replication, data disaster recovery and backup cannot be achieved.
[0004] (2) The back-end storage needs to support the remote replication function, which requires additional data replication links, resulting in complex design and high operation and maintenance costs.
[0005] (3) Storage remote replication technology can only maintain data security after a single-end failure of the storage system, but cannot guarantee business continuity on the host side using the storage.
[0006] Therefore, there is an urgent need to propose a data protection method, device, computer equipment and storage medium that can solve the problems of complex solution design, business interruption during fault switching, and incompatibility with heterogeneous storage systems in the existing technology. Summary of the invention
[0007] Based on this, it is necessary to provide a data protection method, device, computer equipment and storage medium to address the above technical problems, which can solve the problems of complex solution design, business interruption during fault switching, and incompatibility with heterogeneous storage systems in the prior art.
[0008] In a first aspect, a data protection method is provided, the method comprising:
[0009] Based on multiple storage clusters, corresponding volumes are created respectively, and the volumes corresponding to the multiple storage clusters are mapped to the host side;
[0010] Scan and obtain unique device identifiers of volumes corresponding to the multiple storage clusters;
[0011] According to the unique device identifier, virtualizing the volumes corresponding to the multiple storage clusters into a disk mirror device, wherein the disk mirror device includes multiple sub-devices;
[0012] In response to detecting that the disk mirror device has been virtualized, writing the data to be stored into a sub-device of the disk mirror device, and providing real-time storage services based on the first target sub-device;
[0013] In response to detecting that the first target sub-device for providing storage services in real time fails, the first target sub-device is switched to a second target sub-device, and storage services are provided based on the second target sub-device.
[0014] Optionally, based on multiple storage clusters, respectively creating corresponding volumes, and mapping the volumes corresponding to the multiple storage clusters to the host side includes:
[0015] Based on the multiple storage clusters, corresponding volumes are created respectively, wherein the volumes corresponding to each storage cluster are of equal size;
[0016] Based on the target mapping method, the volumes corresponding to each storage cluster are mapped to the host side.
[0017] Optionally, scanning and obtaining unique device identifiers of volumes corresponding to the multiple storage clusters includes:
[0018] In response to detecting the mapping information of the volume, respectively acquiring a block device of each volume and a unique device identifier corresponding thereto;
[0019] The unique device identifier of the block device is defined as a unique device identifier of a volume of the corresponding storage cluster.
[0020] Optionally, virtualizing the volumes corresponding to the multiple storage clusters into disk mirror devices according to the unique device identifier includes:
[0021] Get the block devices and unique device identifiers corresponding to multiple volumes;
[0022] Based on unique device identifiers corresponding to the multiple block devices, virtualize the multiple block devices to generate the disk image device;
[0023] In response to detecting that the disk mirror device has been virtualized, setting a unique identifier for the disk mirror device and defining each block device as a sub-device of the disk mirror device;
[0024] Start the disk image device daemon;
[0025] Dividing a disk space of a preset size in each sub-device of the disk mirroring device;
[0026] Based on the disk mirroring device daemon, metadata information is saved in the disk space of the sub-devices of the disk mirroring device, wherein the metadata information at least includes a unique identifier of the disk mirroring device, a unique device identifier of each sub-device, and bitmap information of a data block size specified by the disk mirroring device, wherein the data bitmap information has a one-to-one mapping relationship with the data block size specified by the disk mirroring device.
[0027] Optionally, in response to detecting that the disk mirror device has been virtualized, writing the data to be stored into a sub-device of the disk mirror device, and providing a real-time storage service based on the first target sub-device includes:
[0028] In response to detecting that the disk mirror device has been virtualized and the disk mirror device daemon process has been started, setting a bitmap bit of a data block corresponding to each sub-device to 1 based on the disk mirror device daemon process;
[0029] In response to detecting that the bitmap bit of the data block corresponding to each sub-device has been set to 1, starting a sub-device data synchronization process based on the disk mirroring device daemon process;
[0030] In response to detecting that the sub-device data synchronization process has been started, synchronously writing the data to be stored into each sub-device of the disk mirroring device;
[0031] In response to detecting that the data to be stored has been written, setting the bitmap bit of the data block corresponding to each sub-device to 0;
[0032] In response to detecting a data read request, selecting a target sub-device in the disk mirroring device based on the data read request;
[0033] The target sub-device is defined as the first target sub-device, and a real-time storage service is provided based on the first target sub-device.
[0034] Optionally, in response to detecting that the first target sub-device for providing real-time storage services fails, switching the first target sub-device to a second target sub-device, and providing storage services based on the second target sub-device includes:
[0035] In response to detecting that a link to the first target sub-device for providing storage services in real time is interrupted, determining that a failure occurs in the first target sub-device;
[0036] In response to detecting that the first target sub-device has a fault, setting the disk mirror device corresponding to the first target sub-device to a degraded state based on the disk mirror device daemon process, and isolating the first target sub-device;
[0037] Selecting other target sub-devices in the disk mirroring device except the first target sub-device, and defining them as second target sub-devices;
[0038] The user service is switched to the second target sub-device based on the disk mirroring device daemon process to provide storage services.
[0039] Optionally, in response to detecting that the failure of the first target sub-device has been repaired, the method further includes:
[0040] In response to detecting that the failure of the first target sub-device has been repaired, re-adding the first target sub-device to the disk mirroring device based on the disk mirroring device daemon process;
[0041] In response to detecting that the first target sub-device has been added to the disk mirroring device, based on the disk mirroring device daemon process, comparing metadata information of other sub-devices with metadata information of the first target sub-device to obtain difference data;
[0042] Synchronizing the difference data to the first target sub-device;
[0043] In response to detecting that the disk mirror device failure has been repaired, the data block with a bit position of 1 is synchronized to the sub-device of the disk mirror device based on the disk mirror device daemon.
[0044] In a second aspect, a data protection device is provided, the device comprising:
[0045] A creation module, used to create corresponding volumes based on multiple storage clusters, respectively, and map the volumes corresponding to the multiple storage clusters to the host side;
[0046] A scanning and obtaining module, used to scan and obtain unique device identifiers of volumes corresponding to the multiple storage clusters;
[0047] A virtualization module, configured to virtualize the volumes corresponding to the plurality of storage clusters into a disk mirror device according to the unique device identifier, wherein the disk mirror device includes a plurality of sub-devices;
[0048] A real-time storage service providing module, configured to write the data to be stored into a sub-device of the disk mirroring device when it is detected that the disk mirroring device has been virtualized, and provide a real-time storage service based on the first target sub-device;
[0049] The switching module is used to switch the first target sub-device to the second target sub-device when a failure is detected in the first target sub-device for providing storage services in real time, and provide storage services based on the second target sub-device.
[0050] In a third aspect, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the following steps are implemented:
[0051] Based on multiple storage clusters, corresponding volumes are created respectively, and the volumes corresponding to the multiple storage clusters are mapped to the host side;
[0052] Scan and obtain unique device identifiers of volumes corresponding to the multiple storage clusters;
[0053] According to the unique device identifier, virtualizing the volumes corresponding to the multiple storage clusters into a disk mirror device, wherein the disk mirror device includes multiple sub-devices;
[0054] In response to detecting that the disk mirror device has been virtualized, writing the data to be stored into a sub-device of the disk mirror device, and providing real-time storage services based on the first target sub-device;
[0055] In response to detecting that the first target sub-device for providing storage services in real time fails, the first target sub-device is switched to a second target sub-device, and storage services are provided based on the second target sub-device.
[0056] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0057] Based on multiple storage clusters, corresponding volumes are created respectively, and the volumes corresponding to the multiple storage clusters are mapped to the host side;
[0058] Scan and obtain unique device identifiers of volumes corresponding to the multiple storage clusters;
[0059] According to the unique device identifier, virtualizing the volumes corresponding to the multiple storage clusters into a disk mirror device, wherein the disk mirror device includes multiple sub-devices;
[0060] In response to detecting that the disk mirror device has been virtualized, writing the data to be stored into a sub-device of the disk mirror device, and providing real-time storage services based on the first target sub-device;
[0061] In response to detecting that the first target sub-device for providing storage services in real time fails, the first target sub-device is switched to a second target sub-device, and storage services are provided based on the second target sub-device.
[0062] In a fifth aspect, a computer program product is provided, the computer program product comprising a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0063] Based on multiple storage clusters, corresponding volumes are created respectively, and the volumes corresponding to the multiple storage clusters are mapped to the host side;
[0064] Scan and obtain unique device identifiers of volumes corresponding to the multiple storage clusters;
[0065] According to the unique device identifier, virtualizing the volumes corresponding to the multiple storage clusters into a disk mirror device, wherein the disk mirror device includes multiple sub-devices;
[0066] In response to detecting that the disk mirror device has been virtualized, writing the data to be stored into a sub-device of the disk mirror device, and providing real-time storage services based on the first target sub-device;
[0067] In response to detecting that the first target sub-device for providing storage services in real time fails, the first target sub-device is switched to a second target sub-device, and storage services are provided based on the second target sub-device.
[0068] The above-mentioned data protection method, device, computer equipment and storage medium, the method includes: based on multiple storage clusters, respectively creating corresponding volumes, and mapping the volumes corresponding to the multiple storage clusters to the host side; scanning and obtaining the unique device identifiers of the volumes corresponding to the multiple storage clusters; virtualizing the volumes corresponding to the multiple storage clusters into disk mirror devices according to the unique device identifiers, and the disk mirror device includes multiple sub-devices; in response to detecting that the disk mirror device has been virtualized, writing the data to be stored into the sub-device of the disk mirror device, and providing real-time storage services based on the first target sub-device; in response to detecting that the first target sub-device used to provide real-time storage services has a failure, switching the first target sub-device to the second target sub-device, and providing storage services based on the second target sub-device. The present application realizes data protection function by composing a mappable block device into a disk mirror device with redundant function on the host side, reduces design complexity, is compatible with heterogeneous storage systems, and effectively improves data reliability and business continuity. BRIEF DESCRIPTION OF THE DRAWINGS
[0069] Figure 1 is an application environment diagram of a data protection method in an embodiment;
[0070] Figure 2 is a flow chart of a data protection method in one embodiment;
[0071] Figure 3 A schematic diagram of the structure of a data protection module of a data protection method in an embodiment;
[0072] Figure 4 A schematic diagram of the distribution of disks in a disk mirroring device of a data protection method in an embodiment;
[0073] Figure 5 is a structural block diagram of a data protection device in one embodiment;
[0074] Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0075] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0076] It should be understood that in the description of the present application, unless the context clearly requires otherwise, words such as "include", "comprises", and the like throughout the specification should be interpreted as including rather than being exclusive or exhaustive; that is, as including but not limited to.
[0077] It should also be understood that the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. In addition, in the description of this application, unless otherwise specified, "plurality" means two or more.
[0078] It should be noted that the terms "S1", "S2", etc. are only used for the purpose of describing the steps, and do not specifically refer to the order or sequence, nor are they used to limit the present application. They are only for the convenience of describing the method of the present application, and cannot be understood as indicating the order of the steps. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in this field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection required by the present application.
[0079] With the development of information technology, data has gradually become an important asset of enterprises. At present, most enterprises use SAN (Storage Area Network) storage as the storage backend to access host services. The host accesses the storage system through optical fiber or Ethernet channels to provide high-performance I / O (basic input and output) and data storage capabilities. At the same time, since SAN storage is an external storage device, it is very easy to cause data loss and business interruption. Data protection strategies and disaster recovery backup technologies are particularly important. According to the background technology, the existing technology has the following problems:
[0080] (1) Most existing technologies require that the backend storage be from the same storage vendor and support remote replication. If the backend storage is composed of two heterogeneous storage systems or does not support remote replication, data disaster recovery and backup cannot be achieved.
[0081] (2) The back-end storage needs to support the remote replication function, which requires additional data replication links, resulting in complex design and high operation and maintenance costs.
[0082] (3) Storage remote replication technology can only maintain data security after a single-end failure of the storage system, but cannot guarantee business continuity on the host side using the storage.
[0083] In order to solve the above technical problems, the present application provides a data protection method, apparatus, computer equipment and storage medium. By adopting disk mirroring and virtualization technology, that is, virtualizing the corresponding devices of multiple storage cluster mapping volumes into a disk mirroring device on the host side, and storing the metadata of the disk mirroring device in each sub-device, when writing data to the disk mirroring device, the disk mirroring device daemon records the data changes of the sub-device through the metadata to ensure the real-time consistency of the data of each sub-device. When any storage cluster or storage volume fails, it can be guaranteed that data is not lost and business is not interrupted, so as to solve the problems of complex design of the existing technology, business interruption during fault switching, and incompatibility with heterogeneous storage systems.
[0084] The data protection method provided by this application can be applied to Figure 1 In the application environment shown, the terminal 102 communicates with the data processing platform set on the server 104 through the network, wherein the terminal 102 can be but not limited to various personal computers, laptops, smart phones, tablet computers and portable wearable devices, and the server 104 can be implemented by an independent server or a server cluster composed of multiple servers.
[0085] In one embodiment, Figure 2 As shown, a data protection method is provided, which is applied to Figure 1 The terminal in is used as an example to illustrate, including the following steps:
[0086] S1: Based on multiple storage clusters, corresponding volumes are created respectively, and the volumes corresponding to the multiple storage clusters are mapped to the host side.
[0087] It should be noted that cluster storage refers to a system that centrally manages storage resources. It forms a cluster by logically grouping multiple physical machines or servers together to achieve efficient data storage and management. This system is usually used for enterprise data storage and requires a shared storage system, such as a storage area network (SAN), or a method of directly connecting to each node and replicating data in the storage system; volume refers to a storage volume, which is a logical container or partition used to store data in a computer system; host side refers to Figure 3 The application host shown in .
[0088] In some specific implementations, based on multiple storage clusters, creating corresponding volumes respectively, and mapping the volumes corresponding to the multiple storage clusters to the host side includes:
[0089] Based on the multiple storage clusters, corresponding volumes are created respectively, wherein the volumes corresponding to each storage cluster are of equal size. The number of storage clusters is generally two or more, and corresponding volumes are created for each cluster. For example, when there are two storage clusters, that is, Figure 3 The storage system A and storage system B shown in the figure create volume Lun1 in the first storage cluster A, and create volume Lun2 of the same size as Lun1 in the second storage cluster B. If there are multiple storage clusters, the method for creating volumes is the same as above, which will not be repeated here;
[0090] Based on the target mapping method, the volumes corresponding to each storage cluster are mapped to the host side respectively, wherein the mapping methods may include iSCSI (Internet Small Computer System Interface, also known as IP-SAN, which is a storage technology based on the Internet and SCSI-3 protocol), FC (Fibre Channel, which is a high-speed serial transmission bus protocol) or other SCSI-based mapping methods. The target mapping method can be selected from the above mapping methods according to the actual scenario requirements. The method of mapping volumes based on the target mapping method is a common method and will not be repeated here.
[0091] In the above implementation, by mapping volumes corresponding to multiple storage clusters to the host side, the data to be stored can be subsequently saved and synchronized to the disk mirroring device to achieve data protection.
[0092] S2: Scan and obtain unique device identifiers of volumes corresponding to the multiple storage clusters.
[0093] It should be noted that the unique device identifier of a volume refers to the unique device ID of the volume.
[0094] In some specific implementations, scanning and obtaining unique device identifiers of volumes corresponding to the multiple storage clusters includes:
[0095] In response to detecting the mapping information of the volume, based on the host side, logging the mapping information of the volume, that is, the host side discovers and logs the volume mapping information (referring to mounting a directory or file of the host machine to a specific path of the Docker container in a Docker environment to achieve sharing of data inside and outside the container);
[0096] Get the block device of each volume and its corresponding unique device identifier respectively, that is, after the host logs in, get the block devices of the corresponding tickets respectively, such as the block devices of volumes Lun1 and Lun2. The block devices of volumes refer to those devices that store and access data in blocks. These devices are usually used to store large amounts of data and can support high concurrent access. In computer storage systems, block devices can be single drive devices, such as sdb or sdc, or multipath devices with redundancy functions, such as mpathb or mpathc. When multipath devices are used, the devices have higher reliability and redundancy functions.
[0097] The unique device identifier of the block device is defined as the unique device identifier of the volume of the corresponding storage cluster, that is, the unique device IDs of the block devices corresponding to the first storage cluster and the second storage cluster are obtained, and defined as the unique device IDs of the volumes of the corresponding storage clusters.
[0098] In the above implementation, the number of sub-devices that need to be constructed is determined by obtaining a unique device ID to provide storage services.
[0099] S3: According to the unique device identifier, virtualize the volumes corresponding to the multiple storage clusters into a disk mirror device, where the disk mirror device includes multiple sub-devices.
[0100] It should be noted that virtualization technology is a technology that abstracts physical hardware resources into logical resources. Through virtualization technology, a physical server can be turned into multiple logically isolated virtual servers, thereby improving the efficiency of hardware resource utilization and management flexibility.
[0101] In some specific implementations, virtualizing the volumes corresponding to the multiple storage clusters into disk mirror devices according to the unique device identifier includes:
[0102] Get the block devices and unique device identifiers corresponding to multiple volumes;
[0103] Based on the unique device identifiers corresponding to the multiple block devices, the multiple block devices are virtualized to generate the disk image device, wherein the block device is the sub-device described below, that is, the multiple sub-devices corresponding to the unique device ID obtained in the above step are combined into a disk image device, and the disk image device is virtualized into one device;
[0104] In response to detecting that the disk mirror device has been virtualized, a unique identifier is set for the disk mirror device, and each block device is defined as a sub-device of the disk mirror device, that is, the disk mirror device also has a unique disk mirror device ID, and the disk mirror device may include multiple sub-devices, such as Figure 3 The number of sub-devices of sdb and sdc shown is the same as the number of clusters;
[0105] Start the disk image device daemon process, where the disk image device daemon process usually refers to a special process running in a computer system, whose main responsibility is to monitor and manage the disk image device. These processes run in the background and do not interact directly with the user, but are responsible for processing system-level tasks and services;
[0106] Divide a disk space of a preset size in each sub-device of the disk mirroring device, wherein the preset size can be set according to actual needs, such as 4M;
[0107] Based on the disk mirroring device daemon, metadata information is saved in the disk space of the sub-device of the disk mirroring device, wherein the metadata information at least includes a unique identifier of the disk mirroring device, a unique device identifier of each sub-device, bitmap information of a data block size corresponding to the disk mirroring device, and a peer device ID, etc., wherein the data bitmap information has a one-to-one mapping relationship with the data block size specified by the disk mirroring device, wherein the above-mentioned identifier refers to the ID, and the data block size can be set according to actual needs, such as Figure 4 The data blocks A1 and B1 shown are 32M in size, etc. Specifically, after the sub-devices form a disk mirroring device, the disk mirroring daemon saves the metadata information in each sub-device. The present application preferably distributes the metadata information in the first 4M disk space of each sub-device.
[0108] In the above implementation, for storage clusters or heterogeneous storage that do not support remote replication, disk mirroring and virtualization technology are used to virtualize the corresponding devices of multiple storage cluster mapping volumes into a disk mirroring device on the host side, that is, block devices are combined into a disk mirroring device with redundant functions on the host side, which reduces the design complexity and effectively makes it compatible with heterogeneous storage systems, thereby realizing data protection functions.
[0109] S4: In response to detecting that the disk mirror device has been virtualized, writing the data to be stored into a sub-device of the disk mirror device, and providing a real-time storage service based on the first target sub-device.
[0110] It should be noted that, because the data in the initial sub-device is completely consistent, the first target sub-device can refer to any sub-device in the disk mirroring device.
[0111] In some specific implementations, in response to detecting that the disk mirror device has been virtualized, writing the data to be stored into a sub-device of the disk mirror device, and providing real-time storage services based on the first target sub-device includes:
[0112] In response to detecting that the disk mirror device has been virtualized and the disk mirror device daemon process has been started, the bitmap bit of the data block corresponding to each sub-device is set to 1 based on the disk mirror device daemon process, that is, before writing data, the bitmap bit of the data block corresponding to each sub-device is set to 1;
[0113] In response to detecting that the bitmap bit of the data block corresponding to each sub-device has been set to 1, starting a sub-device data synchronization process based on the disk mirroring device daemon process;
[0114] In response to detecting that the sub-device data synchronization process has been started, synchronously writing the data to be stored into each sub-device of the disk mirroring device, that is, synchronously writing the data to be stored into each sub-device of the disk mirroring device at the same time, so that the data in each sub-device is completely consistent;
[0115] In response to detecting that the data to be stored has been written, the bitmap bit of the data block corresponding to each sub-device is set to 0, that is, after writing the data, the bitmap bit of the data block corresponding to each sub-device is set to 0, and at the same time, the metadata change information is recorded;
[0116] In response to detecting a data read request, based on the data read request, a target sub-device in the disk mirror device is selected, that is, when it is necessary to read the stored data in the disk mirror device, since the data of any sub-device of the disk mirror device is consistent, the disk mirror device daemon process can randomly select any sub-device as the target sub-device;
[0117] The target sub-device is defined as the first target sub-device, and real-time storage services are provided based on the first target sub-device, that is, data storage services are provided through the first target sub-device according to user business needs.
[0118] In the above implementation, by synchronously writing the initial data, the data in each sub-device is made completely consistent, and then any sub-device of the disk mirroring device can be selected as the first target sub-device to provide real-time data storage services, thereby achieving effective data protection.
[0119] S5: In response to detecting that the first target sub-device for providing storage services in real time fails, the first target sub-device is switched to a second target sub-device, and storage services are provided based on the second target sub-device.
[0120] It should be noted that the second target sub-device may be any other target sub-device in the disk mirroring device except the first target sub-device, or other target sub-devices may be selected according to corresponding selection rules.
[0121] In some specific implementations, in response to detecting that the first target sub-device for providing storage services in real time fails, switching the first target sub-device to a second target sub-device, and providing storage services based on the second target sub-device includes:
[0122] In response to detecting that the link of the first target sub-device used to provide storage services in real time is interrupted, determining that the first target sub-device fails, wherein if the sub-device fails, the sub-device link will be interrupted and data cannot be written or read, therefore, when the link interruption is detected, determining that the first target sub-device fails;
[0123] In response to detecting that the first target sub-device has a fault, setting the disk mirror device corresponding to the first target sub-device to a degraded state based on the disk mirror device daemon process, and isolating the first target sub-device;
[0124] Selecting other target sub-devices in the disk mirroring device except the first target sub-device, and defining them as second target sub-devices, wherein, as described above, the second target sub-device may be any other target sub-device in the disk mirroring device except the first target sub-device, or may be other target sub-devices selected according to corresponding selection rules;
[0125] The user service is switched to the second target sub-device based on the disk mirroring device daemon process to continue providing storage services.
[0126] In some specific implementations, other target sub-devices are selected according to corresponding selection rules, and the selection rules include:
[0127] Get the number of sub-devices in the disk image device;
[0128] In response to detecting that the number of sub-devices in the disk mirror device is less than or equal to a first preset threshold, directly selecting other target sub-devices except the first target sub-device as the second target sub-device, wherein the first preset threshold can be set according to actual needs, such as 5, that is, when the number of sub-devices is less than or equal to 5, when the first target sub-device fails, directly selecting any device from the other four sub-devices as the second target sub-device to continue to provide storage services;
[0129] In response to detecting that the number of sub-devices in the disk mirroring device is greater than a first preset threshold, obtaining the number of failed sub-devices in the disk mirroring device and the failure rate of the disk mirroring device, wherein the failure rate of the disk mirroring device refers to the sum of probabilities of failure of its sub-devices within a period of time (which can be set according to actual needs, such as 3 days, etc.);
[0130] In response to detecting that the number of the faulty sub-devices is greater than the second preset threshold and the failure rate is greater than the third preset threshold, the failure rates of the sub-devices in the disk mirroring device are sorted in ascending order, wherein the second preset threshold and the third preset threshold can be set according to actual needs, such as the second preset threshold is 3, the third preset threshold is 10%, etc.;
[0131] Based on the sorting order, in ascending order, corresponding sub-devices are selected as second target sub-devices to continue providing storage services;
[0132] In response to detecting that the number of faulty sub-devices is less than or equal to a second preset threshold, and / or the failure rate is less than or equal to a third preset threshold, when a failure occurs, any device is directly selected from other sub-devices except the first target sub-device as the second target sub-device to continue providing storage services.
[0133] In the above implementation, the second target sub-device is determined in different ways to avoid continuous failure of the switched sub-devices in the disk mirroring device, thereby improving the consistency and reliability of the data storage service.
[0134] In some specific implementations, in response to detecting that the failure of the first target sub-device has been repaired, the method further includes:
[0135] In response to detecting that the failure of the first target sub-device has been repaired, re-adding the first target sub-device to the disk mirroring device based on the disk mirroring device daemon, that is, when the failure of the sub-device has been repaired, the disk mirroring device daemon detects that the member disk has been repaired and re-adds the sub-device to the disk mirroring device;
[0136] In response to detecting that the first target sub-device has been added to the disk mirroring device, based on the disk mirroring device daemon process, the metadata information of other sub-devices is compared with the metadata information of the first target sub-device to obtain difference data, and the difference data is synchronized to the first target sub-device, that is, the metadata information of other sub-devices is compared with the sub-device recovered from the failure to determine the difference data, and the difference data is synchronized to the sub-device recovered from the failure to ensure the real-time consistency of the disk mirroring device data;
[0137] Among them, in response to detecting that the disk mirroring device failure has been repaired, the data block with a bit position of 1 is synchronized to the sub-device of the disk mirroring device based on the disk mirroring device guardian. Specifically, if the disk mirroring device fails, that is, if the disk mirroring device fails or the host loses power when data is written, the bit corresponding to the data block is 1. After the disk mirroring device failure is restored, it is only necessary to synchronize the data block corresponding to the bit position of 1, and there is no need to synchronize the data on the entire disk.
[0138] In the above implementation, when the disk mirror device writes data, the disk mirror device daemon records the data changes of the sub-device through metadata to ensure the real-time consistency of the data of each sub-device. When any storage cluster or storage volume fails, by switching the corresponding sub-device, it can be ensured that data is not lost and business is not interrupted, effectively improving data reliability and business continuity.
[0139] In the above data protection method, the method includes: based on multiple storage clusters, respectively creating corresponding volumes, and mapping the volumes corresponding to the multiple storage clusters to the host side; scanning and obtaining unique device identifiers of the volumes corresponding to the multiple storage clusters; virtualizing the volumes corresponding to the multiple storage clusters into disk mirror devices according to the unique device identifiers, wherein the disk mirror device includes multiple sub-devices; in response to detecting that the disk mirror device has been virtualized, writing the data to be stored into the sub-device of the disk mirror device, and providing real-time storage services based on the first target sub-device; in response to detecting that the first target sub-device for providing real-time storage services has been sent When a failure occurs, the first target sub-device is switched to the second target sub-device, and storage services are provided based on the second target sub-device. The present application virtualizes the corresponding devices of multiple storage cluster mapping volumes into a disk mirror device on the host side, and saves the metadata of the disk mirror device in each sub-device. When data is written to the disk mirror device, the disk mirror device daemon records the data changes of the sub-device through the metadata to ensure the real-time consistency of the data of each sub-device. When any storage cluster or storage volume fails, data loss and business interruption can be guaranteed, which solves the problems of complex design of the prior art, business interruption during fault switching, and incompatibility with heterogeneous storage systems.
[0140] It should be understood that although Figure 2 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0141] In one embodiment, Figure 5 As shown, a data protection device is provided, including: a creation module, a scanning and acquisition module, a virtualization module, a real-time storage service providing module and a switching module, wherein:
[0142] A creation module, used to create corresponding volumes based on multiple storage clusters, respectively, and map the volumes corresponding to the multiple storage clusters to the host side;
[0143] A scanning and obtaining module, used to scan and obtain unique device identifiers of volumes corresponding to the multiple storage clusters;
[0144] A virtualization module, configured to virtualize the volumes corresponding to the plurality of storage clusters into a disk mirror device according to the unique device identifier, wherein the disk mirror device includes a plurality of sub-devices;
[0145] A real-time storage service providing module, configured to write the data to be stored into a sub-device of the disk mirroring device when it is detected that the disk mirroring device has been virtualized, and provide a real-time storage service based on the first target sub-device;
[0146] The switching module is used to switch the first target sub-device to the second target sub-device when a failure is detected in the first target sub-device for providing storage services in real time, and provide storage services based on the second target sub-device.
[0147] As a preferred implementation, in the embodiment of the present invention, the scanning acquisition module is specifically used for:
[0148] Based on the multiple storage clusters, corresponding volumes are created respectively, wherein the volumes corresponding to each storage cluster are of equal size;
[0149] Based on the target mapping method, the volumes corresponding to each storage cluster are mapped to the host side.
[0150] As a preferred implementation, in the embodiment of the present invention, the creation module is specifically used for:
[0151] In response to detecting the mapping information of the volume, respectively acquiring a block device of each volume and a unique device identifier corresponding thereto;
[0152] The unique device identifier of the block device is defined as a unique device identifier of a volume of the corresponding storage cluster.
[0153] As a preferred implementation, in the embodiment of the present invention, the virtualization module is specifically used for:
[0154] Get the block devices and unique device identifiers corresponding to multiple volumes;
[0155] Based on unique device identifiers corresponding to the multiple block devices, virtualize the multiple block devices to generate the disk image device;
[0156] In response to detecting that the disk mirror device has been virtualized, setting a unique identifier for the disk mirror device and defining each block device as a sub-device of the disk mirror device;
[0157] Start the disk image device daemon;
[0158] Dividing a disk space of a preset size in each sub-device of the disk mirroring device;
[0159] Based on the disk mirroring device daemon, metadata information is saved in the disk space of the sub-devices of the disk mirroring device, wherein the metadata information at least includes a unique identifier of the disk mirroring device, a unique device identifier of each sub-device, and bitmap information of a data block size specified by the disk mirroring device, wherein the data bitmap information has a one-to-one mapping relationship with the data block size specified by the disk mirroring device.
[0160] As a preferred implementation mode, in the embodiment of the present invention, the real-time storage service providing module is specifically used for:
[0161] In response to detecting that the disk mirror device has been virtualized and the disk mirror device daemon process has been started, setting a bitmap bit of a data block corresponding to each sub-device to 1 based on the disk mirror device daemon process;
[0162] In response to detecting that the bitmap bit of the data block corresponding to each sub-device has been set to 1, starting a sub-device data synchronization process based on the disk mirroring device daemon process;
[0163] In response to detecting that the sub-device data synchronization process has been started, synchronously writing the data to be stored into each sub-device of the disk mirroring device;
[0164] In response to detecting that the data to be stored has been written, setting the bitmap bit of the data block corresponding to each sub-device to 0;
[0165] In response to detecting a data read request, selecting a target sub-device in the disk mirroring device based on the data read request;
[0166] The target sub-device is defined as the first target sub-device, and a real-time storage service is provided based on the first target sub-device.
[0167] As a preferred implementation, in the embodiment of the present invention, the switching module is specifically used for:
[0168] In response to detecting that a link to the first target sub-device for providing storage services in real time is interrupted, determining that a failure occurs in the first target sub-device;
[0169] In response to detecting that the first target sub-device has a fault, setting the disk mirror device corresponding to the first target sub-device to a degraded state based on the disk mirror device daemon process, and isolating the first target sub-device;
[0170] Selecting other target sub-devices in the disk mirroring device except the first target sub-device, and defining them as second target sub-devices;
[0171] The user service is switched to the second target sub-device based on the disk mirroring device daemon process to provide storage services.
[0172] As a preferred implementation, in the embodiment of the present invention, the device further includes a fault recovery module, and the fault recovery module is specifically used to:
[0173] In response to detecting that the failure of the first target sub-device has been repaired, re-adding the first target sub-device to the disk mirroring device based on the disk mirroring device daemon process;
[0174] In response to detecting that the first target sub-device has been added to the disk mirroring device, based on the disk mirroring device daemon process, comparing metadata information of other sub-devices with metadata information of the first target sub-device to obtain difference data;
[0175] Synchronizing the difference data to the first target sub-device;
[0176] In response to detecting that the disk mirror device failure has been repaired, the data block with a bit position of 1 is synchronized to the sub-device of the disk mirror device based on the disk mirror device daemon.
[0177] For the specific definition of the data protection device, please refer to the definition of the data protection method above, which will not be repeated here. Each module in the above data protection device can be implemented in whole or in part by software, hardware and a combination thereof. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0178] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 6 As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a data protection method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a key, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0179] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0180] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:
[0181] S1: Based on multiple storage clusters, corresponding volumes are created respectively, and the volumes corresponding to the multiple storage clusters are mapped to the host side;
[0182] S2: Scan and obtain unique device identifiers of volumes corresponding to the multiple storage clusters;
[0183] S3: virtualizing the volumes corresponding to the multiple storage clusters into a disk mirror device according to the unique device identifier, wherein the disk mirror device includes multiple sub-devices;
[0184] S4: in response to detecting that the disk mirror device has been virtualized, writing the data to be stored into a sub-device of the disk mirror device, and providing a real-time storage service based on the first target sub-device;
[0185] S5: In response to detecting that the first target sub-device for providing storage services in real time fails, the first target sub-device is switched to a second target sub-device, and storage services are provided based on the second target sub-device.
[0186] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0187] Based on the multiple storage clusters, corresponding volumes are created respectively, wherein the volumes corresponding to each storage cluster are of equal size;
[0188] Based on the target mapping method, the volumes corresponding to each storage cluster are mapped to the host side.
[0189] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0190] In response to detecting the mapping information of the volume, respectively acquiring a block device of each volume and a unique device identifier corresponding thereto;
[0191] The unique device identifier of the block device is defined as a unique device identifier of a volume of the corresponding storage cluster.
[0192] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0193] Get the block devices and unique device identifiers corresponding to multiple volumes;
[0194] Based on unique device identifiers corresponding to the multiple block devices, virtualize the multiple block devices to generate the disk image device;
[0195] In response to detecting that the disk mirror device has been virtualized, setting a unique identifier for the disk mirror device and defining each block device as a sub-device of the disk mirror device;
[0196] Start the disk image device daemon;
[0197] Dividing a disk space of a preset size in each sub-device of the disk mirroring device;
[0198] Based on the disk mirroring device daemon, metadata information is saved in the disk space of the sub-devices of the disk mirroring device, wherein the metadata information at least includes a unique identifier of the disk mirroring device, a unique device identifier of each sub-device, and bitmap information of a data block size specified by the disk mirroring device, wherein the data bitmap information has a one-to-one mapping relationship with the data block size specified by the disk mirroring device.
[0199] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0200] In response to detecting that the disk mirror device has been virtualized and the disk mirror device daemon process has been started, setting a bitmap bit of a data block corresponding to each sub-device to 1 based on the disk mirror device daemon process;
[0201] In response to detecting that the bitmap bit of the data block corresponding to each sub-device has been set to 1, starting a sub-device data synchronization process based on the disk mirroring device daemon process;
[0202] In response to detecting that the sub-device data synchronization process has been started, synchronously writing the data to be stored into each sub-device of the disk mirroring device;
[0203] In response to detecting that the data to be stored has been written, setting the bitmap bit of the data block corresponding to each sub-device to 0;
[0204] In response to detecting a data read request, selecting a target sub-device in the disk mirroring device based on the data read request;
[0205] The target sub-device is defined as the first target sub-device, and a real-time storage service is provided based on the first target sub-device.
[0206] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0207] In response to detecting that a link to the first target sub-device for providing storage services in real time is interrupted, determining that a failure occurs in the first target sub-device;
[0208] In response to detecting that the first target sub-device has a fault, setting the disk mirror device corresponding to the first target sub-device to a degraded state based on the disk mirror device daemon process, and isolating the first target sub-device;
[0209] Selecting other target sub-devices in the disk mirroring device except the first target sub-device, and defining them as second target sub-devices;
[0210] The user service is switched to the second target sub-device based on the disk mirroring device daemon process to provide storage services.
[0211] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0212] In response to detecting that the failure of the first target sub-device has been repaired, re-adding the first target sub-device to the disk mirroring device based on the disk mirroring device daemon process;
[0213] In response to detecting that the first target sub-device has been added to the disk mirroring device, based on the disk mirroring device daemon process, comparing metadata information of other sub-devices with metadata information of the first target sub-device to obtain difference data;
[0214] Synchronizing the difference data to the first target sub-device;
[0215] In response to detecting that the disk mirror device failure has been repaired, the data block with a bit position of 1 is synchronized to the sub-device of the disk mirror device based on the disk mirror device daemon.
[0216] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0217] S1: Based on multiple storage clusters, corresponding volumes are created respectively, and the volumes corresponding to the multiple storage clusters are mapped to the host side;
[0218] S2: Scan and obtain unique device identifiers of volumes corresponding to the multiple storage clusters;
[0219] S3: virtualizing the volumes corresponding to the multiple storage clusters into a disk mirror device according to the unique device identifier, wherein the disk mirror device includes multiple sub-devices;
[0220] S4: in response to detecting that the disk mirror device has been virtualized, writing the data to be stored into a sub-device of the disk mirror device, and providing a real-time storage service based on the first target sub-device;
[0221] S5: In response to detecting that the first target sub-device for providing storage services in real time fails, the first target sub-device is switched to a second target sub-device, and storage services are provided based on the second target sub-device.
[0222] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0223] Based on the multiple storage clusters, corresponding volumes are created respectively, wherein the volumes corresponding to each storage cluster are of equal size;
[0224] Based on the target mapping method, the volumes corresponding to each storage cluster are mapped to the host side.
[0225] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0226] In response to detecting the mapping information of the volume, respectively acquiring a block device of each volume and a unique device identifier corresponding thereto;
[0227] The unique device identifier of the block device is defined as a unique device identifier of a volume of the corresponding storage cluster.
[0228] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0229] Get the block devices and unique device identifiers corresponding to multiple volumes;
[0230] Based on unique device identifiers corresponding to the multiple block devices, virtualize the multiple block devices to generate the disk image device;
[0231] In response to detecting that the disk mirror device has been virtualized, setting a unique identifier for the disk mirror device and defining each block device as a sub-device of the disk mirror device;
[0232] Start the disk image device daemon;
[0233] Dividing a disk space of a preset size in each sub-device of the disk mirroring device;
[0234] Based on the disk mirroring device daemon, metadata information is saved in the disk space of the sub-devices of the disk mirroring device, wherein the metadata information at least includes a unique identifier of the disk mirroring device, a unique device identifier of each sub-device, and bitmap information of a data block size specified by the disk mirroring device, wherein the data bitmap information has a one-to-one mapping relationship with the data block size specified by the disk mirroring device.
[0235] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0236] In response to detecting that the disk mirror device has been virtualized and the disk mirror device daemon process has been started, setting a bitmap bit of a data block corresponding to each sub-device to 1 based on the disk mirror device daemon process;
[0237] In response to detecting that the bitmap bit of the data block corresponding to each sub-device has been set to 1, starting a sub-device data synchronization process based on the disk mirroring device daemon process;
[0238] In response to detecting that the sub-device data synchronization process has been started, synchronously writing the data to be stored into each sub-device of the disk mirroring device;
[0239] In response to detecting that the data to be stored has been written, setting the bitmap bit of the data block corresponding to each sub-device to 0;
[0240] In response to detecting a data read request, selecting a target sub-device in the disk mirroring device based on the data read request;
[0241] The target sub-device is defined as the first target sub-device, and a real-time storage service is provided based on the first target sub-device.
[0242] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0243] In response to detecting that a link to the first target sub-device for providing storage services in real time is interrupted, determining that a failure occurs in the first target sub-device;
[0244] In response to detecting that the first target sub-device has a fault, setting the disk mirror device corresponding to the first target sub-device to a degraded state based on the disk mirror device daemon process, and isolating the first target sub-device;
[0245] Selecting other target sub-devices in the disk mirroring device except the first target sub-device, and defining them as second target sub-devices;
[0246] The user service is switched to the second target sub-device based on the disk mirroring device daemon process to provide storage services.
[0247] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0248] In response to detecting that the failure of the first target sub-device has been repaired, re-adding the first target sub-device to the disk mirroring device based on the disk mirroring device daemon process;
[0249] In response to detecting that the first target sub-device has been added to the disk mirroring device, based on the disk mirroring device daemon process, comparing metadata information of other sub-devices with metadata information of the first target sub-device to obtain difference data;
[0250] Synchronizing the difference data to the first target sub-device;
[0251] In response to detecting that the disk mirror device failure has been repaired, the data block with a bit position of 1 is synchronized to the sub-device of the disk mirror device based on the disk mirror device daemon.
[0252] In one embodiment, a computer program product is provided, the computer program product comprising a computer program, the computer program when executed by a processor implements the following steps:
[0253] S1: Based on multiple storage clusters, corresponding volumes are created respectively, and the volumes corresponding to the multiple storage clusters are mapped to the host side;
[0254] S2: Scan and obtain unique device identifiers of volumes corresponding to the multiple storage clusters;
[0255] S3: virtualizing the volumes corresponding to the multiple storage clusters into a disk mirror device according to the unique device identifier, wherein the disk mirror device includes multiple sub-devices;
[0256] S4: in response to detecting that the disk mirror device has been virtualized, writing the data to be stored into a sub-device of the disk mirror device, and providing a real-time storage service based on the first target sub-device;
[0257] S5: In response to detecting that the first target sub-device for providing storage services in real time fails, the first target sub-device is switched to a second target sub-device, and storage services are provided based on the second target sub-device.
[0258] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0259] Based on the multiple storage clusters, corresponding volumes are created respectively, wherein the volumes corresponding to each storage cluster are of equal size;
[0260] Based on the target mapping method, the volumes corresponding to each storage cluster are mapped to the host side.
[0261] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0262] In response to detecting the mapping information of the volume, respectively acquiring a block device of each volume and a unique device identifier corresponding thereto;
[0263] The unique device identifier of the block device is defined as a unique device identifier of a volume of the corresponding storage cluster.
[0264] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0265] Get the block devices and unique device identifiers corresponding to multiple volumes;
[0266] Based on unique device identifiers corresponding to the multiple block devices, virtualize the multiple block devices to generate the disk image device;
[0267] In response to detecting that the disk mirror device has been virtualized, setting a unique identifier for the disk mirror device and defining each block device as a sub-device of the disk mirror device;
[0268] Start the disk image device daemon;
[0269] Dividing a disk space of a preset size in each sub-device of the disk mirroring device;
[0270] Based on the disk mirroring device daemon, metadata information is saved in the disk space of the sub-devices of the disk mirroring device, wherein the metadata information at least includes a unique identifier of the disk mirroring device, a unique device identifier of each sub-device, and bitmap information of a data block size specified by the disk mirroring device, wherein the data bitmap information has a one-to-one mapping relationship with the data block size specified by the disk mirroring device.
[0271] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0272] In response to detecting that the disk mirror device has been virtualized and the disk mirror device daemon process has been started, setting a bitmap bit of a data block corresponding to each sub-device to 1 based on the disk mirror device daemon process;
[0273] In response to detecting that the bitmap bit of the data block corresponding to each sub-device has been set to 1, starting a sub-device data synchronization process based on the disk mirroring device daemon process;
[0274] In response to detecting that the sub-device data synchronization process has been started, synchronously writing the data to be stored into each sub-device of the disk mirroring device;
[0275] In response to detecting that the data to be stored has been written, setting the bitmap bit of the data block corresponding to each sub-device to 0;
[0276] In response to detecting a data read request, selecting a target sub-device in the disk mirroring device based on the data read request;
[0277] The target sub-device is defined as the first target sub-device, and a real-time storage service is provided based on the first target sub-device.
[0278] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0279] In response to detecting that a link to the first target sub-device for providing storage services in real time is interrupted, determining that a failure occurs in the first target sub-device;
[0280] In response to detecting that the first target sub-device has a fault, setting the disk mirror device corresponding to the first target sub-device to a degraded state based on the disk mirror device daemon process, and isolating the first target sub-device;
[0281] Selecting other target sub-devices in the disk mirroring device except the first target sub-device, and defining them as second target sub-devices;
[0282] The user service is switched to the second target sub-device based on the disk mirroring device daemon process to provide storage services.
[0283] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0284] In response to detecting that the failure of the first target sub-device has been repaired, re-adding the first target sub-device to the disk mirroring device based on the disk mirroring device daemon process;
[0285] In response to detecting that the first target sub-device has been added to the disk mirroring device, based on the disk mirroring device daemon process, comparing metadata information of other sub-devices with metadata information of the first target sub-device to obtain difference data;
[0286] Synchronizing the difference data to the first target sub-device;
[0287] In response to detecting that the disk mirror device failure has been repaired, the data block with a bit position of 1 is synchronized to the sub-device of the disk mirror device based on the disk mirror device daemon.
[0288] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0289] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0290] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application.
Claims
1. A data protection method, characterized in that: The method comprises: Based on multiple storage clusters, corresponding volumes are created respectively, and the volumes corresponding to the multiple storage clusters are mapped to the host side; Scan and obtain unique device identifiers of volumes corresponding to the multiple storage clusters; According to the unique device identifier, virtualizing the volumes corresponding to the multiple storage clusters into a disk mirror device, wherein the disk mirror device includes multiple sub-devices; In response to detecting that the disk mirror device has been virtualized, writing the data to be stored into a sub-device of the disk mirror device, and providing real-time storage services based on the first target sub-device; In response to detecting that the first target sub-device for providing storage services in real time fails, the first target sub-device is switched to a second target sub-device, and storage services are provided based on the second target sub-device.
2. The data protection method according to claim 1, characterized in that: Based on multiple storage clusters, respectively creating corresponding volumes, and mapping the volumes corresponding to the multiple storage clusters to the host side includes: Based on the multiple storage clusters, corresponding volumes are created respectively, wherein the volumes corresponding to each storage cluster are of equal size; Based on the target mapping method, the volumes corresponding to each storage cluster are mapped to the host side.
3. The data protection method according to claim 1, characterized in that: Scanning and obtaining unique device identifiers of volumes corresponding to the multiple storage clusters includes: In response to detecting the mapping information of the volume, respectively acquiring a block device of each volume and a unique device identifier corresponding thereto; The unique device identifier of the block device is defined as a unique device identifier of a volume of the corresponding storage cluster.
4. The data protection method according to claim 1, characterized in that: Virtualizing the volumes corresponding to the plurality of storage clusters into disk mirror devices according to the unique device identifier includes: Get the block devices and unique device identifiers corresponding to multiple volumes; Based on unique device identifiers corresponding to the multiple block devices, virtualize the multiple block devices to generate the disk image device; In response to detecting that the disk mirror device has been virtualized, setting a unique identifier for the disk mirror device and defining each block device as a sub-device of the disk mirror device; Start the disk image device daemon; Dividing a disk space of a preset size in each sub-device of the disk mirroring device; Based on the disk mirroring device daemon, metadata information is saved in the disk space of the sub-devices of the disk mirroring device, wherein the metadata information at least includes a unique identifier of the disk mirroring device, a unique device identifier of each sub-device, and bitmap information of a data block size specified by the disk mirroring device, wherein the data bitmap information has a one-to-one mapping relationship with the data block size specified by the disk mirroring device.
5. The data protection method according to claim 4, characterized in that: In response to detecting that the disk mirror device has been virtualized, writing the data to be stored into a sub-device of the disk mirror device, and providing a real-time storage service based on the first target sub-device includes: In response to detecting that the disk mirror device has been virtualized and the disk mirror device daemon process has been started, setting a bitmap bit of a data block corresponding to each sub-device to 1 based on the disk mirror device daemon process; In response to detecting that the bitmap bit of the data block corresponding to each sub-device has been set to 1, starting a sub-device data synchronization process based on the disk mirroring device daemon process; In response to detecting that the sub-device data synchronization process has been started, synchronously writing the data to be stored into each sub-device of the disk mirroring device; In response to detecting that the data to be stored has been written, setting the bitmap bit of the data block corresponding to each sub-device to 0; In response to detecting a data read request, selecting a target sub-device in the disk mirroring device based on the data read request; The target sub-device is defined as the first target sub-device, and a real-time storage service is provided based on the first target sub-device.
6. The data protection method according to claim 1, characterized in that: In response to detecting that the first target sub-device for providing storage services in real time fails, switching the first target sub-device to a second target sub-device, and providing storage services based on the second target sub-device includes: In response to detecting that a link to the first target sub-device for providing storage services in real time is interrupted, determining that a failure occurs in the first target sub-device; In response to detecting that the first target sub-device has a fault, setting the disk mirror device corresponding to the first target sub-device to a degraded state based on the disk mirror device daemon process, and isolating the first target sub-device; Selecting other target sub-devices in the disk mirroring device except the first target sub-device, and defining them as second target sub-devices; The user service is switched to the second target sub-device based on the disk mirroring device daemon process to provide storage services.
7. The data protection method according to claim 1, characterized in that: In response to detecting that the failure of the first target sub-device has been repaired, the method further includes: In response to detecting that the failure of the first target sub-device has been repaired, re-adding the first target sub-device to the disk mirroring device based on the disk mirroring device daemon process; In response to detecting that the first target sub-device has been added to the disk mirroring device, based on the disk mirroring device daemon process, comparing metadata information of other sub-devices with metadata information of the first target sub-device to obtain difference data; Synchronizing the difference data to the first target sub-device; In response to detecting that the disk mirror device failure has been repaired, the data block with a bit position of 1 is synchronized to the sub-device of the disk mirror device based on the disk mirror device daemon.
8. A data protection device, characterized in that: The device comprises: A creation module, used to create corresponding volumes based on multiple storage clusters, respectively, and map the volumes corresponding to the multiple storage clusters to the host side; A scanning and obtaining module, used to scan and obtain unique device identifiers of volumes corresponding to the multiple storage clusters; A virtualization module, configured to virtualize the volumes corresponding to the plurality of storage clusters into a disk mirror device according to the unique device identifier, wherein the disk mirror device includes a plurality of sub-devices; A real-time storage service providing module, configured to write the data to be stored into a sub-device of the disk mirroring device when it is detected that the disk mirroring device has been virtualized, and provide a real-time storage service based on the first target sub-device; The switching module is used to switch the first target sub-device to the second target sub-device when a failure is detected in the first target sub-device for providing storage services in real time, and provide storage services based on the second target sub-device.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Cross-cluster active-active construction method, data writing method, equipment, medium and product
CN121560250A
Cross-cluster active-active construction methods, data writing methods, devices, media and products
CN121560250B
