Movatterモバイル変換


[0]ホーム

URL:


CN117033084B - Virtual machine backup method and device, electronic equipment and storage medium - Google Patents

Virtual machine backup method and device, electronic equipment and storage medium
Download PDF

Info

Publication number
CN117033084B
CN117033084BCN202311295139.9ACN202311295139ACN117033084BCN 117033084 BCN117033084 BCN 117033084BCN 202311295139 ACN202311295139 ACN 202311295139ACN 117033084 BCN117033084 BCN 117033084B
Authority
CN
China
Prior art keywords
target
backup
full
virtual machine
incremental
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202311295139.9A
Other languages
Chinese (zh)
Other versions
CN117033084A (en
Inventor
钟楷锋
陈立军
贾坤
屈行运
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Barda Technology Co ltd
Original Assignee
Wuhan Barda Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuhan Barda Technology Co ltdfiledCriticalWuhan Barda Technology Co ltd
Priority to CN202311295139.9ApriorityCriticalpatent/CN117033084B/en
Publication of CN117033084ApublicationCriticalpatent/CN117033084A/en
Application grantedgrantedCritical
Publication of CN117033084BpublicationCriticalpatent/CN117033084B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Classifications

Landscapes

Abstract

Translated fromChinese

本申请提供一种虚拟机备份方法、装置、电子设备及存储介质,该方法通过在目标管理程序中进行管理配置后,目标管理程序可自动建立与目标虚拟机的连接,并自动实现对目标虚拟机的备份管理,目标虚拟机不再需要自己创建快照和存储快照以进行备份,因此不会耗费目标虚拟机自身的资源,也不会占用虚拟机本身的磁盘空间,有效保证了目标虚拟机的性能稳定性;此外,通过一次全量备份和多次增量备份的方式进行备份,且在每次进行增量备份后均合并得到最新全量数据,然后将最新全量数据和最新增量数据进行保存,即使最新增量数据损坏或丢失,依然可以根据最新全量数据还原出目标虚拟机。综上,本申请的虚拟机备份方法具有较高的可靠性。

This application provides a virtual machine backup method, device, electronic equipment and storage medium. After the method is managed and configured in the target management program, the target management program can automatically establish a connection with the target virtual machine and automatically realize the target virtual machine backup. The target virtual machine no longer needs to create and store snapshots for backup, so it does not consume the target virtual machine's own resources or occupy the virtual machine's own disk space, effectively ensuring the target virtual machine's Performance stability; in addition, backup is performed through one full backup and multiple incremental backups, and the latest full data is merged after each incremental backup, and then the latest full data and the latest incremental data are saved. Even if the latest incremental data is damaged or lost, the target virtual machine can still be restored based on the latest full data. In summary, the virtual machine backup method of this application has high reliability.

Description

Translated fromChinese
虚拟机备份方法、装置、电子设备及存储介质Virtual machine backup method, device, electronic equipment and storage medium

技术领域Technical field

本申请涉及数据处理技术领域,尤其涉及一种虚拟机备份方法、装置、电子设备及存储介质。The present application relates to the field of data processing technology, and in particular to a virtual machine backup method, device, electronic equipment and storage medium.

背景技术Background technique

在现有技术中,主要采用快照的方式去做虚拟机的增量备份还原,具体为虚拟机先创建某个时间节点的快照,再基于定时策略在多个时间节点多次创建快照,后续可根据需要还原其中某个时间节点的数据,得到该时间节点的虚拟机。In the existing technology, snapshots are mainly used to perform incremental backup and restoration of virtual machines. Specifically, the virtual machine first creates a snapshot of a certain time node, and then creates multiple snapshots at multiple time nodes based on a timing strategy. Subsequently, the virtual machine can Restore the data of a certain time node as needed to obtain the virtual machine of that time node.

然而,第一,创建快照由虚拟机本身来完成,创建过程需要占用虚拟机的资源如CPU、内存和磁盘I/O等,可能会影响虚拟机的性能;第二,每次创建的快照均会记录虚拟机的所有数据,数据量较大,而创建的快照保存在虚拟机的磁盘中,会占用虚拟机的磁盘空间,且占用空间会随着时间的推移不断增长,如果虚拟机频繁使用快照功能,可能会导致磁盘空间不足,影响虚拟机的正常运行;第三,由于快照记录了虚拟机的所有重要数据,如果最新快照发生损坏或丢失,可能会导致虚拟机无法正常启动。However, first, the creation of a snapshot is completed by the virtual machine itself. The creation process requires the resources of the virtual machine such as CPU, memory and disk I/O, which may affect the performance of the virtual machine; second, each snapshot created is All data of the virtual machine will be recorded, and the amount of data is large. The created snapshot will be saved in the disk of the virtual machine, which will occupy the disk space of the virtual machine, and the occupied space will continue to grow over time. If the virtual machine is used frequently The snapshot function may cause insufficient disk space and affect the normal operation of the virtual machine; thirdly, since the snapshot records all important data of the virtual machine, if the latest snapshot is damaged or lost, the virtual machine may not start normally.

因此,当前的虚拟机备份方法存在备份可靠性较低的技术问题,需要改进。Therefore, the current virtual machine backup method has technical problems of low backup reliability and needs to be improved.

发明内容Contents of the invention

本申请实施例提供一种虚拟机备份方法、装置、电子设备及存储介质,用以缓解当前的虚拟机备份方法中备份可靠性较低的技术问题。Embodiments of the present application provide a virtual machine backup method, device, electronic device, and storage medium to alleviate the technical problem of low backup reliability in current virtual machine backup methods.

为解决上述技术问题,本申请实施例提供以下技术方案:In order to solve the above technical problems, the embodiments of this application provide the following technical solutions:

本申请提供一种虚拟机备份方法,包括:This application provides a virtual machine backup method, including:

通过目标管理程序接收针对目标虚拟机的管理配置操作,根据所述管理配置操作,建立与所述目标虚拟机的连接,并确定所述目标虚拟机的全量备份条件和增量备份条件;Receive management configuration operations for the target virtual machine through the target hypervisor, establish a connection with the target virtual machine according to the management configuration operation, and determine the full backup conditions and incremental backup conditions of the target virtual machine;

通过所述目标管理程序监测所述目标虚拟机是否满足所述全量备份条件;Monitor whether the target virtual machine meets the full backup condition through the target management program;

若是,通过所述目标管理程序对所述目标虚拟机的磁盘文件和配置文件进行全量备份,得到第0全量磁盘文件和第0全量配置文件,并确定第0备份时间点;If so, perform a full backup of the disk file and configuration file of the target virtual machine through the target management program, obtain the 0th full disk file and the 0th full configuration file, and determine the 0th backup time point;

通过所述目标管理程序持续监测所述目标虚拟机是否满足所述增量备份条件;Continuously monitor whether the target virtual machine meets the incremental backup condition through the target management program;

若是,将第i次满足时的时间点确定为第i备份时间点,根据第i-1备份时间点和所述第i 备份时间点确定第i增量备份时间段,在所述第i备份时间点,通过所述目标管理程序对所述第i增量备份时间段内所述目标虚拟机的磁盘文件和配置文件进行第i次增量备份,得到第i增量磁盘文件和第i增量配置文件,i为正整数;If so, determine the time point when the i-th time is satisfied as the i-th backup time point, determine the i-th incremental backup time period based on the i-1 backup time point and the i-th backup time point, and determine the i-th incremental backup time period in the i-th backup time point. At the time point, the target management program performs the i-th incremental backup of the disk file and configuration file of the target virtual machine within the i-th incremental backup time period, and obtains the i-th incremental disk file and the i-th incremental backup file. Quantity configuration file, i is a positive integer;

通过所述目标管理程序合并所述第0全量磁盘文件和前i-1个增量磁盘文件,得到第i全量磁盘文件,合并所述第0全量配置文件和前i-1个增量配置文件,得到第i全量配置文件;Merge the 0th full disk file and the first i-1 incremental disk files through the target management program to obtain the ith full disk file, and merge the 0th full configuration file and the first i-1 incremental configuration files , get the i-th full configuration file;

将所述第i全量磁盘文件和所述第i全量配置文件确定为最新全量数据,将所述第i增量磁盘文件和所述第i增量配置文件确定为最新增量数据,通过所述目标管理程序将所述最新全量数据和所述最新增量数据保存至所述目标虚拟机之外的第一目标存储位置。The i-th full disk file and the i-th full configuration file are determined as the latest full data, and the i-th incremental disk file and the i-th incremental configuration file are determined as the latest incremental data. The target management program saves the latest full data and the latest incremental data to a first target storage location outside the target virtual machine.

同时,本申请实施例还提供了一种虚拟机备份装置,包括:At the same time, embodiments of this application also provide a virtual machine backup device, including:

接收模块,用于通过目标管理程序接收针对目标虚拟机的管理配置操作,根据所述管理配置操作,建立与所述目标虚拟机的连接,并确定所述目标虚拟机的全量备份条件和增量备份条件;A receiving module configured to receive management configuration operations for the target virtual machine through the target management program, establish a connection with the target virtual machine according to the management configuration operation, and determine the full backup conditions and increments of the target virtual machine. Backup conditions;

第一监测模块,用于通过所述目标管理程序监测所述目标虚拟机是否满足所述全量备份条件;A first monitoring module, configured to monitor whether the target virtual machine meets the full backup condition through the target management program;

第一全量备份模块,用于若是,通过所述目标管理程序对所述目标虚拟机的磁盘文件和配置文件进行全量备份,得到第0全量磁盘文件和第0全量配置文件,并确定第0备份时间点;The first full backup module is used to perform a full backup of the disk file and configuration file of the target virtual machine through the target management program, obtain the 0th full disk file and the 0th full configuration file, and determine the 0th backup point in time;

第二监测模块,用于通过所述目标管理程序持续监测所述目标虚拟机是否满足所述增量备份条件;a second monitoring module, configured to continuously monitor whether the target virtual machine meets the incremental backup condition through the target management program;

增量备份模块,用于若是,将第i次满足时的时间点确定为第i备份时间点,根据第i-1备份时间点和所述第i 备份时间点确定第i增量备份时间段,在所述第i备份时间点,通过所述目标管理程序对所述第i增量备份时间段内所述目标虚拟机的磁盘文件和配置文件进行第i次增量备份,得到第i增量磁盘文件和第i增量配置文件,i为正整数;The incremental backup module is used to determine the time point when the i-th time is satisfied as the i-th backup time point, and determine the i-th incremental backup time period based on the i-1 backup time point and the i-th backup time point. , at the i-th backup time point, the target management program performs the i-th incremental backup of the disk file and configuration file of the target virtual machine within the i-th incremental backup time period, and obtains the i-th incremental backup. The disk file and the i-th incremental configuration file, i is a positive integer;

合并模块,用于通过所述目标管理程序合并所述第0全量磁盘文件和前i-1个增量磁盘文件,得到第i全量磁盘文件,合并所述第0全量配置文件和前i-1个增量配置文件,得到第i全量配置文件;The merging module is used to merge the 0th full disk file and the first i-1 incremental disk files through the target management program to obtain the ith full disk file, and merge the 0th full configuration file and the first i-1 Incremental configuration file, get the i-th full configuration file;

第一保存模块,用于将所述第i全量磁盘文件和所述第i全量配置文件确定为最新全量数据,将所述第i增量磁盘文件和所述第i增量配置文件确定为最新增量数据,通过所述目标管理程序将所述最新全量数据和所述最新增量数据保存至所述目标虚拟机之外的第一目标存储位置。The first saving module is used to determine the i-th full disk file and the i-th full configuration file as the latest full data, and determine the i-th incremental disk file and the i-th incremental configuration file as the latest Incremental data: save the latest full data and the latest incremental data to a first target storage location outside the target virtual machine through the target management program.

本申请还提供一种电子设备,包括存储器和处理器;所述存储器存储有应用程序,所述处理器用于运行所述存储器内的应用程序,以执行上述任一项所述的虚拟机备份方法中的步骤。This application also provides an electronic device, including a memory and a processor; the memory stores an application program, and the processor is used to run the application program in the memory to execute any one of the above virtual machine backup methods. steps in.

本申请实施例提供一种计算机可读存储介质,计算机可读存储介质存储有多条指令,指令适于处理器进行加载,以执行上述虚拟机备份方法中的步骤。Embodiments of the present application provide a computer-readable storage medium. The computer-readable storage medium stores a plurality of instructions, and the instructions are suitable for loading by the processor to execute the steps in the above virtual machine backup method.

有益效果:本申请提供一种虚拟机备份方法、装置、电子设备及存储介质,该方法通过开发第三方的目标管理程序,在目标管理程序中进行管理配置后,目标管理程序可自动建立与目标虚拟机的连接,并自动实现对目标虚拟机的备份管理,目标虚拟机不再需要自己创建快照和存储快照以进行备份,因此不会耗费目标虚拟机自身的资源,也不会占用虚拟机本身的磁盘空间,有效保证了目标虚拟机的性能稳定性;此外,本申请通过一次全量备份和多次增量备份的方式进行备份,且在每次进行增量备份后,均会将当前备份时间点之前所有的备份数据进行合并得到唯一的最新全量数据,然后将最新全量数据和最新增量数据进行保存,即使最新增量数据损坏或丢失,由于最新全量数据中包含了虚拟机中大部分的信息,依然可以根据最新全量数据还原出目标虚拟机。综上,本申请的虚拟机备份方法具有较高的可靠性。Beneficial effects: This application provides a virtual machine backup method, device, electronic equipment and storage medium. This method develops a third-party target management program. After management and configuration are performed in the target management program, the target management program can automatically establish a connection with the target. The connection of the virtual machine and automatic backup management of the target virtual machine. The target virtual machine no longer needs to create and store snapshots for backup, so it will not consume the resources of the target virtual machine itself, nor occupy the virtual machine itself. disk space, effectively ensuring the performance stability of the target virtual machine; in addition, this application performs backup through one full backup and multiple incremental backups, and after each incremental backup, the current backup time will be Merge all the backup data before the point to obtain the only latest full data, and then save the latest full data and the latest incremental data. Even if the latest incremental data is damaged or lost, because the latest full data contains most of the virtual machine Information, the target virtual machine can still be restored based on the latest full data. In summary, the virtual machine backup method of this application has high reliability.

附图说明Description of the drawings

下面结合附图,通过对本申请的具体实施方式详细描述,将使本申请的技术方案及其它有益效果显而易见。The technical solutions and other beneficial effects of the present application will be apparent through a detailed description of the specific embodiments of the present application in conjunction with the accompanying drawings.

图1是本申请实施例提供的虚拟机备份方法的流程示意图。Figure 1 is a schematic flowchart of a virtual machine backup method provided by an embodiment of the present application.

图2为本申请实施例中KVM管理的策略配置过程示意图。Figure 2 is a schematic diagram of the policy configuration process of KVM management in this embodiment of the present application.

图3为本申请实施例中KVM管理的策略应用过程示意图。Figure 3 is a schematic diagram of the policy application process of KVM management in this embodiment of the present application.

图4为本申请实施例中全量备份和增量备份的过程示意图。Figure 4 is a schematic diagram of the process of full backup and incremental backup in the embodiment of the present application.

图5为本申请实施例提供的虚拟机备份装置的结构示意图。Figure 5 is a schematic structural diagram of a virtual machine backup device provided by an embodiment of the present application.

图6为本申请实施例提供的电子设备的结构示意图。Figure 6 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.

具体实施方式Detailed ways

下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述。显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without making creative efforts fall within the scope of protection of this application.

本申请实施例提供一种虚拟机备份方法、装置、电子设备和计算机可读存储介质,其中,该虚拟机备份装置可以集成在电子设备中,该电子设备可以是服务器,也可以是终端等设备。Embodiments of the present application provide a virtual machine backup method, device, electronic device, and computer-readable storage medium. The virtual machine backup device can be integrated in an electronic device. The electronic device can be a server, a terminal, or other equipment. .

请参阅图1,图1是本申请实施例提供的虚拟机备份方法的流程示意图,该方法具体包括:Please refer to Figure 1. Figure 1 is a schematic flowchart of a virtual machine backup method provided by an embodiment of the present application. The method specifically includes:

S1:通过目标管理程序接收针对目标虚拟机的管理配置操作,根据管理配置操作,建立与目标虚拟机的连接,并确定目标虚拟机的全量备份条件和增量备份条件。S1: Receive management configuration operations for the target virtual machine through the target hypervisor, establish a connection with the target virtual machine based on the management configuration operations, and determine the full backup conditions and incremental backup conditions of the target virtual machine.

本申请实施例中的虚拟机备份方法通过服务端的目标管理程序来实现,目标管理程序为第三方独立软件,在该目标管理程序中进行相关配置后,该程序可用于实现对虚拟机的备份和还原管理。The virtual machine backup method in the embodiment of the present application is implemented through a target management program on the server side. The target management program is a third-party independent software. After relevant configurations are made in the target management program, the program can be used to implement backup and backup of the virtual machine. Restore management.

具体地,管理人员先在目标管理程序的管理配置界面中执行针对目标虚拟机的管理配置操作,目标虚拟机可以是任意一个该程序可支持的虚拟机,管理配置操作是指对目标虚拟机的管理策略进行配置和保存,服务端通过目标管理程序接收针对目标虚拟机的管理配置操作后,可以获取这些管理策略,并基于这些管理策略来自动完成对目标虚拟机的各项管理。Specifically, the administrator first performs the management configuration operation on the target virtual machine in the management configuration interface of the target management program. The target virtual machine can be any virtual machine that the program can support. The management configuration operation refers to the management configuration operation on the target virtual machine. Management policies are configured and saved. After the server receives the management configuration operations for the target virtual machine through the target management program, it can obtain these management policies and automatically complete various management of the target virtual machine based on these management policies.

如图2所示,本申请的虚拟机备份方法适用于KVM(Kernel-based VirtualMachine,基于内核的虚拟机)管理,管理包括备份和还原,各虚拟机均基于Linux内核,同一台物理服务器上可以同时运行多个独立的虚拟机,每个虚拟机具有自己的磁盘文件和配置文件,其中磁盘文件包含了虚拟机的操作系统、应用程序和数据等各类信息,配置文件为XML格式,包含了虚拟机的硬件配置、网络设置、启动顺序等各类配置信息。上述配置的管理策略具体包括策略1、策略2和策略3,策略1为全量备份策略,该策略针对虚拟机的整个磁盘文件和配置文件进行管理,策略2为增量备份策略,该策略针对增量磁盘文件和增量配置文件进行管理,策略3为虚拟机还原策略,该策略针对所有已备份数据进行新虚拟机的还原管理。As shown in Figure 2, the virtual machine backup method of this application is suitable for KVM (Kernel-based Virtual Machine, kernel-based virtual machine) management. Management includes backup and restore. Each virtual machine is based on the Linux kernel and can be run on the same physical server. Run multiple independent virtual machines at the same time. Each virtual machine has its own disk file and configuration file. The disk file contains various information such as the operating system, applications and data of the virtual machine. The configuration file is in XML format and contains Various configuration information such as the virtual machine's hardware configuration, network settings, startup sequence, etc. The management strategies configured above specifically include strategy 1, strategy 2 and strategy 3. Strategy 1 is a full backup strategy, which manages the entire disk file and configuration files of the virtual machine. Strategy 2 is an incremental backup strategy, which is for incremental backups. Volume disk files and incremental configuration files are managed. Strategy 3 is the virtual machine restoration strategy, which manages the restoration of new virtual machines for all backed up data.

在本实施例中,先根据管理配置操作建立起目标管理程序与目标虚拟机的连接,也即使得目标管理程序具有对目标虚拟机的管理权限,然后从配置的管理策略1和管理策略2中确定目标虚拟机的全量备份条件和增量备份条件。其中,全量备份条件是指虚拟机需要进行全量备份时所需满足的条件,增量备份备份条件是指虚拟机需要进行增量备份时所需满足的条件,全量备份是指对虚拟机的所有磁盘文件和所有配置文件均进行备份,增量备份是指对虚拟机的磁盘文件和配置文件在某个时间段内的变化数据进行备份。本实施例对目标虚拟机会经过一次全量备份和多次增量备份。In this embodiment, the connection between the target hypervisor and the target virtual machine is first established according to the management configuration operation, that is, the target hypervisor has the management authority for the target virtual machine, and then the configured management policy 1 and management policy 2 are selected. Determine the full backup conditions and incremental backup conditions of the target virtual machine. Among them, the full backup conditions refer to the conditions that need to be met when the virtual machine needs to be fully backed up. The incremental backup backup conditions refer to the conditions that need to be met when the virtual machine needs to be incrementally backed up. The full backup refers to all the backup of the virtual machine. Disk files and all configuration files are backed up. Incremental backup refers to backing up the changed data of the virtual machine's disk files and configuration files within a certain period of time. In this embodiment, the target virtual machine undergoes one full backup and multiple incremental backups.

S2:通过目标管理程序监测目标虚拟机是否满足全量备份条件。S2: Use the target management program to monitor whether the target virtual machine meets the full backup conditions.

全量备份条件具体包括虚拟机处于初始启动状态,目标管理程序在建立与目标虚拟机的连接后,会先监测目标虚拟机是否处于初始启动状态。The conditions for full backup specifically include that the virtual machine is in the initial startup state. After the target management program establishes a connection with the target virtual machine, it will first monitor whether the target virtual machine is in the initial startup state.

S3:若是,通过目标管理程序对目标虚拟机的磁盘文件和配置文件进行全量备份,得到第0全量磁盘文件和第0全量配置文件,并确定第0备份时间点。S3: If so, perform a full backup of the disk files and configuration files of the target virtual machine through the target management program, obtain the 0th full disk file and the 0th full configuration file, and determine the 0th backup time point.

当目标管理程序监测到目标虚拟机处于初始启动状态时,判断其满足全量备份条件,此时,目标管理程序会将当前时间点确定为第0备份时间点,并在该时间点对目标虚拟机的磁盘文件和配置文件进行全量备份,得到第0全量磁盘文件和第0全量配置文件。如图3所示,该过程基于策略1来进行。When the target management program detects that the target virtual machine is in the initial startup state, it determines that it meets the full backup conditions. At this time, the target management program determines the current time point as the 0th backup time point, and performs backup of the target virtual machine at that time point. Perform a full backup of the disk files and configuration files, and obtain the 0th full disk file and the 0th full configuration file. As shown in Figure 3, the process is based on strategy 1.

具体地,目标虚拟机包括磁盘文件和配置文件,磁盘文件包含了目标虚拟机的操作系统、应用程序和数据等各类信息,配置文件为XML格式,包含了目标虚拟机的硬件配置、网络设置、启动顺序等各类配置信息。在检测到满足全量备份条件时,目标管理程序可以调用qemu-img命令行工具,该工具可以用于创建、转换和管理各种磁盘映像文件,调用该工具可以实现对目标虚拟机中磁盘文件和配置文件进行全量备份。Specifically, the target virtual machine includes a disk file and a configuration file. The disk file contains various information such as the operating system, applications, and data of the target virtual machine. The configuration file is in XML format and contains the hardware configuration and network settings of the target virtual machine. , startup sequence and other various configuration information. When it is detected that the full backup conditions are met, the target management program can call the qemu-img command line tool. This tool can be used to create, convert and manage various disk image files. Calling this tool can realize the disk files and files in the target virtual machine. Full backup of configuration files.

S4:通过目标管理程序持续监测目标虚拟机是否满足增量备份条件。S4: Continuously monitor whether the target virtual machine meets the incremental backup conditions through the target management program.

在全量备份结束后,目标管理程序会监测目标虚拟机是否满足增量备份条件,由于目标虚拟机通常会持续运行较长时间,为保证备份数据的时效性,需要进行多次增量备份,因此目标管理程序对于目标虚拟机是否满足增量备份条件的监测需要持续进行。After the full backup is completed, the target management program will monitor whether the target virtual machine meets the incremental backup conditions. Since the target virtual machine usually continues to run for a long time, multiple incremental backups are required to ensure the timeliness of the backup data. Therefore, The target hypervisor needs to continuously monitor whether the target virtual machine meets the incremental backup conditions.

在一种实施例中,S4具体包括:In one embodiment, S4 specifically includes:

S41:通过目标管理程序获取第一增量备份条件、第二增量备份条件和第三增量备份条件,第一增量备份条件为虚拟机数据发生变化,第二增量备份条件为当前时间点到达定时备份策略中的目标时间点,第三增量备份条件为虚拟机状态发生变化。S41: Obtain the first incremental backup condition, the second incremental backup condition and the third incremental backup condition through the target management program. The first incremental backup condition is that the virtual machine data changes, and the second incremental backup condition is the current time. When the target time point in the scheduled backup policy is reached, the third incremental backup condition is that the virtual machine status changes.

S42:通过目标管理程序持续监测目标虚拟机是否满足第一增量备份条件、第二增量备份条件和第三增量备份条件中的任意一者。S42: Use the target management program to continuously monitor whether the target virtual machine meets any one of the first incremental backup condition, the second incremental backup condition, and the third incremental backup condition.

上述步骤中管理人员在执行管理配置操作时,会从三方面对增量备份条件进行配置,且指定只要后续满足三个条件中的任意一者即需要进行一次增量备份。具体地,增量备份条件包括第一增量备份条件、第二增量备份条件和第三增量备份条件,其中,第一增量备份条件为虚拟机数据发生变化,数据发生变化是指磁盘文件和配置文件中任意一者的数据发生了变化;第二增量备份条件为当前时间点到达定时备份策略中的目标时间点,如定时备份策略为每隔5分钟进行一次增量备份,假设初始备份时间点为10点,如果当前时间点为10点5分时需要进行一次增量备份,当前时间点为10点10分时也需要进行一次增量备份,以此类推;第三增量备份条件为虚拟机状态发生变化,状态发生变化是指虚拟机由正常运行状态变化为开机、关机或挂起的状态。In the above steps, when administrators perform management configuration operations, they will configure incremental backup conditions from three aspects, and specify that as long as any one of the three conditions is met, an incremental backup needs to be performed. Specifically, the incremental backup conditions include a first incremental backup condition, a second incremental backup condition, and a third incremental backup condition, where the first incremental backup condition is a change in virtual machine data, and a change in data refers to a change in disk data. The data in either file or configuration file has changed; the second incremental backup condition is that the current time point reaches the target time point in the scheduled backup policy. For example, the scheduled backup policy is to perform an incremental backup every 5 minutes. Assume The initial backup time point is 10 o'clock. If the current time point is 10:05, an incremental backup is required. When the current time point is 10:10, an incremental backup is also required, and so on; the third increment The backup condition is a change in the status of the virtual machine. A change in status means that the virtual machine changes from a normal running state to a powered on, powered off or suspended state.

在配置后,目标管理程序可以获取这三类增量备份条件,然后持续监测目标虚拟机是否满足第一增量备份条件、第二增量备份条件和第三增量备份条件中的任意一者。After configuration, the target hypervisor can obtain these three types of incremental backup conditions, and then continuously monitor whether the target virtual machine meets any of the first incremental backup condition, the second incremental backup condition, and the third incremental backup condition. .

在现有技术中,备份策略仅为定时备份,则当虚拟机的运行状态或数据在两次备份之间的时间段内发生变化时,快照并不会立即记录这些变化,而是需要根据定时策略等待下一次快照操作时才会记录,在此期间可能存在数据一致性问题。而在本申请实施例中,综合虚拟机数据变化、定时策略、虚拟机状态变化这三个方面来设置增量备份条件,当满足任意一者时即可进行增量备份,因此有利于提升数据一致性。In the existing technology, the backup strategy is only scheduled backup. When the running status or data of the virtual machine changes during the time period between two backups, the snapshot will not record these changes immediately, but needs to be based on scheduled backups. The policy waits for the next snapshot operation before recording, and there may be data consistency issues during this period. In the embodiment of this application, incremental backup conditions are set based on three aspects: virtual machine data changes, timing policies, and virtual machine status changes. When any one of the conditions is met, incremental backup can be performed, which is beneficial to improving data consistency.

S5:若是,将第i次满足时的时间点确定为第i备份时间点,根据第i-1备份时间点和第i 备份时间点确定第i增量备份时间段,在第i备份时间点,通过目标管理程序对第i增量备份时间段内目标虚拟机的磁盘文件和配置文件进行第i次增量备份,得到第i增量磁盘文件和第i增量配置文件,i为正整数。S5: If so, determine the time point when the i-th is satisfied as the i-th backup time point, determine the i-th incremental backup time period based on the i-1 backup time point and the i-th backup time point, and determine the i-th incremental backup time period at the i-th backup time point. , perform the i-th incremental backup of the disk file and configuration file of the target virtual machine within the i-th incremental backup time period through the target management program, and obtain the i-th incremental disk file and i-th incremental configuration file, i is a positive integer .

当目标管理程序监测到目标虚拟机满足增量备份条件时,会从第1次开始,将每次满足时的时间点均确定为一个备份时间点,第i次确定的为第i备份时间点,i为正整数,同时,将位于第i-1备份时间点和第i 备份时间点之间的时间段确定为第i增量备份时间段。然后,调用qemu-img命令行工具对第i增量备份时间段目标虚拟机的磁盘文件和配置文件进行第i次增量备份,得到第i增量磁盘文件和第i增量配置文件,第i增量磁盘文件和第i增量配置文件包含的数据仅为第i增量备份时间段内发生了变化的数据,因此数据量较小。如图3所示,该过程基于多次策略2来进行。When the target management program detects that the target virtual machine meets the incremental backup conditions, it will determine each time point as a backup time point starting from the first time, and the i-th time point will be the i-th backup time point. , i is a positive integer, and at the same time, the time period between the i-1th backup time point and the i-th backup time point is determined as the i-th incremental backup time period. Then, call the qemu-img command line tool to perform the i-th incremental backup of the disk file and configuration file of the target virtual machine in the i-th incremental backup time period, and obtain the i-th incremental disk file and i-th incremental configuration file. The data contained in the i incremental disk file and the i-th incremental configuration file is only the data that has changed during the i-th incremental backup time period, so the amount of data is small. As shown in Figure 3, this process is performed based on multiple strategy 2.

S6:通过目标管理程序合并第0全量磁盘文件和前i-1个增量磁盘文件,得到第i全量磁盘文件,合并第0全量配置文件和前i-1个增量配置文件,得到第i全量配置文件。S6: Merge the 0th full disk file and the first i-1 incremental disk files through the target management program to obtain the i-th full disk file. Merge the 0th full disk file and the first i-1 incremental configuration files to obtain the i-th full disk file. Full configuration file.

在产生了第i增量磁盘文件和第i增量配置文件后,目标管理程序会将第0全量磁盘文件和前i-1个增量磁盘文件合并为第i全量磁盘文件,且将第0全量配置文件和前i-1个增量配置文件合并为第i全量配置文件,使得合并后仅保留一个全量磁盘文件和最后一个增量磁盘文件、以及一个全量配置文件和最后一个增量配置文件,具体如图3所示。After generating the i-th incremental disk file and the i-th incremental configuration file, the target management program will merge the 0th full disk file and the first i-1 incremental disk files into the i-th full disk file, and merge the 0th full disk file with the i-th incremental disk file. The full configuration file and the first i-1 incremental configuration files are merged into the i-th full configuration file, so that only one full disk file and the last incremental disk file, and one full configuration file and the last incremental configuration file remain after the merger. , as shown in Figure 3.

在一种实施例中,S6具体包括:In one embodiment, S6 specifically includes:

S61:在i等于1时,将第0全量磁盘文件确定为第i全量磁盘文件,将第0全量配置文件确定为第i全量配置文件。S61: When i equals 1, determine the 0th full disk file as the i-th full disk file, and determine the 0th full configuration file as the i-th full configuration file.

S62:在i大于1时,通过目标管理程序合并第i-1全量磁盘文件和第i-1增量磁盘文件,得到第i全量磁盘文件,通过目标管理程序合并第i-1全量配置文件和第i-1增量配置文件,得到第i全量配置文件。S62: When i is greater than 1, merge the i-1 full disk file and the i-1 incremental disk file through the target management program to obtain the i-th full disk file, and merge the i-1 full configuration file and i-1 through the target management program. The i-1th incremental configuration file is used to obtain the i-th full configuration file.

如图4所示,先对目标虚拟机进行全量备份得到第0全量磁盘文件和第0全量配置文件,然后监测目标虚拟机是否满足增量备份条件。As shown in Figure 4, first perform a full backup of the target virtual machine to obtain the 0th full disk file and the 0th full configuration file, and then monitor whether the target virtual machine meets the incremental backup conditions.

在第1次满足时,进行第1次增量备份,得到第1增量磁盘文件和第1增量配置文件,同时将第0全量磁盘文件直接确定为第i全量磁盘文件,将第0全量配置文件直接确定为第i全量配置文件。When the first satisfaction is met, the first incremental backup is performed to obtain the first incremental disk file and the first incremental configuration file. At the same time, the 0th full disk file is directly determined as the i-th full disk file, and the 0th full disk file is The configuration file is directly determined as the i-th full configuration file.

然后,继续监测目标虚拟机是否满足增量备份条件,在第2次满足时,进行第2次增量备份,得到第2增量磁盘文件和第2增量配置文件,同时,合并第1全量磁盘文件和第1增量磁盘文件作为第2全量磁盘文件,合并第1全量配置文件和第1增量配置文件作为第2全量配置文件。此时,目标管理程序中保留有第2全量磁盘文件和第2全量配置文件、以及第2增量磁盘文件和第2增量配置文件。Then, continue to monitor whether the target virtual machine meets the incremental backup conditions. When it is satisfied for the second time, perform the second incremental backup to obtain the second incremental disk file and the second incremental configuration file. At the same time, merge the first full volume The disk file and the first incremental disk file are used as the second full disk file, and the first full configuration file and the first incremental configuration file are combined as the second full configuration file. At this time, the target management program retains the second full disk file and the second full configuration file, as well as the second incremental disk file and the second incremental configuration file.

继续监测目标虚拟机是否满足增量备份条件,在第3次满足时,进行第3次增量备份,得到第3增量磁盘文件和第3增量配置文件,同时,合并第2全量磁盘文件和第2增量磁盘文件作为第3全量磁盘文件,合并第2全量配置文件和第2增量配置文件作为第3全量配置文件。此时,目标管理程序中保留有第3全量磁盘文件和第3全量配置文件、以及第3增量磁盘文件和第3增量配置文件。Continue to monitor whether the target virtual machine meets the incremental backup conditions. When it is satisfied for the third time, perform the third incremental backup to obtain the third incremental disk file and the third incremental configuration file. At the same time, merge the second full disk file. and the second incremental disk file as the third full disk file, and merge the second full configuration file and the second incremental configuration file as the third full configuration file. At this time, the third full disk file and the third full configuration file, as well as the third incremental disk file and the third incremental configuration file remain in the target management program.

依次类推,后续每进行一次增量备份,均可对将前一次的增量备份数据和全量备份数据进行合并,得到新的全量备份数据,使得目标管理程序中仅保留一份全量备份数据和一份增量备份数据。By analogy, for each subsequent incremental backup, the previous incremental backup data and full backup data can be merged to obtain new full backup data, so that only one full backup data and one full backup data are retained in the target management program. Incremental backup data.

S7:将第i全量磁盘文件和第i全量配置文件确定为最新全量数据,将第i增量磁盘文件和第i增量配置文件确定为最新增量数据,通过目标管理程序将最新全量数据和最新增量数据保存至目标虚拟机之外的第一目标存储位置。S7: Determine the i-th full disk file and i-th full configuration file as the latest full data, determine the i-th incremental disk file and i-th incremental configuration file as the latest incremental data, and use the target management program to combine the latest full data and The latest incremental data is saved to the first target storage location outside the target virtual machine.

在第i次增量备份后,将第i全量磁盘文件和第i全量配置文件确定为最新全量数据,将第i增量磁盘文件和第i增量配置文件确定为最新增量数据。在进行管理配置时,还需要对备份数据的存储位置进行配置,在配置后,目标管理程序可以根据该配置信息,将最新全量数据和最新增量数据保存至目标虚拟机之外的第一目标存储位置。本领域的技术人员可根据需要,选择对每次产生的最新全量数据和最新增量数据均进行一次保存,也可以仅选择对某次或某几次的最新全量数据和最新增量数据进行保存。After the i-th incremental backup, the i-th full disk file and the i-th full configuration file are determined as the latest full data, and the i-th incremental disk file and the i-th incremental configuration file are determined as the latest incremental data. When performing management configuration, you also need to configure the storage location of the backup data. After configuration, the target management program can save the latest full data and the latest incremental data to the first target outside the target virtual machine based on the configuration information. storage location. Those skilled in the art can choose to save the latest full data and the latest incremental data generated each time as needed, or they can only choose to save the latest full data and the latest incremental data for a certain time or a few times. .

在现有技术中,创建快照由虚拟机本身来完成,创建过程需要占用虚拟机的资源如CPU、内存和磁盘I/O等,可能会影响虚拟机的性能。而在本申请实施例中,整个备份过程都由第三方的目标管理程序来完成,目标虚拟机不再需要自己创建快照和存储快照以进行备份,因此不会耗费目标虚拟机自身的资源,有效保证了目标虚拟机的性能稳定性。In the existing technology, creating a snapshot is completed by the virtual machine itself. The creation process requires the resources of the virtual machine such as CPU, memory, disk I/O, etc., which may affect the performance of the virtual machine. In the embodiment of this application, the entire backup process is completed by a third-party target management program. The target virtual machine no longer needs to create and store snapshots for backup. Therefore, the target virtual machine's own resources will not be consumed, effectively The performance stability of the target virtual machine is guaranteed.

在现有技术中,由于创建的快照均会记录虚拟机的所有数据,数据量较大,而创建的快照保存在虚拟机的磁盘中,会占用虚拟机的磁盘空间,且占用空间会随着时间的推移不断增长,如果虚拟机频繁使用快照功能,可能会导致磁盘空间不足,影响虚拟机的正常运行。而在本申请实施例中,第一次进行全量备份,后续每次仅进行增量备份,因此每次增量数据的数据量均会较小,且由于备份通过第三方的目标管理程序来完成,可以自定义备份数据的存储位置,则可以将这些数据保存在目标虚拟机之外的第一目标存储位置,不占用目标虚拟机的磁盘空间,保证了虚拟机的正常运行。In the existing technology, since the created snapshot will record all the data of the virtual machine, the amount of data is large, and the created snapshot is saved in the disk of the virtual machine, which will occupy the disk space of the virtual machine, and the occupied space will increase with time. As time goes by, if the virtual machine frequently uses the snapshot function, it may cause insufficient disk space and affect the normal operation of the virtual machine. In the embodiment of this application, a full backup is performed for the first time, and only incremental backups are performed each subsequent time. Therefore, the amount of data in each incremental data will be smaller, and because the backup is completed through a third-party target management program , the storage location of the backup data can be customized, and the data can be saved in the first target storage location outside the target virtual machine, without occupying the disk space of the target virtual machine, ensuring the normal operation of the virtual machine.

在现有技术中,由于快照记录了虚拟机的所有重要数据,如果最新快照发生损坏或丢失,可能会导致虚拟机无法正常启动。而在本申请实施例中,通过一次全量备份和多次增量备份的方式进行备份,且在每次进行增量备份后,均会将当前备份时间点之前所有的备份数据进行合并得到唯一的最新全量数据,然后将最新全量数据和最新增量数据进行保存,即使最新增量数据损坏或丢失,由于最新全量数据中包含了虚拟机中大部分的信息,依然可以根据最新全量数据还原出目标虚拟机。In the existing technology, since the snapshot records all important data of the virtual machine, if the latest snapshot is damaged or lost, the virtual machine may not start normally. In the embodiment of this application, backup is performed through one full backup and multiple incremental backups, and after each incremental backup, all backup data before the current backup time point will be merged to obtain a unique The latest full data, and then save the latest full data and the latest incremental data. Even if the latest incremental data is damaged or lost, because the latest full data contains most of the information in the virtual machine, the target can still be restored based on the latest full data. virtual machine.

在一种实施例中,在S7之后还包括:In one embodiment, after S7, it also includes:

S7a:通过目标管理程序对最新全量数据进行全量备份,得到目标备份数据。S7a: Perform a full backup of the latest full data through the target management program to obtain the target backup data.

S7b:将目标备份数据存储至目标虚拟机之外的第二目标存储位置,第二目标存储位置与第一目标存储位置不同。S7b: Store the target backup data in a second target storage location outside the target virtual machine, where the second target storage location is different from the first target storage location.

在得到最新全量数据后,可以对最新全量数据再次进行全量备份,并将得到的目标备份数据存储至第二目标存储位置。由于最新全量数据包含的数据量较大,且包含了还原目标虚拟机时的大部分信息,为减小风险,可以对最新全量数据进行二次备份和存储,这样即使最新全量数据出现了损坏或丢失,仍然可以根据目标备份数据和最新增量数据还原出目标虚拟机,因此实现风险的进一步降低。After obtaining the latest full amount of data, the latest full amount of data can be fully backed up again, and the obtained target backup data can be stored in the second target storage location. Since the latest full data contains a large amount of data and contains most of the information when restoring the target virtual machine, in order to reduce the risk, the latest full data can be backed up and stored twice, so that even if the latest full data is damaged or If it is lost, the target virtual machine can still be restored based on the target backup data and the latest incremental data, thus further reducing the risk.

在一种实施例中,S1还包括:根据管理配置操作,确定虚拟机还原条件,虚拟机还原条件包括虚拟机的文件状态出现异常。In one embodiment, S1 further includes: determining virtual machine restoration conditions according to the management configuration operation, where the virtual machine restoration conditions include an abnormality in the file status of the virtual machine.

在进行管理配置操作时,还需要对虚拟机还原条件进行配置,虚拟机还原条件具体可包括虚拟机的文件状态出现异常,文件包括磁盘文件和配置文件中的任意一者,异常可以例如目标虚拟机中理论上存在数据A,但实际访问时没有查询到数据A。When performing management configuration operations, you also need to configure the virtual machine restoration conditions. The virtual machine restoration conditions may include abnormalities in the file status of the virtual machine. The files include any one of disk files and configuration files. Abnormalities may include, for example, the target virtual machine. Data A theoretically exists in the machine, but data A is not queried during actual access.

在一种实施例中,在S7之后还包括:In one embodiment, after S7, it also includes:

S7c:通过目标管理程序监测目标虚拟机是否满足虚拟机还原条件。S7c: Monitor whether the target virtual machine meets the virtual machine restoration conditions through the target management program.

S7d:若是,从前i个备份时间点中确定待还原的目标时间点。S7d: If yes, determine the target time point to be restored from the previous i backup time points.

S7e:根据目标时间点,从最新全量数据和最新增量数据中确定待还原的目标数据,目标数据包括目标磁盘文件和目标配置文件。S7e: Based on the target time point, determine the target data to be restored from the latest full data and the latest incremental data. The target data includes the target disk file and the target configuration file.

S7f:根据目标磁盘文件和目标配置文件,通过目标管理程序还原出位于目标时间点之前的目标虚拟机。S7f: Based on the target disk file and target configuration file, restore the target virtual machine before the target time point through the target management program.

在设置了虚拟机还原条件后,目标管理程序可以监测目标虚拟机是否出现了文件状态异常的情况,如果出现,则需要进行还原。此时,可以先从前i个备份时间点中确定待还原的目标时间点,目标时间点的确定有多种方式,例如,可以在进行管理配置操作时对目标时间点进行预先配置,配置内容可以是以监测到出现异常的时间点开始,往前推j个备份时间点来作为目标时间点,j可以是任意不大于i的正整数;或者,可以在监测到出现异常时展示选择界面,再由管理人员在界面中对前i个备份时间点中的某个时间点执行选择操作后将其确定为目标时间点。在目标时间点确定后,目标管理程序可以从最新全量数据和最新增量数据中确定位于目标时间点之前的所有数据,将其确定为待还原的目标数据,然后根据目标磁盘文件和目标配置文件还原出目标时间点对应的目标虚拟机。如图3所示,该过程基于策略3来进行。After setting the virtual machine restoration conditions, the target management program can monitor whether the target virtual machine has abnormal file status. If so, it needs to be restored. At this time, the target time point to be restored can be determined from the previous i backup time points. There are many ways to determine the target time point. For example, the target time point can be pre-configured during management configuration operations. The configuration content can be It starts from the time point when an abnormality is detected, and pushes j backup time points forward as the target time point. j can be any positive integer not greater than i; or, the selection interface can be displayed when an abnormality is detected, and then The administrator selects a time point among the previous i backup time points in the interface and determines it as the target time point. After the target time point is determined, the target management program can determine all the data before the target time point from the latest full data and the latest incremental data, determine it as the target data to be restored, and then based on the target disk file and target configuration file Restore the target virtual machine corresponding to the target time point. As shown in Figure 3, the process is based on strategy 3.

在现有技术中,通常为人工发现异常,然后手动去选择还原的时间点来目标虚拟机的还原,操作复杂,效率较低。而在本申请实施例中,可以通过目标管理程序对目标虚拟机的文件状态进行自动监测,在监测到异常时,还可以根据预先对目标时间点的配置数据来自动确定目标时间点,进而自动还原出目标时间点对应的目标虚拟机,因此还原效率较高。In the existing technology, abnormalities are usually discovered manually, and then a restoration time point is manually selected to restore the target virtual machine. The operation is complex and the efficiency is low. In the embodiment of the present application, the file status of the target virtual machine can be automatically monitored through the target management program. When an abnormality is detected, the target time point can also be automatically determined based on the pre-configured data of the target time point, and then automatically The target virtual machine corresponding to the target time point is restored, so the restoration efficiency is high.

在一种实施例中,在S7之后还包括:In one embodiment, after S7, it also includes:

S7g:判断第i备份时间点中i的数值是否等于预设阈值。S7g: Determine whether the value of i in the i-th backup time point is equal to the preset threshold.

S7h:若是,通过目标管理程序对目标虚拟机的磁盘文件和配置文件进行全量备份,得到参考全量磁盘文件和参考全量配置文件,且通过目标管理程序对最新全量数据和最新增量数据进行合并,得到实际全量磁盘文件和实际全量配置文件。S7h: If so, perform a full backup of the disk files and configuration files of the target virtual machine through the target management program to obtain the reference full disk file and reference full configuration file, and merge the latest full data and the latest incremental data through the target management program. Get the actual full disk file and the actual full configuration file.

S7i:对比参考全量磁盘文件和实际全量磁盘文件,得到第一对比结果,对比参考全量配置文件和实际全量配置文件,得到第二对比结果。S7i: Compare the reference full disk file and the actual full disk file to obtain the first comparison result, and compare the reference full configuration file and the actual full configuration file to obtain the second comparison result.

S7j:在第一对比结果和第二对比结果中的任意一者表征不一致时,通过目标管理程序生成告警信息。S7j: When the representation of any one of the first comparison result and the second comparison result is inconsistent, generate an alarm information through the target management program.

在本实施例中,可以先配置多个预设阈值,例如30、60、90等,在每次监测到目标虚拟机满足增量备份条件时,对i进行计数,并判断i是否等于其中的某个预设阈值,如果不等于,则正常执行上述步骤S5至S7,得到最新全量数据和最新增量数据。如果i等于某个预设阈值,例如i等于30,也即第30次满足增量备份条件时,可以先执行上述步骤S5至S7得到最新全量数据和最新增量数据。然后,在该时间点对目标虚拟机的磁盘文件和配置文件进行全量备份,得到参考全量磁盘文件和参考全量配置文件,同时,将最新全量数据和最新增量数据进行合并,得到实际全量磁盘文件和实际全量配置文件。再然后,对比参考全量磁盘文件和实际全量磁盘文件,得到第一对比结果,对比参考全量配置文件和实际全量配置文件,得到第二对比结果。如果备份过程没有出现异常,则第一对比结果和第二对比结果的内容应该均为一致,而如果第一对比结果和第二对比结果中有任意一者的结果为两份文件不一致,则表示备份过程出现了异常。此时,可以生成告警信息并通过目标管理程序展示给管理人员,以使得管理人员可以及时得知并采取相应措施。In this embodiment, multiple preset thresholds can be configured first, such as 30, 60, 90, etc. Each time it is detected that the target virtual machine meets the incremental backup conditions, i is counted, and it is determined whether i is equal to one of them. If it is not equal to a certain preset threshold, perform the above steps S5 to S7 normally to obtain the latest full data and the latest incremental data. If i is equal to a certain preset threshold, for example, i is equal to 30, that is, when the incremental backup conditions are met for the 30th time, the above steps S5 to S7 can be performed first to obtain the latest full data and the latest incremental data. Then, perform a full backup of the disk files and configuration files of the target virtual machine at this point in time to obtain the reference full disk file and the reference full configuration file. At the same time, the latest full data and the latest incremental data are merged to obtain the actual full disk file. and the actual full configuration file. Then, the reference full disk file and the actual full disk file are compared to obtain the first comparison result, and the reference full configuration file and the actual full configuration file are compared to obtain the second comparison result. If there is no abnormality in the backup process, the contents of the first comparison result and the second comparison result should be consistent. If either of the first comparison result and the second comparison result shows that the two files are inconsistent, it means An exception occurred during the backup process. At this time, alarm information can be generated and displayed to managers through the target management program, so that managers can learn about it in time and take corresponding measures.

在虚拟机的备份过程中,如果备份过程、合并过程或者保存过程等出现了异常,而异常又没有及时被管理人员得知,后续还原时得到的目标虚拟机也会出现问题。在本申请实施例中,通过设置上述机制,可以每间隔一段时间对最新全量数据和最新增量数据进行一次异常检测,当参考备份数据和实际备份数据出现不一致的情况时,可生成告警信息,以便于管理人员及时发现异常并采取相应措施,降低还原后也出现异常的风险。During the backup process of a virtual machine, if an abnormality occurs in the backup process, merge process, or saving process, and the abnormality is not informed by the administrator in time, problems will also occur in the target virtual machine obtained during subsequent restoration. In the embodiment of this application, by setting the above mechanism, anomaly detection can be performed on the latest full data and the latest incremental data at intervals. When the reference backup data and the actual backup data are inconsistent, an alarm message can be generated. This allows managers to detect abnormalities in a timely manner and take corresponding measures to reduce the risk of abnormalities occurring after restoration.

综合上述各实施例可知,本申请的虚拟机备份方法具有较高的可靠性。Based on the above embodiments, it can be seen that the virtual machine backup method of the present application has high reliability.

在上述实施例所述方法的基础上,本实施例将从虚拟机备份装置的角度进一步进行描述,请参阅图5,虚拟机备份装置可以包括:Based on the method described in the above embodiment, this embodiment will further describe it from the perspective of a virtual machine backup device. Please refer to Figure 5. The virtual machine backup device may include:

接收模块10,用于通过目标管理程序接收针对目标虚拟机的管理配置操作,根据所述管理配置操作,建立与所述目标虚拟机的连接,并确定所述目标虚拟机的全量备份条件和增量备份条件;The receiving module 10 is configured to receive the management configuration operation for the target virtual machine through the target management program, establish a connection with the target virtual machine according to the management configuration operation, and determine the full backup conditions and growth rate of the target virtual machine. Quantity backup conditions;

第一监测模块20,用于通过所述目标管理程序监测所述目标虚拟机是否满足所述全量备份条件;The first monitoring module 20 is configured to monitor whether the target virtual machine meets the full backup condition through the target management program;

第一全量备份模块30,用于若是,通过所述目标管理程序对所述目标虚拟机的磁盘文件和配置文件进行全量备份,得到第0全量磁盘文件和第0全量配置文件,并确定第0备份时间点;The first full backup module 30 is configured to, if so, perform a full backup of the disk file and configuration file of the target virtual machine through the target management program, obtain the 0th full disk file and the 0th full configuration file, and determine the 0th full disk file and configuration file. Backup time point;

第二监测模块40,用于通过所述目标管理程序持续监测所述目标虚拟机是否满足所述增量备份条件;The second monitoring module 40 is configured to continuously monitor whether the target virtual machine meets the incremental backup condition through the target management program;

增量备份模块50,用于若是,将第i次满足时的时间点确定为第i备份时间点,根据第i-1备份时间点和所述第i 备份时间点确定第i增量备份时间段,在所述第i备份时间点,通过所述目标管理程序对所述第i增量备份时间段内所述目标虚拟机的磁盘文件和配置文件进行第i次增量备份,得到第i增量磁盘文件和第i增量配置文件,i为正整数;The incremental backup module 50 is used to determine the time point when the i-th time is satisfied as the i-th backup time point, and determine the i-th incremental backup time based on the i-1 backup time point and the i-th backup time point. segment, at the i-th backup time point, the target management program performs the i-th incremental backup of the disk file and configuration file of the target virtual machine in the i-th incremental backup time period, and obtains the i-th incremental backup. Incremental disk file and i-th incremental configuration file, i is a positive integer;

合并模块60,用于通过所述目标管理程序合并所述第0全量磁盘文件和前i-1个增量磁盘文件,得到第i全量磁盘文件,合并所述第0全量配置文件和前i-1个增量配置文件,得到第i全量配置文件;The merging module 60 is used to merge the 0th full disk file and the first i-1 incremental disk files through the target management program to obtain the i-th full disk file, and merge the 0th full configuration file and the first i- 1 incremental configuration file to obtain the i-th full configuration file;

第一保存模块70,用于将所述第i全量磁盘文件和所述第i全量配置文件确定为最新全量数据,将所述第i增量磁盘文件和所述第i增量配置文件确定为最新增量数据,通过所述目标管理程序将所述最新全量数据和所述最新增量数据保存至所述目标虚拟机之外的第一目标存储位置。The first saving module 70 is used to determine the i-th full disk file and the i-th full configuration file as the latest full data, and determine the i-th incremental disk file and the i-th incremental configuration file as For the latest incremental data, the target management program saves the latest full data and the latest incremental data to a first target storage location outside the target virtual machine.

在一种实施例中,第二监测模块40包括:In one embodiment, the second monitoring module 40 includes:

获取子模块,用于通过所述目标管理程序获取第一增量备份条件、第二增量备份条件和第三增量备份条件,所述第一增量备份条件为虚拟机数据发生变化,所述第二增量备份条件为当前时间点到达定时备份策略中的目标时间点,所述第三增量备份条件为虚拟机状态发生变化;Obtain submodule, used to obtain the first incremental backup condition, the second incremental backup condition and the third incremental backup condition through the target management program. The first incremental backup condition is that the virtual machine data changes, so The second incremental backup condition is that the current time point reaches the target time point in the scheduled backup policy, and the third incremental backup condition is that the virtual machine status changes;

监测子模块,用于通过所述目标管理程序持续监测所述目标虚拟机是否满足所述第一增量备份条件、所述第二增量备份条件和所述第三增量备份条件中的任意一者。Monitoring submodule, configured to continuously monitor whether the target virtual machine meets any of the first incremental backup condition, the second incremental backup condition, and the third incremental backup condition through the target management program. One.

在一种实施例中,合并模块60包括:In one embodiment, the merge module 60 includes:

确定子模块,用于在i等于1时,将所述第0全量磁盘文件确定为第i全量磁盘文件,将所述第0全量配置文件确定为第i全量配置文件;Determining sub-module, used to determine the 0th full disk file as the i-th full disk file and the 0th full configuration file as the i-th full configuration file when i is equal to 1;

合并子模块,用于在i大于1时,通过所述目标管理程序合并第i-1全量磁盘文件和第i-1增量磁盘文件,得到第i全量磁盘文件,通过所述目标管理程序合并第i-1全量配置文件和第i-1增量配置文件,得到第i全量配置文件。The merging submodule is used to merge the i-1th full disk file and the i-1th incremental disk file through the target management program when i is greater than 1 to obtain the i-th full disk file, which is merged through the target management program. The i-1th full configuration file and the i-1th incremental configuration file are obtained to obtain the i-th full configuration file.

在一种实施例中,虚拟机备份装置还包括:In one embodiment, the virtual machine backup device further includes:

第二全量备份模块,用于通过所述目标管理程序对所述最新全量数据进行全量备份,得到目标备份数据;The second full backup module is used to perform full backup of the latest full data through the target management program to obtain target backup data;

第二保存模块,用于将所述目标备份数据存储至所述目标虚拟机之外的第二目标存储位置,所述第二目标存储位置与所述第一目标存储位置不同。The second saving module is configured to store the target backup data to a second target storage location outside the target virtual machine, where the second target storage location is different from the first target storage location.

在一种实施例中,接收模块10还用于,根据所述管理配置操作,确定虚拟机还原条件,所述虚拟机还原条件包括虚拟机的文件状态出现异常。In one embodiment, the receiving module 10 is further configured to determine virtual machine restoration conditions according to the management configuration operation, where the virtual machine restoration conditions include an abnormality in the file status of the virtual machine.

在一种实施例中,虚拟机备份装置还包括:In one embodiment, the virtual machine backup device further includes:

第三监测模块,用于通过所述目标管理程序监测所述目标虚拟机是否满足所述虚拟机还原条件;A third monitoring module, configured to monitor whether the target virtual machine meets the virtual machine restoration condition through the target management program;

第一确定模块,用于若是,从前i个备份时间点中确定待还原的目标时间点;The first determination module is used to determine the target time point to be restored from the previous i backup time points;

第二确定模块,用于根据所述目标时间点,从所述最新全量数据和所述最新增量数据中确定待还原的目标数据,所述目标数据包括目标磁盘文件和目标配置文件;A second determination module, configured to determine the target data to be restored from the latest full data and the latest incremental data according to the target time point, where the target data includes a target disk file and a target configuration file;

还原模块,用于根据所述目标磁盘文件和所述目标配置文件,通过所述目标管理程序还原出位于所述目标时间点之前的目标虚拟机。A restoration module, configured to restore the target virtual machine located before the target time point through the target management program according to the target disk file and the target configuration file.

在一种实施例中,虚拟机备份装置还包括:In one embodiment, the virtual machine backup device further includes:

判断模块,用于判断第i备份时间点中i的数值是否等于预设阈值;A judgment module, used to judge whether the value of i in the i-th backup time point is equal to the preset threshold;

备份和合并模块,用于若是,通过所述目标管理程序对所述目标虚拟机的磁盘文件和配置文件进行全量备份,得到参考全量磁盘文件和参考全量配置文件,且通过所述目标管理程序对所述最新全量数据和所述最新增量数据进行合并,得到实际全量磁盘文件和实际全量配置文件;The backup and merge module is used to perform a full backup of the disk files and configuration files of the target virtual machine through the target management program to obtain a reference full disk file and a reference full configuration file, and use the target management program to The latest full data and the latest incremental data are merged to obtain the actual full disk file and the actual full configuration file;

对比模块,用于对比所述参考全量磁盘文件和所述实际全量磁盘文件,得到第一对比结果,对比所述参考全量配置文件和所述实际全量配置文件,得到第二对比结果;A comparison module, used to compare the reference full disk file and the actual full disk file to obtain a first comparison result, and to compare the reference full configuration file and the actual full configuration file to obtain a second comparison result;

生成模块,用于在所述第一对比结果和所述第二对比结果中的任意一者表征不一致时,通过所述目标管理程序生成告警信息。A generating module, configured to generate alarm information through the target management program when any one of the first comparison result and the second comparison result has inconsistent representations.

区别于现有技术,本申请提供的虚拟机备份装置,在目标管理程序中进行管理配置后,目标管理程序可自动建立与目标虚拟机的连接,并自动实现对目标虚拟机的备份管理,目标虚拟机不再需要自己创建快照和存储快照以进行备份,因此不会耗费目标虚拟机自身的资源,也不会占用虚拟机本身的磁盘空间,有效保证了目标虚拟机的性能稳定性;此外,本申请通过一次全量备份和多次增量备份的方式进行备份,且在每次进行增量备份后,均会将当前备份时间点之前所有的备份数据进行合并得到唯一的最新全量数据,然后将最新全量数据和最新增量数据进行保存,即使最新增量数据损坏或丢失,由于最新全量数据中包含了虚拟机中大部分的信息,依然可以根据最新全量数据还原出目标虚拟机。综上,本申请的虚拟机备份装置具有较高的可靠性。Different from the existing technology, the virtual machine backup device provided by this application can automatically establish a connection with the target virtual machine after being managed and configured in the target management program, and automatically realize the backup management of the target virtual machine. The target The virtual machine no longer needs to create and store snapshots for backup, so it does not consume the target virtual machine's own resources or occupy the virtual machine's own disk space, effectively ensuring the performance stability of the target virtual machine; in addition, This application performs backup through one full backup and multiple incremental backups, and after each incremental backup, all backup data before the current backup time point will be merged to obtain the only latest full data, and then The latest full data and the latest incremental data are saved. Even if the latest incremental data is damaged or lost, since the latest full data contains most of the information in the virtual machine, the target virtual machine can still be restored based on the latest full data. In summary, the virtual machine backup device of this application has high reliability.

相应的,本申请实施例还提供一种电子设备,如图6所示,该电子设备可以包括射频(RF,Radio Frequency)电路101、包括有一个或一个以上计算机可读存储介质的存储器102、输入单元103、显示单元104、传感器105、音频电路106、WiFi模块107、包括有一个或者一个以上处理核心的处理器108、以及电源109等部件。本领域技术人员可以理解,图6中示出的电子设备结构并不构成对电子设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。其中:Correspondingly, embodiments of the present application also provide an electronic device. As shown in Figure 6, the electronic device may include a radio frequency (RF, Radio Frequency) circuit 101, a memory 102 including one or more computer-readable storage media, Input unit 103, display unit 104, sensor 105, audio circuit 106, WiFi module 107, processor 108 including one or more processing cores, and power supply 109 and other components. Those skilled in the art can understand that the structure of the electronic device shown in FIG. 6 does not constitute a limitation of the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange different components. in:

射频电路101可用于收发信息或通话过程中,信号的接收和发送,特别地,将基站的下行信息接收后,交由一个或者一个以上处理器108处理;另外,将涉及上行的数据发送给基站。存储器102可用于存储软件程序以及模块,处理器108通过运行存储在存储器102的软件程序以及模块,从而执行各种功能应用以及虚拟机的备份。输入单元103可用于接收输入的数字或字符信息,以及产生与客户设置以及功能控制有关的键盘、鼠标、操作杆、光学或者轨迹球信号输入。The radio frequency circuit 101 can be used to receive and send information or signals during a call. In particular, after receiving the downlink information of the base station, it is handed over to one or more processors 108 for processing; in addition, the uplink data is sent to the base station. . The memory 102 can be used to store software programs and modules. The processor 108 executes various functional applications and backups of virtual machines by running the software programs and modules stored in the memory 102 . The input unit 103 may be used to receive input numeric or character information, and to generate keyboard, mouse, joystick, optical or trackball signal input related to customer settings and function control.

显示单元104可用于显示由客户输入的信息或提供给客户的信息以及服务器的各种图形客户接口,这些图形客户接口可以由图形、文本、图标、视频和其任意组合来构成。The display unit 104 may be used to display information input by the client or information provided to the client as well as various graphical client interfaces of the server. These graphical client interfaces may be composed of graphics, text, icons, videos, and any combination thereof.

电子设备还可包括至少一种传感器105,比如光传感器、运动传感器以及其他传感器。音频电路106包括扬声器,扬声器可提供客户与电子设备之间的音频接口。The electronic device may also include at least one sensor 105, such as a light sensor, a motion sensor, and other sensors. Audio circuitry 106 includes a speaker that provides an audio interface between the customer and the electronic device.

WiFi属于短距离无线传输技术,电子设备通过WiFi模块107可以帮助客户收发电子邮件、浏览网页和随访流式媒体等,它为客户提供了无线的宽带互联网随访。虽然图6示出了WiFi模块107,但是可以理解的是,其并不属于电子设备的必须构成,完全可以根据需要在不改变申请的本质的范围内而省略。WiFi is a short-distance wireless transmission technology. Electronic devices can help customers send and receive emails, browse web pages, and follow streaming media through the WiFi module 107. It provides customers with wireless broadband Internet follow-up. Although FIG. 6 shows the WiFi module 107, it can be understood that it is not a necessary component of the electronic device and can be omitted as needed without changing the essence of the application.

处理器108是电子设备的控制中心,利用各种接口和线路连接整个手机的各个部分,通过运行或执行存储在存储器102内的软件程序和/或模块,以及调用存储在存储器102内的数据,执行电子设备的各种功能和处理数据,从而对手机进行整体监控。The processor 108 is the control center of the electronic device, using various interfaces and lines to connect various parts of the entire mobile phone, by running or executing software programs and/or modules stored in the memory 102, and calling data stored in the memory 102, Perform various functions of the electronic device and process data, resulting in overall monitoring of the mobile phone.

电子设备还包括给各个部件供电的电源109(比如电池),优选的,电源可以通过电源管理系统与处理器108逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。The electronic device also includes a power supply 109 (such as a battery) that supplies power to various components. Preferably, the power supply can be logically connected to the processor 108 through a power management system, so that functions such as charging, discharging, and power consumption management can be implemented through the power management system.

尽管未示出,电子设备还可以包括摄像头、蓝牙模块等,在此不再赘述。具体在本实施例中,服务器中的处理器108会按照如下的指令,将一个或一个以上的应用程序的进程对应的可执行文件加载到存储器102中,并由处理器108来运行存储在存储器102中的应用程序,从而实现以下功能:Although not shown, the electronic device may also include a camera, a Bluetooth module, etc., which will not be described again here. Specifically, in this embodiment, the processor 108 in the server will load the executable files corresponding to the processes of one or more application programs into the memory 102 according to the following instructions, and the processor 108 will run the executable files stored in the memory. 102 applications to achieve the following functions:

通过目标管理程序接收针对目标虚拟机的管理配置操作,根据所述管理配置操作,建立与所述目标虚拟机的连接,并确定所述目标虚拟机的全量备份条件和增量备份条件;Receive management configuration operations for the target virtual machine through the target hypervisor, establish a connection with the target virtual machine according to the management configuration operation, and determine the full backup conditions and incremental backup conditions of the target virtual machine;

通过所述目标管理程序监测所述目标虚拟机是否满足所述全量备份条件;Monitor whether the target virtual machine meets the full backup condition through the target management program;

若是,通过所述目标管理程序对所述目标虚拟机的磁盘文件和配置文件进行全量备份,得到第0全量磁盘文件和第0全量配置文件,并确定第0备份时间点;If so, perform a full backup of the disk file and configuration file of the target virtual machine through the target management program, obtain the 0th full disk file and the 0th full configuration file, and determine the 0th backup time point;

通过所述目标管理程序持续监测所述目标虚拟机是否满足所述增量备份条件;Continuously monitor whether the target virtual machine meets the incremental backup condition through the target management program;

若是,将第i次满足时的时间点确定为第i备份时间点,根据第i-1备份时间点和所述第i 备份时间点确定第i增量备份时间段,在所述第i备份时间点,通过所述目标管理程序对所述第i增量备份时间段内所述目标虚拟机的磁盘文件和配置文件进行第i次增量备份,得到第i增量磁盘文件和第i增量配置文件,i为正整数;If so, determine the time point when the i-th time is satisfied as the i-th backup time point, determine the i-th incremental backup time period based on the i-1 backup time point and the i-th backup time point, and determine the i-th incremental backup time period in the i-th backup time point. At the time point, the target management program performs the i-th incremental backup of the disk file and configuration file of the target virtual machine within the i-th incremental backup time period, and obtains the i-th incremental disk file and the i-th incremental backup file. Quantity configuration file, i is a positive integer;

通过所述目标管理程序合并所述第0全量磁盘文件和前i-1个增量磁盘文件,得到第i全量磁盘文件,合并所述第0全量配置文件和前i-1个增量配置文件,得到第i全量配置文件;Merge the 0th full disk file and the first i-1 incremental disk files through the target management program to obtain the ith full disk file, and merge the 0th full configuration file and the first i-1 incremental configuration files , get the i-th full configuration file;

将所述第i全量磁盘文件和所述第i全量配置文件确定为最新全量数据,将所述第i增量磁盘文件和所述第i增量配置文件确定为最新增量数据,通过所述目标管理程序将所述最新全量数据和所述最新增量数据保存至所述目标虚拟机之外的第一目标存储位置。The i-th full disk file and the i-th full configuration file are determined as the latest full data, and the i-th incremental disk file and the i-th incremental configuration file are determined as the latest incremental data. The target management program saves the latest full data and the latest incremental data to a first target storage location outside the target virtual machine.

在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见上文的详细描述,此处不再赘述。In the above embodiments, each embodiment is described with its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the above detailed description and will not be described again here.

本领域普通技术人员可以理解,上述实施例的各种方法中的全部或部分步骤可以通过指令来完成,或通过指令控制相关的硬件来完成,该指令可以存储于一计算机可读存储介质中,并由处理器进行加载和执行。Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructions, or by controlling relevant hardware through instructions. The instructions can be stored in a computer-readable storage medium, and loaded and executed by the processor.

为此,本申请实施例提供一种计算机可读存储介质,其中存储有多条指令,该指令能够被处理器进行加载,以实现以下功能:To this end, embodiments of the present application provide a computer-readable storage medium in which multiple instructions are stored, and the instructions can be loaded by the processor to implement the following functions:

通过目标管理程序接收针对目标虚拟机的管理配置操作,根据所述管理配置操作,建立与所述目标虚拟机的连接,并确定所述目标虚拟机的全量备份条件和增量备份条件;Receive management configuration operations for the target virtual machine through the target hypervisor, establish a connection with the target virtual machine according to the management configuration operation, and determine the full backup conditions and incremental backup conditions of the target virtual machine;

通过所述目标管理程序监测所述目标虚拟机是否满足所述全量备份条件;Monitor whether the target virtual machine meets the full backup condition through the target management program;

若是,通过所述目标管理程序对所述目标虚拟机的磁盘文件和配置文件进行全量备份,得到第0全量磁盘文件和第0全量配置文件,并确定第0备份时间点;If so, perform a full backup of the disk file and configuration file of the target virtual machine through the target management program, obtain the 0th full disk file and the 0th full configuration file, and determine the 0th backup time point;

通过所述目标管理程序持续监测所述目标虚拟机是否满足所述增量备份条件;Continuously monitor whether the target virtual machine meets the incremental backup condition through the target management program;

若是,将第i次满足时的时间点确定为第i备份时间点,根据第i-1备份时间点和所述第i 备份时间点确定第i增量备份时间段,在所述第i备份时间点,通过所述目标管理程序对所述第i增量备份时间段内所述目标虚拟机的磁盘文件和配置文件进行第i次增量备份,得到第i增量磁盘文件和第i增量配置文件,i为正整数;If so, determine the time point when the i-th time is satisfied as the i-th backup time point, determine the i-th incremental backup time period based on the i-1 backup time point and the i-th backup time point, and determine the i-th incremental backup time period in the i-th backup time point. At the time point, the target management program performs the i-th incremental backup of the disk file and configuration file of the target virtual machine within the i-th incremental backup time period, and obtains the i-th incremental disk file and the i-th incremental backup file. Quantity configuration file, i is a positive integer;

通过所述目标管理程序合并所述第0全量磁盘文件和前i-1个增量磁盘文件,得到第i全量磁盘文件,合并所述第0全量配置文件和前i-1个增量配置文件,得到第i全量配置文件;Merge the 0th full disk file and the first i-1 incremental disk files through the target management program to obtain the ith full disk file, and merge the 0th full configuration file and the first i-1 incremental configuration files , get the i-th full configuration file;

将所述第i全量磁盘文件和所述第i全量配置文件确定为最新全量数据,将所述第i增量磁盘文件和所述第i增量配置文件确定为最新增量数据,通过所述目标管理程序将所述最新全量数据和所述最新增量数据保存至所述目标虚拟机之外的第一目标存储位置。The i-th full disk file and the i-th full configuration file are determined as the latest full data, and the i-th incremental disk file and the i-th incremental configuration file are determined as the latest incremental data. The target management program saves the latest full data and the latest incremental data to a first target storage location outside the target virtual machine.

以上对本申请实施例所提供的一种虚拟机备份方法、装置、电子设备和计算机可读存储介质进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的技术方案及其核心思想;本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例的技术方案的范围。The above is a detailed introduction to a virtual machine backup method, device, electronic equipment and computer-readable storage medium provided by the embodiments of the present application. This article uses specific examples to illustrate the principles and implementation methods of the present application. The above implementation The description of the examples is only used to help understand the technical solutions and core ideas of the present application; those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or modify some of the technical features. Equivalent substitutions; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to depart from the scope of the technical solutions of the embodiments of the present application.

Claims (9)

Translated fromChinese
1.一种虚拟机备份方法,其特征在于,包括:1. A virtual machine backup method, characterized by comprising:通过目标管理程序接收针对目标虚拟机的管理配置操作,根据所述管理配置操作,建立与所述目标虚拟机的连接,并确定所述目标虚拟机的全量备份条件和增量备份条件;Receive management configuration operations for the target virtual machine through the target hypervisor, establish a connection with the target virtual machine according to the management configuration operation, and determine the full backup conditions and incremental backup conditions of the target virtual machine;通过所述目标管理程序监测所述目标虚拟机是否满足所述全量备份条件;Monitor whether the target virtual machine meets the full backup condition through the target management program;若是,通过所述目标管理程序对所述目标虚拟机的磁盘文件和配置文件进行全量备份,得到第0全量磁盘文件和第0全量配置文件,并确定第0备份时间点;If so, perform a full backup of the disk file and configuration file of the target virtual machine through the target management program, obtain the 0th full disk file and the 0th full configuration file, and determine the 0th backup time point;通过所述目标管理程序持续监测所述目标虚拟机是否满足所述增量备份条件;Continuously monitor whether the target virtual machine meets the incremental backup condition through the target management program;若是,将第i次满足时的时间点确定为第i备份时间点,根据第i-1备份时间点和所述第i备份时间点确定第i增量备份时间段,在所述第i备份时间点,通过所述目标管理程序对所述第i增量备份时间段内所述目标虚拟机的磁盘文件和配置文件进行第i次增量备份,得到第i增量磁盘文件和第i增量配置文件,i为正整数;If so, the time point when the i-th time is satisfied is determined as the i-th backup time point, and the i-th incremental backup time period is determined based on the i-1 backup time point and the i-th backup time point. In the i-th backup At the time point, the target management program performs the i-th incremental backup of the disk file and configuration file of the target virtual machine within the i-th incremental backup time period, and obtains the i-th incremental disk file and the i-th incremental backup file. Quantity configuration file, i is a positive integer;通过所述目标管理程序合并所述第0全量磁盘文件和前i-1个增量磁盘文件,得到第i全量磁盘文件,合并所述第0全量配置文件和前i-1个增量配置文件,得到第i全量配置文件;具体包括:在i等于1时,将所述第0全量磁盘文件确定为第i全量磁盘文件,将所述第0全量配置文件确定为第i全量配置文件;在i大于1时,通过所述目标管理程序合并第i-1全量磁盘文件和第i-1增量磁盘文件,得到第i全量磁盘文件,通过所述目标管理程序合并第i-1全量配置文件和第i-1增量配置文件,得到第i全量配置文件;Merge the 0th full disk file and the first i-1 incremental disk files through the target management program to obtain the ith full disk file, and merge the 0th full configuration file and the first i-1 incremental configuration files , obtaining the i-th full configuration file; specifically including: when i is equal to 1, determining the 0-th full disk file as the i-th full disk file, and determining the 0-th full configuration file as the i-th full configuration file; When i is greater than 1, use the target management program to merge the i-1th full disk file and the i-1th incremental disk file to obtain the i-th full disk file, and use the target management program to merge the i-1th full configuration file and the i-1 incremental configuration file to obtain the i-th full configuration file;将所述第i全量磁盘文件和所述第i全量配置文件确定为最新全量数据,将所述第i增量磁盘文件和所述第i增量配置文件确定为最新增量数据,通过所述目标管理程序将所述最新全量数据和所述最新增量数据保存至所述目标虚拟机之外的第一目标存储位置。The i-th full disk file and the i-th full configuration file are determined as the latest full data, and the i-th incremental disk file and the i-th incremental configuration file are determined as the latest incremental data. The target management program saves the latest full data and the latest incremental data to a first target storage location outside the target virtual machine.2.根据权利要求1所述的虚拟机备份方法,其特征在于,通过所述目标管理程序持续监测所述目标虚拟机是否满足所述增量备份条件的步骤,包括:2. The virtual machine backup method according to claim 1, characterized in that the step of continuously monitoring whether the target virtual machine meets the incremental backup condition through the target management program includes:通过所述目标管理程序获取第一增量备份条件、第二增量备份条件和第三增量备份条件,所述第一增量备份条件为虚拟机数据发生变化,所述第二增量备份条件为当前时间点到达定时备份策略中的目标时间点,所述第三增量备份条件为虚拟机状态发生变化;The first incremental backup condition, the second incremental backup condition and the third incremental backup condition are obtained through the target management program. The first incremental backup condition is that the virtual machine data changes, and the second incremental backup condition is The condition is that the current time point reaches the target time point in the scheduled backup policy, and the third incremental backup condition is that the virtual machine status changes;通过所述目标管理程序持续监测所述目标虚拟机是否满足所述第一增量备份条件、所述第二增量备份条件和所述第三增量备份条件中的任意一者。Whether the target virtual machine satisfies any one of the first incremental backup condition, the second incremental backup condition, and the third incremental backup condition is continuously monitored through the target hypervisor.3.根据权利要求1所述的虚拟机备份方法,其特征在于,在通过所述目标管理程序将所述最新全量数据和所述最新增量数据保存至所述目标虚拟机之外的第一目标存储位置的步骤之后,还包括:3. The virtual machine backup method according to claim 1, wherein the latest full data and the latest incremental data are saved to a first server other than the target virtual machine through the target management program. After the step of target storage location, also include:通过所述目标管理程序对所述最新全量数据进行全量备份,得到目标备份数据;Perform a full backup of the latest full data through the target management program to obtain target backup data;将所述目标备份数据存储至所述目标虚拟机之外的第二目标存储位置,所述第二目标存储位置与所述第一目标存储位置不同。The target backup data is stored in a second target storage location outside the target virtual machine, where the second target storage location is different from the first target storage location.4.根据权利要求1所述的虚拟机备份方法,其特征在于,通过目标管理程序接收针对目标虚拟机的管理配置操作的步骤,还包括:4. The virtual machine backup method according to claim 1, characterized in that the step of receiving the management configuration operation for the target virtual machine through the target management program further includes:根据所述管理配置操作,确定虚拟机还原条件,所述虚拟机还原条件包括虚拟机的文件状态出现异常。According to the management configuration operation, virtual machine restoration conditions are determined, and the virtual machine restoration conditions include an abnormality in the file status of the virtual machine.5.根据权利要求4所述的虚拟机备份方法,其特征在于,在通过所述目标管理程序将所述最新全量数据和所述最新增量数据保存至所述目标虚拟机之外的第一目标存储位置的步骤之后,还包括:5. The virtual machine backup method according to claim 4, wherein the latest full data and the latest incremental data are saved to a first server other than the target virtual machine through the target management program. After the step of target storage location, also include:通过所述目标管理程序监测所述目标虚拟机是否满足所述虚拟机还原条件;Monitor whether the target virtual machine meets the virtual machine restoration condition through the target management program;若是,从前i个备份时间点中确定待还原的目标时间点;If so, determine the target time point to be restored from the previous i backup time points;根据所述目标时间点,从所述最新全量数据和所述最新增量数据中确定待还原的目标数据,所述目标数据包括目标磁盘文件和目标配置文件;According to the target time point, determine the target data to be restored from the latest full data and the latest incremental data, where the target data includes a target disk file and a target configuration file;根据所述目标磁盘文件和所述目标配置文件,通过所述目标管理程序还原出位于所述目标时间点之前的目标虚拟机。According to the target disk file and the target configuration file, the target virtual machine located before the target time point is restored through the target management program.6.根据权利要求1所述的虚拟机备份方法,其特征在于,在通过所述目标管理程序将所述最新全量数据和所述最新增量数据保存至所述目标虚拟机之外的第一目标存储位置的步骤之后,还包括:6. The virtual machine backup method according to claim 1, wherein the latest full data and the latest incremental data are saved to a first server other than the target virtual machine through the target management program. After the step of target storage location, also include:判断第i备份时间点中i的数值是否等于预设阈值;Determine whether the value of i in the i-th backup time point is equal to the preset threshold;若是,通过所述目标管理程序对所述目标虚拟机的磁盘文件和配置文件进行全量备份,得到参考全量磁盘文件和参考全量配置文件,且通过所述目标管理程序对所述最新全量数据和所述最新增量数据进行合并,得到实际全量磁盘文件和实际全量配置文件;If so, perform a full backup of the disk files and configuration files of the target virtual machine through the target management program to obtain a reference full disk file and a reference full configuration file, and use the target management program to backup the latest full data and all the reference full data. Merge the latest incremental data mentioned above to obtain the actual full disk file and the actual full configuration file;对比所述参考全量磁盘文件和所述实际全量磁盘文件,得到第一对比结果,对比所述参考全量配置文件和所述实际全量配置文件,得到第二对比结果;Compare the reference full disk file and the actual full disk file to obtain a first comparison result, and compare the reference full configuration file and the actual full configuration file to obtain a second comparison result;在所述第一对比结果和所述第二对比结果中的任意一者表征不一致时,通过所述目标管理程序生成告警信息。When any one of the first comparison result and the second comparison result indicates an inconsistency, alarm information is generated through the target management program.7.一种虚拟机备份装置,其特征在于,包括:7. A virtual machine backup device, characterized by comprising:接收模块,用于通过目标管理程序接收针对目标虚拟机的管理配置操作,根据所述管理配置操作,建立与所述目标虚拟机的连接,并确定所述目标虚拟机的全量备份条件和增量备份条件;A receiving module configured to receive management configuration operations for the target virtual machine through the target management program, establish a connection with the target virtual machine according to the management configuration operation, and determine the full backup conditions and increments of the target virtual machine. Backup conditions;第一监测模块,用于通过所述目标管理程序监测所述目标虚拟机是否满足所述全量备份条件;A first monitoring module, configured to monitor whether the target virtual machine meets the full backup condition through the target management program;第一全量备份模块,用于若是,通过所述目标管理程序对所述目标虚拟机的磁盘文件和配置文件进行全量备份,得到第0全量磁盘文件和第0全量配置文件,并确定第0备份时间点;The first full backup module is used to perform a full backup of the disk file and configuration file of the target virtual machine through the target management program, obtain the 0th full disk file and the 0th full configuration file, and determine the 0th backup point in time;第二监测模块,用于通过所述目标管理程序持续监测所述目标虚拟机是否满足所述增量备份条件;a second monitoring module, configured to continuously monitor whether the target virtual machine meets the incremental backup condition through the target management program;增量备份模块,用于若是,将第i次满足时的时间点确定为第i备份时间点,根据第i-1备份时间点和所述第i备份时间点确定第i增量备份时间段,在所述第i备份时间点,通过所述目标管理程序对所述第i增量备份时间段内所述目标虚拟机的磁盘文件和配置文件进行第i次增量备份,得到第i增量磁盘文件和第i增量配置文件,i为正整数;The incremental backup module is used to determine the time point when the i-th time is satisfied as the i-th backup time point, and determine the i-th incremental backup time period based on the i-1 backup time point and the i-th backup time point. , at the i-th backup time point, the target management program performs the i-th incremental backup of the disk file and configuration file of the target virtual machine within the i-th incremental backup time period, and obtains the i-th incremental backup. The disk file and the i-th incremental configuration file, i is a positive integer;合并模块,用于通过所述目标管理程序合并所述第0全量磁盘文件和前i-1个增量磁盘文件,得到第i全量磁盘文件,合并所述第0全量配置文件和前i-1个增量配置文件,得到第i全量配置文件;具体包括:在i等于1时,将所述第0全量磁盘文件确定为第i全量磁盘文件,将所述第0全量配置文件确定为第i全量配置文件;在i大于1时,通过所述目标管理程序合并第i-1全量磁盘文件和第i-1增量磁盘文件,得到第i全量磁盘文件,通过所述目标管理程序合并第i-1全量配置文件和第i-1增量配置文件,得到第i全量配置文件;The merging module is used to merge the 0th full disk file and the first i-1 incremental disk files through the target management program to obtain the ith full disk file, and merge the 0th full configuration file and the first i-1 incremental configuration file to obtain the i-th full configuration file; specifically including: when i is equal to 1, determining the 0-th full disk file as the i-th full disk file, and determining the 0-th full configuration file as the i-th full disk file Full configuration file; when i is greater than 1, merge the i-1th full disk file and i-1th incremental disk file through the target management program to obtain the i-th full disk file, and merge the i-th full disk file through the target management program -1 full configuration file and i-1 incremental configuration file to obtain the i-th full configuration file;第一保存模块,用于将所述第i全量磁盘文件和所述第i全量配置文件确定为最新全量数据,将所述第i增量磁盘文件和所述第i增量配置文件确定为最新增量数据,通过所述目标管理程序将所述最新全量数据和所述最新增量数据保存至所述目标虚拟机之外的第一目标存储位置。The first saving module is used to determine the i-th full disk file and the i-th full configuration file as the latest full data, and determine the i-th incremental disk file and the i-th incremental configuration file as the latest Incremental data: save the latest full data and the latest incremental data to a first target storage location outside the target virtual machine through the target management program.8.一种电子设备,其特征在于,包括存储器和处理器;所述存储器存储有应用程序,所述处理器用于运行所述存储器内的应用程序,以执行权利要求1至6任一项所述的虚拟机备份方法中的步骤。8. An electronic device, characterized in that it includes a memory and a processor; the memory stores an application program, and the processor is used to run the application program in the memory to execute any one of claims 1 to 6. Follow the steps in the virtual machine backup method described above.9.一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行以实现权利要求1至6任一项所述的虚拟机备份方法中的步骤。9. A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, and the computer program is executed by a processor to implement the virtual machine according to any one of claims 1 to 6. Steps in the backup method.
CN202311295139.9A2023-10-092023-10-09Virtual machine backup method and device, electronic equipment and storage mediumActiveCN117033084B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202311295139.9ACN117033084B (en)2023-10-092023-10-09Virtual machine backup method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202311295139.9ACN117033084B (en)2023-10-092023-10-09Virtual machine backup method and device, electronic equipment and storage medium

Publications (2)

Publication NumberPublication Date
CN117033084A CN117033084A (en)2023-11-10
CN117033084Btrue CN117033084B (en)2024-01-19

Family

ID=88639854

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202311295139.9AActiveCN117033084B (en)2023-10-092023-10-09Virtual machine backup method and device, electronic equipment and storage medium

Country Status (1)

CountryLink
CN (1)CN117033084B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN119179606B (en)*2024-11-262025-03-11天翼云科技有限公司Data backup method, apparatus, computer device, readable storage medium, and program product

Citations (10)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN106339254A (en)*2015-07-152017-01-18中兴通讯股份有限公司Quick starting method and device, and management node for virtual machine
CN106777219A (en)*2016-12-232017-05-31北京亚细亚智业科技有限公司For the data processing method and device of Visualized data centre
CN111338759A (en)*2020-02-262020-06-26平安科技(深圳)有限公司 Method, device, device and storage medium for generating virtual disk check code
CN111949445A (en)*2020-07-292020-11-17苏州浪潮智能科技有限公司Incremental backup data storage method, device, equipment and product
CN112882859A (en)*2021-02-072021-06-01上海英方软件股份有限公司Virtual machine synthetic backup method and system
CN113626256A (en)*2021-07-162021-11-09济南浪潮数据技术有限公司Virtual machine disk data backup method, device, terminal and storage medium
CN113886143A (en)*2021-10-192022-01-04深圳市木浪云科技有限公司Virtual machine continuous data protection method and device and data recovery method and device
CN114564284A (en)*2022-04-292022-05-31武汉四通信息服务有限公司Data backup method of virtual machine, computer equipment and storage medium
CN115098299A (en)*2022-06-282022-09-23江苏安超云软件有限公司Backup method, disaster recovery method, device and equipment for virtual machine
WO2023109245A1 (en)*2021-12-172023-06-22广东浪潮智慧计算技术有限公司Data backup method, apparatus and system and non-volatile readable storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US8495316B2 (en)*2008-08-252013-07-23Symantec Operating CorporationEfficient management of archival images of virtual machines having incremental snapshots

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN106339254A (en)*2015-07-152017-01-18中兴通讯股份有限公司Quick starting method and device, and management node for virtual machine
CN106777219A (en)*2016-12-232017-05-31北京亚细亚智业科技有限公司For the data processing method and device of Visualized data centre
CN111338759A (en)*2020-02-262020-06-26平安科技(深圳)有限公司 Method, device, device and storage medium for generating virtual disk check code
WO2021169280A1 (en)*2020-02-262021-09-02平安科技(深圳)有限公司Virtual disk check code generation method, apparatus and device, and storage medium
CN111949445A (en)*2020-07-292020-11-17苏州浪潮智能科技有限公司Incremental backup data storage method, device, equipment and product
CN112882859A (en)*2021-02-072021-06-01上海英方软件股份有限公司Virtual machine synthetic backup method and system
CN113626256A (en)*2021-07-162021-11-09济南浪潮数据技术有限公司Virtual machine disk data backup method, device, terminal and storage medium
CN113886143A (en)*2021-10-192022-01-04深圳市木浪云科技有限公司Virtual machine continuous data protection method and device and data recovery method and device
WO2023109245A1 (en)*2021-12-172023-06-22广东浪潮智慧计算技术有限公司Data backup method, apparatus and system and non-volatile readable storage medium
CN114564284A (en)*2022-04-292022-05-31武汉四通信息服务有限公司Data backup method of virtual machine, computer equipment and storage medium
CN115098299A (en)*2022-06-282022-09-23江苏安超云软件有限公司Backup method, disaster recovery method, device and equipment for virtual machine

Also Published As

Publication numberPublication date
CN117033084A (en)2023-11-10

Similar Documents

PublicationPublication DateTitle
CN102789305B (en) Postpone hang
CN106339058B (en)Method and system for dynamically managing power supply
US9760413B2 (en)Power efficient brokered communication supporting notification blocking
CN106020976B (en)Memory is exhausted into the method and apparatus that process flow is unloaded to user's space
US11340684B2 (en)System and method for predictive battery power management
CN105468717A (en)Database operation method and device
CN114035818B (en) Firmware upgrade method, device, computer equipment and storage medium
US11662803B2 (en)Control method, apparatus, and electronic device
CN115048147B (en) A firmware upgrade method, device, equipment, and storage medium
CN117033084B (en)Virtual machine backup method and device, electronic equipment and storage medium
CN113672306B (en) Method, device, system and medium for recovery from abnormal self-checking of server components
CN112463550A (en)Remote monitoring method, device and equipment for terminal equipment state
US7716504B2 (en)System for retaining power management settings across sleep states
CN113032023B (en)Electronic equipment processing method and device and electronic equipment
CN114189429A (en)System, method, device and medium for monitoring server cluster faults
US11516082B1 (en)Configuration of a baseboard management controller (BMC) group leader responsive to load
CN111130856A (en) A server configuration method, system, device, and computer-readable storage medium
CN117395263B (en)Data synchronization method, device, equipment and storage medium
TWI778295B (en)Information handling system, power operation controller thereof and method of handling power requests during cluster operations
CN113127239A (en)Page state monitoring method, device, terminal and storage medium
CN114996055B (en) Dual-machine hot standby system control method, device, and medium
CN107480004B (en)Fault recovery method and device and computer equipment
CN117076206A (en) A method, device, equipment and medium for synchronizing master and backup mirror information
CN113064614B (en) A server redundant power supply system firmware upgrade method and system
CN116028280A (en)Cross-cluster data migration method, device, equipment and medium

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant
PE01Entry into force of the registration of the contract for pledge of patent right

Denomination of invention:Virtual machine backup method, device, electronic equipment, and storage medium

Granted publication date:20240119

Pledgee:Guanggu Branch of Wuhan Rural Commercial Bank Co.,Ltd.

Pledgor:Wuhan Barda Technology Co.,Ltd.

Registration number:Y2025980004279

PE01Entry into force of the registration of the contract for pledge of patent right

[8]ページ先頭

©2009-2025 Movatter.jp