Volume backup method and device, electronic equipment and storage medium
By establishing a remote replication relationship between the source volume and the backup volume, data is synchronized in real time and snapshots are created, solving the problem of limited volume backup efficiency in existing technologies and achieving efficient, reliable data backup and rapid recovery.
Patent Information
- Application Number
- CN202411025656.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-29
- Publication Date
- 2024-11-29
AI Technical Summary
In existing technologies, volume backup speed is limited by host read/write performance. Especially for large volumes, the improvement in backup efficiency is limited, and increasing the number of threads may lead to a decrease in efficiency.
By establishing a remote replication relationship between the source volume and the backup volume, data is synchronized in real time, and a snapshot is created after the synchronization status is confirmed, ensuring data consistency and integrity.
It improves the efficiency and reliability of data backup, reduces the risk of data loss, shortens recovery time during disaster recovery, and reduces operational complexity.
Smart Images

Figure CN119046056A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a volume backup method, device, electronic device and storage medium. Background Art
[0002] In order to ensure the security of data in virtual machines, cloud platforms provide a volume backup function. In related technologies, the speed of volume backup depends on the host's ability to read and write storage volumes, and improvements are made around how to improve the host's read and write efficiency of storage volumes, including the use of multi-threading technology and methods for synchronizing differential data. However, the host's read and write performance of volumes has an upper limit. No matter how much it is optimized, the speed of volume backup for volumes with larger capacity will not change qualitatively. On the contrary, if the number of threads is increased blindly, the frequent switching between threads will lead to a decrease in backup efficiency. Summary of the invention
[0003] In order to overcome the problems existing in the related art, the present disclosure provides a volume backup method, device, electronic device and storage medium. The technical solution of the present disclosure is as follows:
[0004] According to a first aspect of an embodiment of the present disclosure, a volume backup method is provided, including:
[0005] After the source volume is backed up for the first time by the first component, the backup storage information is sent to the second component by the first component;
[0006] By means of the second component, based on the information of the source storage to which the source volume belongs and the information of the backup storage, a remote replication relationship between the source volume and the backup volume is established, wherein the remote replication relationship is used to keep the data in the source volume and the data in the backup volume synchronized in real time;
[0007] receiving a request for backing up the source volume again;
[0008] In the case where a remote replication relationship is established between the backup volume and the source volume, detecting a synchronization state of the remote replication relationship;
[0009] When the synchronization state is synchronized, a snapshot is created for the backup volume.
[0010] Optionally, the performing a first backing up of the source volume by using the first component includes:
[0011] The first component creates the backup volume corresponding to the source volume in the backup storage;
[0012] The first component mounts the backup volume to a control node of the cloud platform;
[0013] The second component mounts the source volume to the same control node;
[0014] The data of the source volume is read out and written into the backup volume through the host corresponding to the control node; after the data of the source volume is written into the backup volume, a snapshot is created for the backup volume.
[0015] Optionally, when the synchronization state of the remote replication relationship is unsynchronized, the method further includes:
[0016] Waiting for the synchronization state of the remote replication relationship to be updated to synchronized; the synchronization state of the remote replication relationship being synchronized indicates that the data of the backup volume is consistent with the data of the source volume;
[0017] After the synchronization state of the remote replication relationship is updated to synchronized, creating a snapshot for the backup volume; waiting for the synchronization state of the remote replication relationship to be updated to synchronized, comprising:
[0018] The synchronization status of the remote replication relationship is obtained at preset time intervals.
[0019] Optionally, sending the backup stored information to the second component through the first component includes:
[0020] Calling, through the first component, a first remote replication interface in a first module of the second component;
[0021] By calling the first remote replication interface, the backup storage information is passed to the second component; the backup storage information includes: the backup storage address, user name and password.
[0022] Optionally, before backing up the source volume for the first time by the first component, or before backing up the source volume again; the method further includes:
[0023] In response to a backup request for backing up the source volume in the source storage;
[0024] Obtaining, through the first component, backup volume information corresponding to the source volume from the backup storage;
[0025] In a case where the backup volume information corresponding to the source volume is not obtained from the backup storage, determining that the current backup request is a request for the first backup of the source volume;
[0026] In the case where the backup volume information corresponding to the source volume is acquired from the backup storage, it is determined that the current backup request is a request for backing up the source volume again.
[0027] Optionally, the second component includes a first module, a second module and a third module; the information of the backup storage includes: an address of the backup storage, a user name and a password; the establishing of a remote replication relationship between the source volume and the backup volume through the second component based on the information of the source storage to which the source volume belongs and the information of the backup storage includes: the second component accesses the backup storage according to the address of the backup storage, the user name and the password, and obtains the name of the backup volume;
[0028] The second component accesses the source storage to obtain the name of the source volume;
[0029] The first module uses the backup storage information, the name of the backup volume and the name of the source volume as request parameters, and calls the second remote replication interface of the second module through the first remote replication interface of the first module;
[0030] The second module passes the request parameter to the third module by calling the third remote replication interface of the third module;
[0031] The third module establishes a remote replication relationship between the source volume and the backup volume according to the received request parameter;
[0032] The first remote replication interface, the second remote replication interface, and the third remote replication interface are configured to create interfaces for remote replication of the source volume and the backup volume.
[0033] Optionally, the third module establishes a remote replication relationship between the source volume and the backup volume according to the received request parameter, including:
[0034] The third module logs in to the storage system through the address of the backup storage, the user name and the password in the request parameters, and obtains the cluster name of the backup storage;
[0035] The third module logs into the source storage and calls the storage naming to establish a partnership between the source storage and the backup storage;
[0036] After the partnership between the source storage and the backup storage is established, a remote replication relationship between the source volume and the base volume is established.
[0037] According to a second aspect of an embodiment of the present disclosure, a volume backup device is provided, including:
[0038] A sending module, configured to send backup storage information to a second component through the first component after the source volume is backed up for the first time through the first component;
[0039] An establishing module, configured to establish, through a second component, a remote replication relationship between the source volume and the backup volume based on information of the source storage to which the source volume belongs and information of the backup storage, wherein the remote replication relationship is used to keep data in the source volume synchronized with data in the backup volume in real time;
[0040] A receiving module, configured to receive a request for backing up the source volume again;
[0041] A detection module, used for detecting the synchronization state of the remote replication relationship when the remote replication relationship is established between the backup volume and the source volume;
[0042] The snapshot module is used to create a snapshot of the backup volume when the synchronization state is synchronized.
[0043] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the volume backup method as described in the first aspect.
[0044] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the volume backup method as described in the first aspect.
[0045] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps of the volume backup method described in the first aspect are implemented.
[0046] In the disclosed embodiments, by establishing a remote replication relationship between the source volume and the backup volume, data can be synchronized in real time, reducing the data replication time required in traditional backups, and any changes to the source volume data will be immediately reflected on the backup volume. This real-time data mirroring can greatly reduce the risk of data loss. Using a remote replication relationship, data can be synchronized without affecting the performance of the host. A snapshot is created for the backup volume after the synchronization status is confirmed as "synchronized". This method ensures the data integrity and consistency of the snapshot. In a disaster recovery scenario, services can be quickly restored by simply switching to the backup volume without the need for complex data recovery steps, which can significantly shorten the recovery time and reduce the operational burden during the recovery process. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings required for use in the description of the embodiments of the present disclosure will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0048] Figure 1 It is a schematic diagram of steps of a volume backup method shown in an embodiment of the present disclosure;
[0049] Figure 2 is a volume backup flow chart shown in an embodiment of the present disclosure;
[0050] Figure 3 is a block diagram of a volume backup device shown in an embodiment of the present disclosure;
[0051] Figure 4 is a schematic diagram of an electronic device shown in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0052] The following will be combined with the drawings in the embodiments of the present disclosure to clearly and completely describe the technical solutions in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.
[0053] The terms "first", "second", etc. in the specification and claims of the present disclosure are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable when appropriate, so that the embodiments of the present disclosure can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally of the same type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0054] For ease of understanding, the following is an explanation of the professional terms involved in this disclosure.
[0055] Cinder: It is the component responsible for providing block storage services in the cloud platform. Each storage vendor provides its own Cinder driver for the platform to use.
[0056] Cinder-backup: It is a component in the cloud platform responsible for providing volume backup services. It is used to back up the data of the source storage volume to the backup storage.
[0057] RPC (Remote Procedure Call): It allows a program to call a subroutine on another computer without having to understand the underlying network details. Through RPC, a computer program can call a remote program just like calling a local program.
[0058] Currently, more and more government departments and enterprises are deploying their services on virtual machines created on cloud platforms. At the same time, in order to ensure the security and availability of business data, enterprise-level storage platforms are usually connected to cloud platforms, and volumes and virtual machines in the cloud platforms are created in storage devices, and storage volumes are used and backed up through Cinder services and Cinder-backup services.
[0059] After receiving the volume backup request from the user, the cloud platform calls the backup creation interface of the Cinder-backup service. In this interface, the Cinder-backup service first connects to the backup storage and creates a backup volume in the backup storage, then mounts the backup volume and the source volume to the same control node of the cloud platform, and synchronizes the data using the host's read and write capabilities for the volume. The Cinder-backup service reads the data of the source volume and writes it to the backup volume, thus completing the volume backup.
[0060] In the related art, some methods are proposed to improve the backup efficiency of volumes.
[0061] The first method is to use multi-threading technology. When backing up a volume, the cloud platform first creates a backup volume in the backup storage, mounts the source volume and the backup volume to the same control node host of the cloud platform, and synchronizes the data by increasing the number of host threads. The data in the source volume is cut into data segments of fixed size, and multiple threads read multiple data segments at the same time and write them to the backup volume. This shortens the overall backup time. Each backup generates a backup volume, which serves as a backup of the source volume. This method reduces the backup time by reading and writing multiple data segments at the same time.
[0062] The second method is to synchronize differential data. First, create a backup volume in the backup storage, mount the source volume and the backup volume to the same control node host of the cloud platform, cut the data in the source volume into several fixed-size data segments, and then read the data segments corresponding to the data segments in the source volume and the backup volume for comparison. If the content of the data segment is inconsistent, the data segment in the source volume is written to the backup corresponding to the backup volume. If it is consistent, it is no longer written. When all the differential data is written to the backup volume, a snapshot is created for the backup. The snapshot serves as a backup of the source volume. This method reduces the backup time by reducing the number of data writes. However, existing technologies all need to improve the efficiency of volume backup around the host's read and write capabilities to the volume. The host's read and write performance to the volume has an upper limit. It depends on the performance of the host's CPU, memory and other hardware. Even if it is optimized, for a large volume, the speed of its volume backup will not change qualitatively. On the contrary, if the number of threads is increased blindly, the frequent switching between threads will lead to a decrease in backup efficiency. Therefore, the method proposed by the relevant technology will also have the problem of low volume backup efficiency.
[0063] Figure 1 FIG. 1 is a schematic diagram of the steps of a volume backup method shown in an embodiment of the present disclosure. Figure 1 As shown, the volume backup method may specifically include the following steps:
[0064] Step S11: After the source volume is backed up for the first time by the first component, the backup storage information is sent to the second component by the first component.
[0065] The first component may be a Cinder-backup service, which allows users to back up Cinder volumes to a supported storage backend. The second component may be a Cinder service, which is a component in the cloud platform responsible for providing block storage services.
[0066] Configure the Cinder-backup service and ensure that the Cinder-backup service can interact effectively with the Cinder service. The user initiates a backup request and specifies the source volume to be backed up. The Cinder-backup service receives the backup request and performs the first backup of the source volume. The first backup can be a full backup; a full backup is a data backup method that copies all selected data and system files. When backing up data for the first time, a full backup is usually selected to ensure that all data is included. The backup process can include data compression, encryption, and transmission to the backup storage location.
[0067] After the backup is completed, the Cinder-backup service sends the backup data information to the Cinder service, which may include the backup storage IP, username, and password.
[0068] Step S12: through the second component, based on the information of the source storage to which the source volume belongs and the information of the backup storage, a remote replication relationship between the source volume and the backup volume is established, wherein the remote replication relationship is used to keep the data in the source volume and the data in the backup volume synchronized in real time.
[0069] After receiving the information sent by the Cinder-backup service, the Cinder service analyzes the source storage information where the source volume is located and the backup storage information. Based on this information, the Cinder service will configure a remote replication path to ensure that data can be synchronized between the source volume and the backup volume in real time. Once a remote replication relationship is established, any write to the source volume will trigger a synchronization operation to ensure that the data of the backup volume is consistent with that of the source volume.
[0070] Remote replication is a data disaster recovery technology that achieves remote data backup and disaster recovery by replicating data on the local storage device (primary site) to the remote storage device (slave site) in real time. When data on the primary site changes (such as a write operation), these changes are immediately sent to the slave site, and the same write operation is performed on the slave site. Only when both the primary site and the slave site have successfully completed the write operation will the system return a successful response to the host.
[0071] Regular monitoring can be performed to ensure the health and performance of the remote replication process, and if a problem is detected, such as network latency or storage failure, the system can automatically report and attempt to resume the replication process.
[0072] Step S13: receiving a request for backing up the source volume again.
[0073] The Cinder-backup service will receive a backup request for the source volume, which may carry specific source volume information and possible backup parameters. After receiving the backup request, it can first verify whether this backup request is for the backup of the source volume.
[0074] Step S14: when a remote replication relationship is established between the backup volume and the source volume, detecting a synchronization state of the remote replication relationship.
[0075] After the backup volume and the source volume establish a remote replication relationship, data will be continuously synchronized, and different synchronization states will be generated according to the synchronization status of the data. Only when the synchronization state is synchronized, it means that the data of the backup volume and the source volume are completely consistent.
[0076] Therefore, after the backup volume and the source volume establish a remote replication relationship, the data consistency between the source volume and the backup volume can be checked regularly to ensure that the data on both sides completely match.
[0077] Step S15: when the synchronization state is synchronized, creating a snapshot for the backup volume.
[0078] When the synchronization state is synchronized, that is, after confirming that the data is completely synchronized, prepare to create a snapshot on the backup volume; use the snapshot function of the storage system to create a data snapshot of the backup volume.
[0079] By adopting the technical solution of the embodiment of the present disclosure, the data between the source volume and the backup volume can be synchronized in real time through the remote replication relationship, greatly improving the consistency and reliability of the data. Using the remote replication relationship, data can be synchronized without relying on the host read performance. Remote replication provides a mechanism that can immediately synchronize to the backup volume when the data changes, which can greatly improve the data backup effect; it can effectively avoid the related technology when backing up the source volume.
[0080] In an optional embodiment, the first backup of the source volume through the first component includes: the first component creates the backup volume corresponding to the source volume in the backup storage; the first component mounts the backup volume to the control node of the cloud platform; the second component mounts the source volume to the same control node; through the host corresponding to the control node, the data of the source volume is read out and written to the backup volume; after the data of the source volume is written to the backup volume, a snapshot is created for the backup volume. In the case of the first backup of the source volume, a backup volume can be initialized in the backup storage through the first component, and this volume will be used to store the data backup of the source volume. Configure the storage parameters of the backup volume, such as size, performance level and storage location, to ensure that it can accommodate the complete data of the source volume. Confirm that the backup volume is successfully created and is ready for data writing. The first component can be a Cinder-backup service.
[0081] The backup volume is mounted to the control node of the cloud platform through the network storage interface. Similarly, the second component mounts the source volume to be backed up to the control node to ensure that the source volume and the backup volume are accessible on the same node. The second component can be a Cinder service.
[0082] By controlling the host corresponding to the node to read data from the source volume and write the read data to the mounted backup volume, data encryption and secure transmission can be used to protect the data from illegal access or tampering. After the data is written, data integrity verification can be performed to ensure that the data in the backup volume is completely consistent with the source volume.
[0083] After the data on the backup volume is written, a snapshot is taken of the backup volume. The snapshot records the data status when the backup operation is completed. Confirm that the snapshot has been successfully created and record the snapshot information, including the creation time, snapshot size, and related metadata.
[0084] By adopting the technical solution of the embodiment of the present disclosure, the data of the source volume is read out and written into the backup volume, which can provide a means of data recovery when the original data is damaged or lost, greatly reducing the risk of data loss. The backup data is stored in a physical location different from the source data, which also provides protection against data center-level disasters. A snapshot is created after the data backup is completed, so that the backup volume can be recorded at a specific point in time. In an optional embodiment, when the synchronization state of the remote replication relationship is not synchronized, it also includes: waiting for the synchronization state of the remote replication relationship to be updated to synchronized; the synchronization state of the remote replication relationship is synchronized, indicating that the data of the backup volume and the source volume are consistent; after the synchronization state of the remote replication relationship is updated to synchronized, a snapshot is created for the backup volume; waiting for the synchronization state of the remote replication relationship to be updated to synchronized, including: obtaining the synchronization state of the remote replication relationship at a preset interval.
[0085] When backing up the source volume again, it is necessary to check the data synchronization between the source volume and the backup volume. Only when the data of the source volume and the backup volume are consistent, the backup volume will be backed up by taking a snapshot. This is because when the data of the source volume and the backup volume are consistent, the data of the source volume has been successfully copied to the backup volume, and the data of the backup volume is the latest and exactly the same as the source volume, reducing the risk of data inconsistency.
[0086] Therefore, it is necessary to check the synchronization status of the remote replication relationship established between the source volume and the backup volume. If the synchronization status of the remote replication relationship is not synchronized, it means that the data of the source volume and the backup volume are not consistent at this time, and it is necessary to wait for the synchronization status of the remote replication relationship to be updated to synchronized.
[0087] In order to detect the synchronization status of the remote replication relationship, a preset time interval can be set to regularly check the synchronization status, which can be implemented by event triggering or polling mechanism. If the synchronization status is detected as synchronized, it means that the data of the source volume and the backup volume are consistent at this moment. For example, the synchronization status of the remote synchronization relationship can be set to be checked every 5 minutes. When the data of the source volume and the backup volume are detected to be consistent, the synchronization status is updated to synchronized.
[0088] If a backup request for the source volume is received before the synchronization status is updated to synchronized, then after the synchronization status is updated to synchronized, a snapshot of the source volume is directly taken to implement the backup of the source volume, and the user does not need to send a backup request again. After the backup volume is snapshotted, a series of verifications can be performed to ensure that the data in the snapshot is completely consistent with the data in the backup volume.
[0089] By adopting the technical solution of the embodiment of the present disclosure, by waiting for the synchronization status to be updated from "unsynchronized" to "synchronized", and then executing the snapshot creation of the backup volume on this basis, the integrity of the data during the backup process can be ensured, thereby avoiding the problem of partial update or data corruption. Through the automated monitoring and update mechanism, the reliance on manual intervention is reduced, and the complexity and error rate of the operation are reduced.
[0090] In an optional embodiment, the sending of backup storage information to the second component through the first component includes: calling the first remote replication interface in the first module of the second component through the first component; passing the backup storage information to the second component by calling the first remote replication interface; the backup storage information includes: the backup storage address, user name and password.
[0091] The first component is configured so that the first component can interact with the second component. After the first component creates a backup of the source volume in the backup storage for the first time, the backup storage information can be automatically transmitted to the second component by calling the first remote replication interface provided by the second component, the backup storage information includes: the backup storage address, user name and password, and the backup storage information is used to establish a remote replication relationship between the source volume and the backup volume.
[0092] The first component may be a Cinder-backup service, the second component may be a Cinder service, and the first remote replication interface may be an interface on a Cinder rpcapi module in the Cinder service. The first remote replication interface is an interface for creating remote replication of a source volume and a backup volume.
[0093] The Cinder rpcapi module is responsible for receiving external RPC requests in the Cinder service. RPC is a technology that enables a program to request the execution of a program on another system. Therefore, data from different storage clusters can be transmitted through the interface in the Cinder rpcapi module.
[0094] By adopting the technical solution of the embodiment of the present disclosure, the first component and the second component can interact through the interface of the first module, so that the second component can obtain the backup storage information by receiving the request sent by the first component; through a secure authentication process, such as users and passwords, the security of data transmission and storage processes is increased.
[0095] In an optional embodiment, before performing the first backup of the source volume through the first component, or before performing the second backup of the source volume; it also includes: responding to a backup request for backing up the source volume in the source storage; obtaining the backup volume information corresponding to the source volume from the backup storage through the first component; if the backup volume information corresponding to the source volume is not obtained from the backup storage, determining that the current backup request is a request for the first backup of the source volume; if the backup volume information corresponding to the source volume is obtained from the backup storage, determining that the current backup request is a request for the second backup of the source volume.
[0096] The system responds to a backup request, which is an instruction to back up a source volume in a source storage, and identifies a source volume that needs to be backed up according to the backup request.
[0097] The first component obtains backup volume information corresponding to the source volume from the backup storage, and checks whether a backup record for the source volume already exists. The first component may be a Cinder-backup service.
[0098] If the backup volume information corresponding to the source volume is not found in the backup storage, the system will determine that the current backup request is a request for the first backup of the source volume. In this case, a new backup volume corresponding to the source volume will be created in the backup storage, and a full backup of the source volume will be performed.
[0099] If the backup volume information corresponding to the source volume is obtained from the backup storage, it means that at least one backup has been performed before. The system will determine that the current backup request is a request corresponding to another backup of the source volume.
[0100] By adopting the technical solution of the embodiment of the present disclosure, after receiving a backup request, by distinguishing between the first backup and the second backup, unnecessary network bandwidth and storage usage can be reduced, and the overall backup efficiency can be improved. The system can automatically distinguish the backup type and trigger the first backup when the expected backup information is not found, reducing the need for human intervention and potential errors.
[0101] In an optional embodiment, the second component includes a first module, a second module and a third module; the information of the backup storage includes: an address, a user name and a password of the backup storage; the establishment of a remote replication relationship between the source volume and the backup volume through the second component based on the information of the source storage to which the source volume belongs and the information of the backup storage includes: the second component accesses the backup storage according to the address of the backup storage, the user name and the password to obtain the name of the backup volume; the second component accesses the source storage to obtain the name of the source volume; the first module uses the information of the backup storage, the name of the backup volume and the name of the source volume as request parameters, and calls the second remote replication interface of the second module through the first remote replication interface of the first module; the second module passes the request parameter to the third module by calling the third remote replication interface of the third module; the third module establishes a remote replication relationship between the source volume and the backup volume according to the received request parameter; wherein the first remote replication interface, the second remote replication interface and the third remote replication interface are configured to create an interface for remote replication of the source volume and the backup volume.
[0102] The second component may be a Cinder service, which includes a Cinder rpcapi module, a Cinder-volume module, and a modified Cinder driver; the Cinder rpcapi module may be determined as the first module, the Cinder-volume module may be determined as the second module, and the Cinder driver may be determined as the third module. The Cinder rpcapi module, the Cinder-volume module, and the modified Cinder driver may be regarded as a command chain, where a user sends a request through an API, which is first received by the Cinder rpcapi module and converted into an internal RPC message, which is then sent to the Cinder-volume module for processing. The Cinder-volume module calls the corresponding Cinder driver based on these requests, and the Cinder driver interacts directly with physical or virtual storage resources to complete specific storage tasks.
[0103] The Cinder rpcapi module of the Cinder service is modified. The Cinder rpcapi module is responsible for receiving external RPC requests in the Cinder service and can convert requests initiated by users or other services through the API into internal messages. An interface for creating remote replication of the source volume in the source storage and the backup volume in the backup storage can be added to the Cinder rpcapi module. The interface is a first remote replication interface, which is used to receive backup storage information transmitted by the Cinder-backup service.
[0104] The Cinder-volume module of the Cinder service is modified. The Cinder-volume module is the core component of the Cinder service and is responsible for managing actual volume operations, such as creating, deleting, and mounting volumes. An interface for creating a remote replication of a source volume in a source storage and a backup volume in a backup storage can be added to the Cinder-volume module. The interface is a second remote replication interface. The second remote replication interface is used to receive a request initiated by the first remote replication interface.
[0105] Since the cloud platform Cinder service is deployed in high availability, the Cinder-volume service may be deployed synchronously on multiple nodes. Therefore, the first remote replication interface uses the cloud platform's RPC framework to remotely call the second remote replication interface of the Cinder-volume module. The first remote replication interface carries the request parameters when calling the second remote replication interface, and transmits the request parameters to the Cinder-volume service.
[0106] Modify the Cinder driver of the Cinder service. The Cinder driver is part of the Cinder-volume service and is responsible for interacting with specific storage hardware or software. When the Cinder service is started, it will be loaded into the memory for the upper-layer module to call. The upper-layer module can be the Cinder-volume service. An interface for creating a remote replication of the source volume in the source storage and the backup volume in the backup storage can be added to the Cinder driver. The interface is the third remote replication interface.
[0107] The second remote replication interface of the Cinder-volume service calls the third remote replication interface of the Cinder driver, and transmits the request parameters transmitted by the first remote replication interface to the Cinder driver.
[0108] The first remote replication interface, the second remote replication interface and the third remote replication interface are obtained by modifying the Cinderrpcapi module, the Cinder-volume module and the Cinder driver, and are all used to create interfaces for remote replication of the source volume in the source storage and the backup volume in the backup storage.
[0109] After modifying the Cinder rpcapi module and Cinder-volume module of the Cinder service and modifying the Cinder driver, the Cinder rpcapi module receives the backup storage information transmitted by the Cinder-backup service, and the backup storage information includes: the address, user name and password of the backup storage; through the address, user name and password of the backup storage, the backup storage information is converted into an internal message; the name of the backup volume is obtained from the backup storage; and at the same time, the source storage is accessed to determine the name of the source volume that needs to create a remote replication relationship with the backup volume.
[0110] The backup storage information, the name of the source volume, and the name of the backup volume are determined as request parameters for the first remote replication interface to call the second remote replication interface, and the request parameters are transmitted to the Cinder-volume service. After the Cinder-volume service receives the request sent by the Cinder rpcapi module through RPC, Cinder-volume converts these requests into specific storage operations and calls the corresponding storage driver to perform these operations.
[0111] The Cinder-volume service can call the interface of the Cinder driver, so the second remote replication interface passes the request parameters to the Cinder driver by calling the third remote replication interface of the Cinder driver. The Cinder driver interacts with the storage system according to the commands passed by the Cinder-volume module, and creates a remote replication relationship between the source volume in the source storage and the backup volume in the backup storage based on the request parameters.
[0112] By adopting the technical solution of the embodiment of the present disclosure, by establishing remote replication between the source volume and the backup volume, it is possible to ensure that key data remains available when the primary storage fails. By defining a series of remote replication interfaces and modules, the second component can receive the request sent by the first component to obtain the information of the backup storage, and complete the creation of the synchronous remote replication relationship by logging into the source storage. Decomposing the entire process into multiple modules and interfaces helps to maintain and expand the system. Each module focuses on the tasks within its scope of responsibility, which improves the reliability and maintainability of the system. By automatically establishing remote replication relationships, system efficiency is improved.
[0113] In an optional embodiment, the third module establishes a remote replication relationship between the source volume and the backup volume according to the received request parameters, including: the third module logs in to the storage system through the address of the backup storage, the user name and the password in the request parameters, and obtains the cluster name of the backup storage; the third module logs in to the source storage, calls storage naming to establish a partnership between the source storage and the backup storage; after establishing the partnership between the source storage and the backup storage, establishes a remote replication relationship between the source volume and the base volume.
[0114] The third module may be a Cinder driver. The Cinder driver is loaded into the memory when the service is started, and provides an interface for the upper-layer module to interact with the storage. In the third module, a new interface for creating a remote replication of the source volume in the source storage and the backup volume in the backup storage is added, and it is determined as the third remote replication interface.
[0115] The third remote replication interface is used to receive the request parameters transmitted by the Cinder-volume service, and the request parameters include: the address of the backup storage, the user name, the password, the name of the backup volume, and the name of the source volume.
[0116] The Cinder driver first uses the backup storage IP, user name and password to log in to the backup storage system through the newly added third remote replication interface to obtain the cluster name of the backup storage. Then the Cinder driver logs in to the source storage system and calls the storage command to establish a partnership between the source storage and the backup storage. After the partnership is established, the Cinder driver will perform specific synchronization operations based on the passed source volume and backup volume names, as well as other storage parameters, to establish a synchronous remote replication relationship between the source volume and the backup volume to ensure data consistency and integrity.
[0117] By adopting the technical solution of the embodiment of the present disclosure, an additional data protection layer is provided by establishing a remote replication relationship. By establishing a partnership and accurately configuring remote replication parameters, the consistency and integrity of data at the source and backup locations are ensured. The automation of the entire process reduces the risk of human error, while improving the flexibility of operations, making management easier and more efficient.
[0118] In an optional embodiment, after receiving a backup request for backing up a source volume, it is detected in the backup storage whether there is a backup volume corresponding to the source volume. If the backup volume does not have a remote replication relationship with the source volume, a remote replication relationship between the source volume and the backup volume can be established. When the remote replication relationship is established and the synchronization status of the remote replication relationship is synchronized, the backup volume is backed up to implement the backup of the source volume. If there are multiple backup volumes corresponding to the source volume in the backup storage, the backup volume with the latest version can be selected as the target backup volume, and a remote replication relationship can be established between the target backup volume and the source volume.
[0119] Figure 2 is a volume backup flow chart shown in an embodiment of the present disclosure. Figure 2 As shown, in response to a request initiated by the cloud platform to create a backup of the source volume; determine whether there is a backup volume corresponding to the source volume in the backup storage; if there is a corresponding backup volume in the backup storage, obtain the synchronization status of the remote replication relationship; determine whether the synchronization status is synchronized; if the synchronization status is synchronized, create a snapshot of the backup volume; if the synchronization status is not synchronized, wait for data synchronization, and after the data synchronization is completed, create a snapshot of the backup volume; if there is no corresponding backup volume in the backup storage, create a backup volume in the backup storage; mount the source volume and the backup volume to the cloud platform control node; read the source volume data and write it to the backup volume through the host; create a snapshot of the backup volume; and establish a remote replication relationship between the source volume and the backup volume.
[0120] Figure 3 1 is a block diagram of a volume backup device shown in an embodiment of the present disclosure. Figure 3 As shown, the device comprises:
[0121] The sending module 310 is used to send the backup storage information to the second component through the first component after the source volume is backed up for the first time through the first component;
[0122] An establishing module 320 is used to establish, through a second component, a remote replication relationship between the source volume and the backup volume based on information of the source storage to which the source volume belongs and information of the backup storage, wherein the remote replication relationship is used to keep data in the source volume synchronized with data in the backup volume in real time;
[0123] The receiving module 330 is used to receive a request for backing up the source volume again;
[0124] A detection module 340, configured to detect a synchronization state of a remote replication relationship when a remote replication relationship is established between the backup volume and the source volume;
[0125] The snapshot module 350 is used to create a snapshot of the backup volume when the synchronization state is synchronized. Optionally, the sending module is specifically used to execute:
[0126] The first component creates the backup volume corresponding to the source volume in the backup storage;
[0127] The first component mounts the backup volume to a control node of the cloud platform;
[0128] The second component mounts the source volume to the same control node;
[0129] The data of the source volume is read out and written into the backup volume through the host corresponding to the control node; after the data of the source volume is written into the backup volume, a snapshot is created for the backup volume.
[0130] Optionally, when the synchronization state of the remote replication relationship is not synchronized, the device further comprises: a waiting module, configured to wait for the synchronization state of the remote replication relationship to be updated to synchronized; the synchronization state of the remote replication relationship being synchronized indicates that data of the backup volume is consistent with data of the source volume;
[0131] The snapshot module is further configured to create a snapshot of the backup volume after the synchronization state of the remote replication relationship is updated to synchronized;
[0132] The waiting module is specifically used to execute:
[0133] The synchronization status of the remote replication relationship is obtained at preset time intervals.
[0134] Optionally, the sending module is specifically used to execute:
[0135] Through the first component, the first remote replication interface in the first module of the second component is called; by calling the first remote replication interface, the backup storage information is passed to the second component; the backup storage information includes: the backup storage address, user name and password.
[0136] Optionally, before backing up the source volume for the first time by the first component, or before backing up the source volume again; the device further includes:
[0137] A response module, configured to respond to a backup request for backing up the source volume in the source storage;
[0138] An acquisition module, configured to acquire backup volume information corresponding to the source volume from the backup storage through the first component;
[0139] A first determining module, configured to determine that the current backup request is a request for the first backup of the source volume when the backup volume information corresponding to the source volume is not obtained from the backup storage;
[0140] The second determining module is configured to determine that the current backup request is a request for backing up the source volume again when the backup volume information corresponding to the source volume is acquired from the backup storage.
[0141] Optionally, the second component includes a first module, a second module and a third module; the backup storage information includes: an address of the backup storage, a user name and a password; the establishment module is specifically used to execute: the second component accesses the backup storage according to the address of the backup storage, the user name and the password, and obtains the name of the backup volume;
[0142] The second component accesses the source storage to obtain the name of the source volume;
[0143] The first module uses the backup storage information, the name of the backup volume and the name of the source volume as request parameters, and calls the second remote replication interface of the second module through the first remote replication interface of the first module;
[0144] The second module passes the request parameter to the third module by calling the third remote replication interface of the third module;
[0145] The third module establishes a remote replication relationship between the source volume and the backup volume according to the received request parameter;
[0146] The first remote replication interface, the second remote replication interface, and the third remote replication interface are configured to create interfaces for remote replication of the source volume and the backup volume.
[0147] Optionally, the establishing module is specifically used to execute:
[0148] The third module logs in to the storage system through the address of the backup storage, the user name and the password in the request parameters, and obtains the cluster name of the backup storage;
[0149] The third module logs into the source storage and calls the storage naming to establish a partnership between the source storage and the backup storage;
[0150] After the partnership between the source storage and the backup storage is established, a remote replication relationship between the source volume and the base volume is established.
[0151] It should be noted that the system embodiment is similar to the method embodiment, so the description is relatively simple, and the relevant parts can be referred to the method embodiment.
[0152] The present disclosure also provides an electronic device, referring to Figure 4 , Figure 4 Schematic diagram of an electronic device shown in an embodiment of the present disclosure. Figure 4 As shown, the electronic device 400 includes: a memory 410 and a processor 420. The memory 410 and the processor 420 are connected via a bus communication. The memory 110 stores a computer program, which can be run on the processor 420 to implement the steps in the volume backup method disclosed in the embodiment of the present disclosure.
[0153] The embodiment of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps in the volume backup method disclosed in the embodiment of the present disclosure are implemented.
[0154] The embodiment of the present disclosure further provides a computer program product, including a computer program, and when the computer program is executed by a processor, the steps of the volume backup method disclosed in the embodiment of the present disclosure are implemented.
[0155] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0156] Those skilled in the art will appreciate that the embodiments of the present disclosure may be provided as methods, devices or computer program products. Therefore, the embodiments of the present disclosure may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present disclosure may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0157] The embodiments of the present disclosure are described with reference to the flowcharts and / or block diagrams of the methods, apparatuses, electronic devices, and computer program products according to the embodiments of the present disclosure. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0158] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0159] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps of the functions specified in a box or multiple boxes. Although some embodiments of the present disclosure have been described, those skilled in the art may make additional changes and modifications to these embodiments once they know the basic creative concepts. Therefore, the attached claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present disclosure. The above is a detailed introduction to a volume backup method, device, electronic device and storage medium provided by the present disclosure. Specific examples are used in this article to illustrate the principles and implementation methods of the present disclosure. The description of the above embodiments is only used to help understand the method of the present disclosure and its core idea. At the same time, for those of ordinary skill in the art, according to the ideas of the present disclosure, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present disclosure.
Claims
1. A volume backup method, It is characterized in that include: After the source volume is backed up for the first time by the first component, the backup storage information is sent to the second component by the first component; By means of the second component, based on the information of the source storage to which the source volume belongs and the information of the backup storage, a remote replication relationship between the source volume and the backup volume is established, wherein the remote replication relationship is used to keep the data in the source volume and the data in the backup volume synchronized in real time; receiving a request for backing up the source volume again; In the case where a remote replication relationship is established between the backup volume and the source volume, detecting a synchronization state of the remote replication relationship; When the synchronization state is synchronized, a snapshot is created for the backup volume.
2. The method according to claim 1, It is characterized in that The first backing up of the source volume by the first component includes: The first component creates the backup volume corresponding to the source volume in the backup storage; The first component mounts the backup volume to a control node of the cloud platform; The second component mounts the source volume to the same control node; Through the host corresponding to the control node, the data of the source volume is read out and written into the backup volume; After writing the data of the source volume to the backup volume, a snapshot is created for the backup volume.
3. The method according to claim 1, It is characterized in that When the synchronization state of the remote replication relationship is unsynchronized, the method further includes: Waiting for the synchronization state of the remote replication relationship to be updated to synchronized; the synchronization state of the remote replication relationship being synchronized indicates that the data of the backup volume is consistent with the data of the source volume; After the synchronization state of the remote replication relationship is updated to synchronized, creating a snapshot of the backup volume; Waiting for the synchronization status of the remote replication relationship to be updated to synchronized, including: The synchronization status of the remote replication relationship is obtained at preset time intervals.
4. The method according to claim 1, It is characterized in that The sending the backup stored information to the second component through the first component includes: Calling, through the first component, a first remote replication interface in a first module of the second component; By calling the first remote replication interface, the backup storage information is passed to the second component; the backup storage information includes: the backup storage address, user name and password.
5. The method according to claim 1, It is characterized in that Before backing up the source volume for the first time by the first component, or before backing up the source volume again; further comprising: In response to a backup request for backing up the source volume in the source storage; Obtaining, through the first component, backup volume information corresponding to the source volume from the backup storage; In a case where the backup volume information corresponding to the source volume is not obtained from the backup storage, determining that the current backup request is a request for the first backup of the source volume; In the case where the backup volume information corresponding to the source volume is acquired from the backup storage, it is determined that the current backup request is a request for backing up the source volume again.
6. The method according to claim 1, It is characterized in that The second component includes a first module, a second module and a third module; the backup storage information includes: an address, a user name and a password of the backup storage; the second component is used to establish a remote replication relationship between the source volume and the backup volume based on the information of the source storage to which the source volume belongs and the information of the backup storage, including: The second component accesses the backup storage according to the address of the backup storage, the user name and the password, and obtains the name of the backup volume; The second component accesses the source storage to obtain the name of the source volume; The first module uses the backup storage information, the name of the backup volume and the name of the source volume as request parameters, and calls the second remote replication interface of the second module through the first remote replication interface of the first module; The second module passes the request parameter to the third module by calling the third remote replication interface of the third module; The third module establishes a remote replication relationship between the source volume and the backup volume according to the received request parameter; The first remote replication interface, the second remote replication interface, and the third remote replication interface are configured to create interfaces for remote replication of the source volume and the backup volume.
7. The method according to claim 6, It is characterized in that The third module establishes a remote replication relationship between the source volume and the backup volume according to the received request parameter, including: The third module logs in to the storage system through the address of the backup storage, the user name and the password in the request parameters, and obtains the cluster name of the backup storage; The third module logs into the source storage and calls the storage naming to establish a partnership between the source storage and the backup storage; After the partnership between the source storage and the backup storage is established, a remote replication relationship between the source volume and the base volume is established.
8. A volume backup device, It is characterized in that include: A sending module, configured to send backup storage information to a second component through the first component after the source volume is backed up for the first time through the first component; An establishing module, configured to establish, through a second component, a remote replication relationship between the source volume and the backup volume based on information of the source storage to which the source volume belongs and information of the backup storage, wherein the remote replication relationship is used to keep data in the source volume synchronized with data in the backup volume in real time; A receiving module, configured to receive a request for backing up the source volume again; A detection module, used for detecting the synchronization state of the remote replication relationship when the remote replication relationship is established between the backup volume and the source volume; The snapshot module is used to create a snapshot of the backup volume when the synchronization state is synchronized.
9. An electronic device, It is characterized in that include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the computer program is executed by the processor, the volume backup method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the volume backup method according to any one of claims 1 to 7 is implemented.
