System and method for achieving cross-cloud quick recovery of virtual machine based on cloud platform volume
Technical Field
The invention relates to a system and a method for realizing cross-cloud quick recovery of a virtual machine based on a cloud platform volume, and belongs to the technical field of data recovery.
Background
Some cloud platforms such as openstack, easycast, fusion, etc. currently do not provide a backup interface, or do not provide a backup interface in native data format. Therefore, the third party backup manufacturer typically selects three backup modes for backup.
In the first scheme, a backup agent is installed in a virtual machine system needing backup to carry out backup. When recovering, the PE or LIVECD is needed to recover the data.
Scheme two, the cloud platform may provide some virtual machine logical export interfaces that do not perform well for backup. The imported interface is used again for recovery during recovery.
And thirdly, deeply cooperating with a corresponding cloud platform provider, and developing and providing an internal interface to support backup recovery.
The first disadvantage of the first scheme is that a backup agent needs to be installed in the virtual machine to be backed up, and usually many virtual machines need to be backed up on the cloud platform, so that deploying the backup agent is a troublesome and tedious work. Meanwhile, because the agent backup is adopted, the system resources of the virtual machine are required to be occupied during the backup, and if the backup program consumes larger resources, the performance of the production machine can be seriously reduced.
The second scheme has the defects that the virtual machine logic import and export interfaces provided by the partial cloud platform are used, the backup and recovery performance is poor, the key point is that the time required for recovery is long, and the total time consumption is long.
The third scheme has the defect of low feasibility, and a third party backup manufacturer needs to deeply cooperate with a cloud platform provider, and meanwhile, both parties also cooperate to develop. In addition, some cloud platform providers can also provide some simple functions of backup and restoration on the local cloud platform. It is less likely to cooperate with third party backup vendors. The monetary and time costs that are spent are generally relatively high, if at all.
Disclosure of Invention
The invention aims to overcome the defects of the prior art, and provides a system and a method for realizing cross-cloud quick recovery of a virtual machine based on a cloud platform volume, which do not need to install an agent in the virtual machine needing backup, only need to independently install one virtual machine, and the virtual machine is used as an agent machine for backup.
In order to solve the technical problems, the invention adopts the following technical scheme:
the invention provides a system for realizing the cross-cloud quick recovery of virtual machines based on cloud platform volumes, a backup proxy virtual machine is deployed on a source end cloud platform, a backup server virtual machine is deployed on a target end cloud platform,
the backup proxy virtual machine is provided with a mounting volume; the mounting volume is created according to the disk snapshot of the source-end virtual machine;
the backup server virtual machine is provided with an empty volume which is as large as a source virtual machine disk;
the backup proxy virtual machine is used for transmitting the data on the mounting volume to the backup server virtual machine and uploading the configuration information of the source virtual machine to the backup server virtual machine; the configuration information comprises configuration information of a source virtual machine and corresponding mounting volume information;
the backup server virtual machine is used for writing the received data into the corresponding mounting volume and creating a snapshot of the mounting volume; and rolling back the mounted volume, creating a virtual machine according to the starting volume, and attaching the data volume to the created virtual machine.
Further, at least one backup proxy virtual machine is deployed on the source cloud platform, and backup server virtual machines with the same number as the backup proxy virtual machines are deployed on the target cloud platform.
The invention also provides a method for realizing the cross-cloud quick recovery of the virtual machine based on the cloud platform volume, which comprises the following steps:
performing cross-cloud platform backup on the virtual machine;
and carrying out cross-cloud platform data recovery of the virtual machine based on the backup.
Further, the performing cross-cloud platform backup on the virtual machine includes:
creating a disk snapshot of a virtual machine for a source-end virtual machine to be backed up, and creating a new volume according to the disk snapshot by utilizing an interface of a cloud platform;
mounting the created new volume on a backup proxy virtual machine, creating an empty volume which is as large as a source virtual machine disk on a target end cloud platform, and mounting the volume on a backup server virtual machine; the backup proxy virtual machine is deployed on a cloud platform where the source virtual machine is located; the backup server virtual machine is deployed on a target end cloud platform;
reading corresponding data of the mounted volume on the backup proxy virtual machine, and transmitting the corresponding data to the backup server virtual machine;
the backup server virtual machine writes the received data into the corresponding mounting volume, and creates a snapshot for the mounting volume by utilizing a snapshot interface of the cloud platform;
the backup proxy virtual machine uploads the configuration information of the source virtual machine to the backup server virtual machine; the configuration information comprises configuration information of source virtual machines and mounting volume information corresponding to each source virtual machine;
unloading the volumes mounted on the virtual machine of the backup server; and unloading the volumes mounted on the backup proxy virtual machine, and deleting the disk snapshot of the virtual machine.
Further, the method further comprises the following steps:
after the backup server virtual machine mounts the volume, a volume mark id is sent to the backup proxy virtual machine, so that the backup proxy virtual machine and the backup server virtual machine are in one-to-one correspondence with each other.
Further, the reading the corresponding data of the mounted volume on the backup proxy virtual machine and transmitting the corresponding data to the backup server virtual machine includes:
and calling the lvcpy program to analyze a file system on the mounting volume of the backup proxy virtual machine through the open source interface, obtaining a dispersion bitmap of effective data, reading the content of a corresponding sector block on the mounting volume according to the dispersion bitmap, transmitting the read content of the sector block to the backup server virtual machine, and writing the content to the corresponding sector position of the mounted empty volume after the backup server virtual machine receives the content.
Further, if there are multiple mounted volumes on the backup proxy virtual machine, calling multiple lvcpy programs, and respectively and simultaneously reading the multiple mounted volumes.
Further, the performing cross-cloud platform backup on the virtual machine further includes:
after each backup is completed, calculating the hash value of the sector block on the mounting volume of the backup proxy virtual machine, analyzing the file system to obtain the effective data position when the next backup is performed, reading the sector block data, calculating the hash value of the sector block, comparing the hash value with the hash value recorded in the previous backup, and if the comparison results are different, backing up the changed data, and covering the backup data to the corresponding mounting volume sector block on the backup server virtual machine.
Further, the performing the virtual machine cross-cloud platform data recovery based on the backup includes:
the backup server virtual machine finds out a corresponding starting volume and a corresponding data volume according to the configuration information of the source virtual machine to be subjected to data recovery;
rolling back the starting volume to a specified snapshot, and creating a virtual machine by the cloud platform through the starting volume;
and rolling back the data volume to the designated snapshot, and attaching the volume to the created virtual machine, wherein the virtual machine realizes the data state of the source virtual machine to be restored.
The invention has the beneficial effects that:
the invention provides a mode of non-agent backup, which does not need to install an agent in a virtual machine needing backup, only needs to independently install a virtual machine, and the virtual machine is used as an agent machine for backup, so that resources are consumed, only the consumed resources of the agent machine are consumed, and the performance of a client production machine is not influenced.
The invention provides a backup method of a primary data format, which directly stores backup data on a volume of a target cloud platform, and only needs to create a new virtual machine from the volume when restoring, so that the creation process is fast, thereby realizing the purpose of quick restoration.
The invention uses a mechanism of cloud platform volume snapshot, uses a volume snapshot rollback or a mode of creating a new volume from a snapshot volume to quickly recover the virtual machine data of a historical version, and ensures the consistency of backup data.
Drawings
Fig. 1 is a system architecture for realizing cross-cloud quick recovery of a virtual machine based on a cloud platform volume.
Detailed Description
The invention is further described below. The following examples are only for more clearly illustrating the technical aspects of the present invention, and are not intended to limit the scope of the present invention.
The invention provides a system for realizing cross-cloud quick recovery of a virtual machine based on a cloud platform volume, which is shown in fig. 1 and comprises the following steps: a backup proxy virtual machine is deployed on the cloud platform 1, and a backup server virtual machine is deployed on the cloud platform 2. In fig. 1, a virtual machine to be backed up is deployed on a cloud platform 1, hereinafter referred to as a source cloud platform, and the source virtual machine. The cloud platform 2 is used for storing backup data, and is called a target-end cloud platform.
Preferably, if a plurality of virtual machines need to be backed up, a plurality of backup proxy virtual machines are deployed on the cloud platform 1, so that the plurality of virtual machines are backed up in parallel; meanwhile, a corresponding number of backup server virtual machines are deployed on the cloud platform 2.
The backup proxy virtual machine and the backup server virtual machine are used for mounting the volume, and sector data of the mounting volume are read and written through analysis of the virtual machine.
Specifically, the backup proxy virtual machine is used for transmitting the data on the mounted volume to the backup server virtual machine; and uploading the configuration information of the source virtual machine to the backup server virtual machine.
The backup server virtual machine is used for writing the received data into the corresponding mounted volume and creating a snapshot of the mounted volume.
Based on the deployment, the invention provides a method for realizing cross-cloud quick recovery of a virtual machine based on a cloud platform volume, which comprises the following steps:
performing cross-cloud platform backup on the virtual machine;
and carrying out cross-cloud platform data recovery of the virtual machine based on the backup.
Specifically, performing cross-cloud platform backup on the virtual machine includes:
for a source virtual machine needing backup, a disk snapshot of the virtual machine is created, and a new volume, which can be called a clone volume, is created according to the disk snapshot by utilizing an interface of the cloud platform. Each snapshot volume creates a new volume.
Mounting the created new volume on a backup proxy virtual machine;
creating an empty volume which is as large as a source virtual machine disk on a target end cloud platform, and mounting the volume to a backup server virtual machine;
the method comprises the steps of adopting lvcpy to read corresponding data on a mounting volume of a backup proxy virtual machine and transmitting the corresponding data to a backup server virtual machine on a target end cloud platform;
the virtual machine of the backup server writes the received data into the corresponding mounting volume;
after the writing of all data of the mounted volume of the backup server virtual machine is completed, a snapshot is created for the volume by utilizing a snapshot interface of the cloud platform so as to keep historical version data. The volume snapshot is still on the storage of the target-side cloud platform.
The backup proxy virtual machine uploads the configuration information of the source virtual machine to the backup server virtual machine; the configuration information comprises configuration information of the virtual machines and mounting volume information corresponding to each virtual machine, and records which volumes are starting volumes and which volumes are data volumes.
Unloading the volumes mounted on the virtual machine of the backup server;
and unloading the volumes mounted on the backup proxy virtual machine, and deleting the disk snapshot of the virtual machine.
Further, the method comprises the steps of,
after the backup server virtual machine mounts the volume, a volume mark id is sent to the backup proxy virtual machine, so that the backup proxy virtual machine and the backup server virtual machine are in one-to-one correspondence with each other.
Specifically, the reading of corresponding data on the mounted volume of the backup proxy virtual machine by adopting lvcpy and transmitting the data to the backup server virtual machine on the target end cloud platform comprises the following steps:
the lvcpy analyzes a file system on the mounted volume through an open source interface, obtains a scattered bitmap of effective data on the volume, reads the content of a sector block corresponding to the volume according to the scattered bitmap, sends the read content to a virtual machine of a backup server, and writes the content to the corresponding sector position of the mounted empty volume after the virtual machine of the backup server receives the content.
Further, if there are multiple mounted volumes, multiple lvcpy programs may be called, and multiple mounted volumes may be read simultaneously, respectively.
Further, performing cross-cloud platform backup on the virtual machine further includes:
after each backup is completed, calculating the hash value of the fan block on the mounted volume, analyzing the file system to obtain the effective data position when the next backup is performed, then reading the fan block data, calculating the hash value of the fan block, comparing the hash value with the hash value recorded by the previous backup, and if the comparison results are different, only backing up the changed data, and covering the backup data to the corresponding mounted volume fan block on the virtual machine of the backup server.
Specifically, performing cross-cloud platform data recovery based on the backed-up data includes:
the backup server virtual machine finds out a corresponding starting volume and a corresponding data volume according to the configuration information of the source virtual machine to be subjected to data recovery;
rolling back the starting volume to a specified snapshot, and creating a virtual machine by the cloud platform through the starting volume;
the data volume is rolled back to the specified snapshot and additional volumes are attached to the created virtual machine. The virtual machine realizes the data state of the source virtual machine to be restored, namely, the data restoration of the source virtual machine.
Furthermore, when the backup server virtual machine is also deployed on the cloud platform 1, the virtual machine can be quickly recovered on the cloud platform 1.
The foregoing is merely a preferred embodiment of the present invention, and it should be noted that modifications and variations could be made by those skilled in the art without departing from the technical principles of the present invention, and such modifications and variations should also be regarded as being within the scope of the invention.