Virtual machine fault migration and disk data backup method, computer equipment, readable storage medium and program product
By detecting status information in the edge cluster system, selecting the appropriate edge cluster and issuing fault migration tasks, and migrating virtual machines using disk backup files in object storage, the problem of low error migration efficiency in traditional technology is solved, and more efficient fault migration and data backup is achieved.
Patent Information
- Application Number
- CN202411759416.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-03
- Publication Date
- 2025-02-28
Smart Images

Figure CN119536915A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of cloud computing technology, and in particular to a virtual machine fault migration, disk data backup method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art
[0002] Edge computing refers to providing the nearest end service at the side close to the source of objects or data, using an open platform that integrates network, computing, storage, and application core capabilities. In edge computing scenarios, virtual machines can often be deployed in edge clusters to provide edge computing services.
[0003] However, once an edge cluster in the edge cluster system of traditional technology fails, maintenance personnel are required to locally package the virtual machine disk data on the failed edge cluster and manually transfer it to the edge cluster in a normal state, so as to restart the suspended virtual machine in the edge cluster in a normal state. This kind of virtual machine cross-cluster fault migration is inefficient.
[0004] Therefore, the related technology has the problem of low efficiency of virtual machine cross-cluster fault migration. Summary of the invention
[0005] Based on this, it is necessary to provide a virtual machine fault migration, disk data backup method, device, computer equipment, computer readable storage medium and computer program product that can improve the efficiency of virtual machine cross-cluster fault migration in response to the above technical problems.
[0006] In a first aspect, the present application provides a virtual machine failure migration method, which is applied to a central cloud cluster, and the method includes:
[0007] Detecting an abnormal first edge cluster among at least two edge clusters, and obtaining a virtual machine list of the first edge cluster; the virtual machine list includes virtual machine identifiers corresponding to the virtual machines to be migrated in the first edge cluster;
[0008] Selecting a second edge cluster that meets the resource migration condition from the at least two edge clusters, and issuing a fault migration task to the second edge cluster; the fault migration task is used to enable the second edge cluster to migrate the virtual machine to be migrated to the second edge cluster for continued operation according to the disk backup file associated with the virtual machine identifier stored in the object storage;
[0009] The disk backup file is obtained by backing up disk data of the target disk to the object storage when the first edge cluster responds to a change in a write operation disk snapshot of the target disk associated with the virtual machine identifier.
[0010] In one embodiment, the step of detecting an abnormal first edge cluster among at least two edge clusters includes:
[0011] Receiving cluster status information reported by each of the at least two edge clusters;
[0012] Determine a target edge cluster from the at least two edge clusters according to the cluster status information reported by each of the at least two edge clusters; the cluster status information corresponding to the target edge cluster meets a preset fault status condition;
[0013] It is determined that the target edge cluster is the first edge cluster having an abnormality.
[0014] In one of the embodiments, the step of selecting a second edge cluster that meets the resource migration condition from the at least two edge clusters includes:
[0015] Acquire cluster resource attributes corresponding to each candidate edge cluster; the candidate edge cluster is an edge cluster other than the first edge cluster in the at least two edge clusters, and satisfies the migration resource condition;
[0016] Determine a resource condition score of each candidate edge cluster according to the cluster resource attributes corresponding to each candidate edge cluster; the resource condition score is related to the selection priority of the candidate edge cluster;
[0017] According to the resource condition scores of the candidate edge clusters, it is determined to select the candidate edge cluster with the highest priority as the second edge cluster.
[0018] In one embodiment, the cluster resource attribute includes at least one of CPU usage, memory usage, storage usage or distance, and determining the resource condition score of each candidate edge cluster according to the cluster resource attribute corresponding to each candidate edge cluster includes:
[0019] For any candidate edge cluster among the candidate edge clusters, obtaining a resource attribute value corresponding to each cluster resource attribute of the any candidate edge cluster;
[0020] According to the weights corresponding to the cluster resource attributes, the resource attribute values corresponding to the cluster resource attributes are weighted and summed to obtain the resource condition score of any candidate edge cluster; the resource condition score is negatively correlated with the selection priority of the candidate edge cluster.
[0021] In a second aspect, the present application further provides a virtual machine failover method, which is applied to the second edge cluster as described above, and the method includes:
[0022] Receiving the fault migration task issued by the central cloud cluster; the fault migration task carries the virtual machine identifier corresponding to the virtual machine to be migrated;
[0023] Downloading the disk backup file associated with the virtual machine identifier from the object storage;
[0024] According to the disk backup file, the virtual machine to be migrated is migrated to the second edge cluster to continue running.
[0025] In one embodiment, migrating the virtual machine to be migrated to the second edge cluster to continue running according to the disk backup file includes:
[0026] Restoring the disk backup file to the block storage of the second edge cluster;
[0027] A standby virtual machine matching the specifications of the virtual machine to be migrated is created on the second edge cluster, and a restored disk in the block storage is mounted for the standby virtual machine; the restored disk is a disk restored based on the disk backup file.
[0028] In a third aspect, the present application further provides a disk data backup method, which is applied to the first edge cluster as described above, and the method includes:
[0029] When a data write operation is detected on the target disk, a snapshot operation is performed on the target disk to obtain a current disk snapshot corresponding to the current data write operation;
[0030] Obtain a historical disk snapshot corresponding to the last data write operation, and if there is a difference between the historical disk snapshot and the current disk snapshot, add a disk backup task of the target disk to the backup queue;
[0031] The disk backup task is executed according to the disk backup strategy matching the target disk, so as to back up the disk data of the target disk to the object storage.
[0032] In a fourth aspect, the present application further provides a virtual machine failure migration device, which is applied to a central cloud cluster, including:
[0033] An acquisition module is used to detect an abnormal first edge cluster in at least two edge clusters, and acquire a virtual machine list of the first edge cluster; the virtual machine list includes a virtual machine identifier corresponding to the virtual machine to be migrated in the first edge cluster;
[0034] A sending module is used to select a second edge cluster that meets the migration resource conditions from the at least two edge clusters, and send a fault migration task to the second edge cluster; the fault migration task is used to enable the second edge cluster to migrate the virtual machine to be migrated to the second edge cluster for continued operation according to the disk backup file associated with the virtual machine identifier stored in the object storage;
[0035] The disk backup file is obtained by backing up disk data of the target disk to the object storage when the first edge cluster responds to a change in a write operation disk snapshot of the target disk associated with the virtual machine identifier.
[0036] In a fifth aspect, the present application further provides a virtual machine failure migration device, which is applied to the second edge cluster as described above, and the method includes:
[0037] A receiving module, configured to receive the fault migration task issued by the central cloud cluster; the fault migration task carries a virtual machine identifier corresponding to the virtual machine to be migrated;
[0038] A download module, used for downloading the disk backup file associated with the virtual machine identifier from the object storage;
[0039] A migration module is used to migrate the virtual machine to be migrated to the second edge cluster to continue running according to the disk backup file.
[0040] In a sixth aspect, the present application further provides a disk data backup device, which is applied to the first edge cluster as described above, and the method includes:
[0041] A snapshot module, configured to perform a snapshot operation on the target disk when a data write operation is detected on the target disk, and obtain a current disk snapshot corresponding to the current data write operation;
[0042] A comparison module, used for obtaining a historical disk snapshot corresponding to the last data write operation, and adding a disk backup task of the target disk to a backup queue when there is a difference between the historical disk snapshot and the current disk snapshot;
[0043] The backup module is used to execute the disk backup task according to the disk backup strategy matching the target disk, so as to back up the disk data of the target disk to the object storage.
[0044] In a seventh aspect, the present application further provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0045] In an eighth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the above method when executed by a processor.
[0046] In a ninth aspect, the present application also provides a computer program product, including a computer program, which implements the steps of the above method when executed by a processor.
[0047] The above-mentioned virtual machine fault migration, disk data backup method, device, computer equipment, computer-readable storage medium and computer program product, the virtual machine fault migration method can be applied to the central cloud cluster, by detecting the first edge cluster with an abnormality in at least two edge clusters, obtaining a virtual machine list of the first edge cluster; the virtual machine list includes virtual machine identifiers corresponding to the virtual machines to be migrated in the first edge cluster; and selecting a second edge cluster that meets the migration resource conditions from the at least two edge clusters, and issuing a fault migration task to the second edge cluster; the fault migration task is used to enable the second edge cluster to perform a fault migration based on the disk backup file associated with the virtual machine identifier stored in the object storage. The virtual machine to be migrated is migrated to the second edge cluster to continue running; wherein, the disk backup file is obtained by backing up the disk data of the target disk to the object storage in response to the first edge cluster when there is a change in the write operation disk snapshot of the target disk associated with the virtual machine identifier; in this way, the bandwidth occupied when backing up the virtual machine disk data can be reduced, the impact of the backup on the cluster performance can be reduced, and the backup frequency of the virtual machine disk data can be kept within a suitable range; at the same time, the machine failure migration can be triggered in time, and the backup data can be quickly restored to other edge clusters to continue to provide virtual machine services, effectively improving the efficiency of virtual machine cross-cluster failure migration. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0049] FIG1 is an application environment diagram of a virtual machine failure migration method in one embodiment;
[0050] FIG2 is a schematic diagram of a flow chart of a virtual machine failure migration method in one embodiment;
[0051] FIG3 is a schematic diagram of a flow chart of another virtual machine failure migration method according to an embodiment;
[0052] FIG4 is a schematic diagram of a flow chart of a disk data backup method in another embodiment;
[0053] FIG5 is a block diagram of an edge cluster structure in one embodiment;
[0054] FIG6 is a schematic diagram of a flow chart of another disk data backup method in one embodiment;
[0055] FIG7 is a schematic diagram of a flow chart of another disk data backup method in one embodiment;
[0056] FIG8 is a structural block diagram of a virtual machine failure migration device in one embodiment;
[0057] FIG9 is a structural block diagram of another virtual machine failure migration device in one embodiment;
[0058] FIG10 is a block diagram of a disk data backup device according to an embodiment;
[0059] FIG. 11 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0060] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0061] The virtual machine fault migration method provided in the embodiment of the present application can be applied to the application environment shown in Figure 1. Among them, the central cloud cluster 102 communicates with at least two edge clusters 104. Each edge cluster 104 communicates with the object storage. In actual applications, the central cloud cluster 102 detects an abnormal first edge cluster in at least two edge clusters 104, and obtains a list of virtual machines of the first edge cluster; the list of virtual machines includes a virtual machine identifier corresponding to the virtual machine to be migrated in the first edge cluster; the central cloud cluster 102 selects a second edge cluster that meets the migration resource conditions in at least two edge clusters 104, and issues a fault migration task to the second edge cluster; the fault migration task is used to enable the second edge cluster to migrate the virtual machine to be migrated to the second edge cluster according to the disk backup file associated with the virtual machine identifier stored in the object storage to continue running; wherein the disk backup file is obtained by backing up the disk data of the target disk to the object storage in response to the first edge cluster in response to the write operation disk snapshot of the target disk associated with the virtual machine identifier. In actual applications, the central cloud cluster 102 and the edge cluster 104 can be independent physical servers, or they can be server clusters or distributed systems composed of multiple physical servers, or they can be cloud servers that provide cloud computing services.
[0062] In an exemplary embodiment, as shown in FIG2 , a virtual machine failover method is provided, which is described by taking the method applied to the central cloud cluster 102 in FIG1 as an example, and includes the following steps S202 to S206 . Among them:
[0063] Step S202: Detect an abnormal first edge cluster in at least two edge clusters, and obtain a list of virtual machines of the first edge cluster.
[0064] The virtual machine list includes virtual machine identifiers corresponding to the virtual machines to be migrated in the first edge cluster.
[0065] In a specific implementation, the central cloud cluster is deployed with a fault migration scheduling center, which can obtain the cluster status information reported by each edge cluster, and detect in real time whether there is a faulty / abnormal first edge cluster in at least two edge clusters based on the cluster status information reported by each edge cluster. Then, the fault migration scheduling center obtains the virtual machine list of the first edge cluster to determine the virtual machine identifier corresponding to the virtual machine to be migrated in the first edge cluster, so as to subsequently migrate the virtual machine to be migrated in the first edge cluster to other normal edge clusters.
[0066] Optionally, the step of detecting an abnormal first edge cluster in at least two edge clusters includes: receiving cluster status information reported by at least two edge clusters respectively; determining a target edge cluster in at least two edge clusters according to the cluster status information reported by at least two edge clusters respectively; and determining that the target edge cluster is the abnormal first edge cluster.
[0067] Among them, the cluster status information corresponding to the target edge cluster meets the preset fault status condition.
[0068] In the specific implementation, the detection and alarm tool Prometheus can be deployed in the edge cluster, and the cluster status information of the edge cluster can be collected through the detection and alarm tool; in addition, the edge cluster is also deployed with a working node Agent, and the working node Agent can collect the cluster status information of the edge cluster from the data interface provided by the detection and alarm tool; the working node Agent reports the cluster status information of the edge cluster to the fault migration scheduling center in the central cloud cluster.
[0069] The fault migration scheduling center can receive cluster status information reported by at least two edge clusters; determine the target edge cluster in at least two edge clusters according to the cluster status information reported by at least two edge clusters; specifically, the fault migration scheduling center can determine whether the edge cluster is in a preset fault state, that is, whether the cluster status information meets the preset fault state condition, according to the cluster status information reported by the edge cluster. In the case that any one of the at least two edge clusters (the target edge cluster) is in a preset fault state, the fault migration scheduling center will regard the edge cluster in the fault state as the first edge cluster with an abnormality.
[0070] Step S204: Select a second edge cluster that meets the resource migration condition from at least two edge clusters, and issue a fault migration task to the second edge cluster.
[0071] The fault migration task is used to enable the second edge cluster to migrate the virtual machine to be migrated to the second edge cluster for continued operation according to the disk backup file associated with the virtual machine identifier stored in the object storage.
[0072] The disk backup file is obtained by backing up the disk data of the target disk to the object storage when the first edge cluster responds to a change in a write operation disk snapshot of the target disk associated with the virtual machine identifier.
[0073] The write operation disk snapshot may refer to a disk snapshot created in response to a write data operation on a target disk.
[0074] In a specific implementation, when the central cloud cluster determines to migrate the virtual machines to be migrated in the first edge cluster to other normal edge clusters, the central cloud cluster can select a second edge cluster that meets the migration resource conditions from at least two edge clusters. Then, the central cloud cluster can create a fault migration task based on the virtual machine identifier corresponding to the virtual machine to be migrated in the first edge cluster, and send the fault migration task to the second edge cluster.
[0075] Optionally, the step of selecting a second edge cluster that meets the migration resource conditions from at least two edge clusters includes: obtaining cluster resource attributes corresponding to each candidate edge cluster; determining a resource condition score for each candidate edge cluster based on the cluster resource attributes corresponding to each candidate edge cluster; and determining to select the candidate edge cluster with the highest priority as the second edge cluster based on the resource condition scores of each candidate edge cluster.
[0076] The candidate edge cluster is an edge cluster other than the first edge cluster in the at least two edge clusters and meets the migration resource condition.
[0077] The resource condition score is related to the selection priority of the candidate edge cluster. In practical applications, the resource condition score and the selection priority of the candidate edge cluster may be positively correlated or negatively correlated.
[0078] In the specific implementation, when the fault migration scheduling center of the central cloud cluster selects the second edge cluster that meets the migration resource conditions from at least two edge clusters, the fault migration scheduling center can obtain the cluster resource attributes corresponding to each of the N edge clusters (i.e., the candidate edge clusters) that meet the migration resource conditions, such as resource occupancy, storage occupancy, cluster distance, etc.; through the pre-configured scheduling strategy, based on the cluster resource attributes corresponding to each candidate edge cluster, determine the resource condition score of each candidate edge cluster. The resource condition score is used to characterize the selection priority of the candidate edge cluster.
[0079] Then, the fault migration scheduling center can determine to select the candidate edge cluster with the highest priority as the second edge cluster based on the resource condition scores of each candidate edge cluster. For example, when the resource condition score is negatively correlated with the selection priority of the candidate edge cluster, the fault migration scheduling center can select the candidate edge cluster with the smallest resource condition score as the second edge cluster among the candidate edge clusters; when the resource condition score is positively correlated with the selection priority of the candidate edge cluster, the fault migration scheduling center can select the candidate edge cluster with the largest resource condition score as the second edge cluster among the candidate edge clusters.
[0080] Optionally, the cluster resource attributes include at least one of CPU usage, memory usage, storage usage or cluster distance. According to the cluster resource attributes corresponding to each candidate edge cluster, the resource condition score of each candidate edge cluster is determined, including: for any candidate edge cluster among the candidate edge clusters, obtaining the resource attribute value corresponding to each cluster resource attribute of any candidate edge cluster; according to the weights corresponding to each cluster resource attribute, weighted summing up the resource attribute values corresponding to each cluster resource attribute to obtain the resource condition score of any candidate edge cluster; the resource condition score is negatively correlated with the selection priority of the candidate edge cluster.
[0081] In the specific implementation, when the cluster resource attributes include CPU usage, memory usage, storage usage, and cluster distance, for any candidate edge cluster among the candidate edge clusters, the fault migration scheduling center can obtain the resource attribute value corresponding to each cluster resource attribute of any candidate edge cluster; then, the fault migration scheduling center can perform weighted summation of the resource attribute values corresponding to each cluster resource attribute according to the weight corresponding to each cluster resource attribute, and obtain the resource condition score of any candidate edge cluster; the resource condition score is negatively correlated with the selection priority of the candidate edge cluster. In practical applications, the resource condition score can be expressed as:
[0082]
[0083] in, is the i-th candidate edge cluster, is the weight corresponding to the CPU usage, is the CPU usage value of the i-th candidate edge cluster, is the weight corresponding to the memory usage, is the memory usage value of the i-th candidate edge cluster, is the weight corresponding to the storage utilization rate, is the storage usage value of the i-th candidate edge cluster, is the weight corresponding to the cluster distance, is the value of the cluster distance of the i-th candidate edge cluster.
[0084] In an exemplary embodiment, as shown in FIG3 , a virtual machine failover method is provided, which is described by taking the method applied to the second edge cluster in the edge cluster 104 in FIG1 as an example, and includes the following steps S302 to S306 . Among them:
[0085] Step S302: receiving a fault migration task issued by the central cloud cluster; the fault migration task carries a virtual machine identifier corresponding to the virtual machine to be migrated.
[0086] In a specific implementation, the second edge cluster receives a fault migration task issued by the central cloud cluster, and the fault migration task carries a virtual machine identifier corresponding to the virtual machine to be migrated in the first edge cluster.
[0087] Step S304: download the disk backup file associated with the virtual machine identifier from the object storage.
[0088] In the specific implementation, after receiving the fault migration task issued by the central cloud cluster, the second edge cluster can send a disk backup file download request to the object storage according to the virtual machine identifier carried by the fault migration task, so as to instruct the object storage to return the disk backup file associated with the virtual machine identifier through the disk backup file download request. The generation process of the disk backup file will be further explained below, so I will not explain it too much here.
[0089] Step S306: Migrate the virtual machine to be migrated to the second edge cluster to continue running according to the disk backup file.
[0090] In a specific implementation, after the second edge cluster downloads the disk backup file associated with the virtual machine identifier from the object storage, the second edge cluster can migrate the virtual machine to be migrated to the second edge cluster for continued operation according to the disk backup file. Specifically, the second edge cluster can create a twin virtual machine of the virtual machine to be migrated in the second edge cluster according to the disk backup file, and start the operation of the twin virtual machine to achieve the migration of the virtual machine to be migrated to the second edge cluster for continued operation.
[0091] Optionally, according to the disk backup file, the virtual machine to be migrated is migrated to the second edge cluster to continue running, including: restoring the disk backup file to the block storage of the second edge cluster; creating a backup virtual machine on the second edge cluster that matches the specifications of the virtual machine to be migrated, and mounting the restored disk in the block storage for the backup virtual machine.
[0092] The restored disk is a disk restored based on the disk backup file.
[0093] In a specific implementation, when the second edge cluster migrates the virtual machine to be migrated to the second edge cluster for continued operation according to the disk backup file, the second edge cluster can restore the disk backup file to the block storage of the second edge cluster; after the disk of the virtual machine to be migrated is successfully restored in the block storage of the second edge cluster, the second edge cluster can create a backup virtual machine that matches the specifications of the virtual machine to be migrated on the second edge cluster, and the second edge cluster mounts the restored disk in the block storage for the high-standby virtual machine.
[0094] The above-mentioned virtual machine fault migration method can be applied to the central cloud cluster, by detecting an abnormal first edge cluster in at least two edge clusters, obtaining a virtual machine list of the first edge cluster; the virtual machine list includes a virtual machine identifier corresponding to the virtual machine to be migrated in the first edge cluster; and selecting a second edge cluster that meets the migration resource conditions from the at least two edge clusters, and issuing a fault migration task to the second edge cluster; the fault migration task is used to enable the second edge cluster to migrate the virtual machine to be migrated to the second edge cluster for continued operation according to the disk backup file associated with the virtual machine identifier stored in the object storage; wherein the disk backup file is obtained by the first edge cluster backing up the disk data of the target disk to the object storage in response to a change in the disk snapshot of the write operation of the target disk associated with the virtual machine identifier; in this way, the bandwidth occupied when backing up the virtual machine disk data can be reduced, the impact of the backup on the cluster performance can be reduced, and the backup frequency of the virtual machine disk data can be kept within a suitable range; at the same time, the machine fault migration can be triggered in time, and the backup data can be quickly restored to other edge clusters to continue to provide virtual machine services, effectively improving the efficiency of virtual machine cross-cluster fault migration.
[0095] In an exemplary embodiment, as shown in FIG4 , a disk data backup method is provided, which is described by taking the method applied to the first edge cluster in the edge cluster 104 in FIG1 as an example, and includes the following steps S402 to S406 . Among them:
[0096] Step S402: When it is detected that a data write operation exists on the target disk, a snapshot operation is performed on the target disk to obtain a current disk snapshot corresponding to the current data write operation.
[0097] In the specific implementation, as shown in FIG5, the detection and alarm tool Prometheus can be deployed in the edge cluster, and the detection and alarm tool can be used to collect virtual machine indicators, storage indicators, cluster indicators, etc., including the read and write IO of the target disk. In addition, the edge cluster is also deployed with a backup module, which determines which disks need to be backed up, and executes backup tasks and recovery tasks. In actual applications, the specific process of the backup module function to determine whether the disk needs to be backed up is shown in FIG6, wherein the backup module of the first edge cluster can obtain the read and write IO indicators of each disk by querying the data interface of the detection and alarm tool Prometheus, traverse each disk, and determine whether each disk has a write data operation. If not, the step of determining whether the next disk has a write data operation is performed; if one of the disks has a write data operation, such as the case where the target disk has a write data operation, the backup module performs a snapshot operation on the target disk to obtain the current disk snapshot corresponding to the current write data operation.
[0098] Step S404, obtaining a historical disk snapshot corresponding to the last data write operation, and in the case that there is a difference between the historical disk snapshot and the current disk snapshot, adding a disk backup task of the target disk to the backup queue.
[0099] In a specific implementation, the backup module of the first edge cluster can determine whether the current disk snapshot is the first disk snapshot; if the current disk snapshot is the first disk snapshot, the backup module can add a disk backup task of the target disk to the backup queue.
[0100] If the current disk snapshot is not the first disk snapshot, the backup module of the first edge cluster can obtain the historical disk snapshot corresponding to the last data write operation; then, the backup module of the first edge cluster can determine whether there is a difference between the two most recent snapshots by comparing the historical disk snapshot with the current disk snapshot; if there is a difference between the historical disk snapshot and the current disk snapshot, the backup module of the first edge cluster can add a disk backup task for the target disk to the backup queue. If there is no difference between the historical disk snapshot and the current disk snapshot, it is determined that the disk data in the target disk has not changed, and the backup module of the first edge cluster does not perform a backup operation on the target disk.
[0101] Step S406 , executing the disk backup task according to the disk backup policy matching the target disk, so as to back up the disk data of the target disk to the object storage.
[0102] In the specific implementation, as shown in Figure 7, the backup module of the first edge cluster can obtain the disk backup task in the backup queue, and then obtain the disk backup strategy that matches the target disk; specifically, the backup module of the first edge cluster can determine whether the target disk has been backed up; if the target disk has not been backed up, a full backup is performed; if the target disk has been backed up, the backup module of the first edge cluster obtains the backup list of the target disk, performs a full backup or an incremental backup according to the disk backup strategy configured for the target disk, and uploads the disk backup file to the object storage to back up the disk data of the target disk to the object storage.
[0103] In actual applications, different disk backup strategies can be implemented according to different disks. The disk backup strategy may include at least:
[0104] 1) Only perform full backup;
[0105] 2) Full backup and rolling update of incremental backup;
[0106] The update logic of rolling update: according to the configured number of backups, for example, if the number of backups is set to 5, the first one is a full backup, and the second to fifth ones are incremental backups based on the first full backup. When the sixth backup is executed, the sixth creates a full backup, then deletes the second incremental snapshot, executes the seventh backup, which is an incremental backup based on the sixth full backup, and then deletes the third incremental snapshot... Execute the tenth backup, which is an incremental backup based on the sixth backup, delete the first full backup, and so on.
[0107] 3) Support more customized backup strategies.
[0108] The above disk data backup method can be applied to edge clusters. When a write data operation is detected on the target disk, a snapshot operation is performed on the target disk to obtain the current disk snapshot corresponding to the current write data operation, and the historical disk snapshot corresponding to the previous write data operation is obtained. When there is a difference between the historical disk snapshot and the current disk snapshot, a disk backup task for the target disk is added to the backup queue; the disk backup task is executed according to the disk backup strategy that matches the target disk to back up the disk data of the target disk to the object storage; in this way, the virtual machine disk data can be backed up only when there is a write data change on the disk mounted on the virtual machine, which effectively reduces the bandwidth occupied when backing up the virtual machine disk data, reduces the impact of backup on cluster performance, and keeps the backup frequency of the virtual machine disk data within an appropriate range.
[0109] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0110] Based on the same inventive concept, the embodiment of the present application also provides a virtual machine failure migration and disk data backup device for implementing the virtual machine failure migration and disk data backup method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more virtual machine failure migration and disk data backup device embodiments provided below can refer to the limitations of the virtual machine failure migration and disk data backup method above, and will not be repeated here.
[0111] In an exemplary embodiment, as shown in FIG8 , a virtual machine failure migration device is provided, which is applied to a central cloud cluster and includes:
[0112] An acquisition module 810 is configured to detect an abnormal first edge cluster in at least two edge clusters, and acquire a virtual machine list of the first edge cluster; the virtual machine list includes virtual machine identifiers corresponding to the virtual machines to be migrated in the first edge cluster;
[0113] The sending module 820 is used to select a second edge cluster that meets the migration resource condition from the at least two edge clusters, and send a fault migration task to the second edge cluster; the fault migration task is used to enable the second edge cluster to migrate the virtual machine to be migrated to the second edge cluster for continued operation according to the disk backup file associated with the virtual machine identifier stored in the object storage;
[0114] The disk backup file is obtained by backing up disk data of the target disk to the object storage when the first edge cluster responds to a change in a write operation disk snapshot of the target disk associated with the virtual machine identifier.
[0115] In one of the embodiments, the acquisition module 810 is specifically used to receive cluster status information reported by each of the at least two edge clusters; determine a target edge cluster among the at least two edge clusters based on the cluster status information reported by each of the at least two edge clusters; the cluster status information corresponding to the target edge cluster satisfies a preset fault status condition; and determine that the target edge cluster is the first edge cluster with an abnormality.
[0116] In one of the embodiments, the sending module 820 is specifically used to obtain the cluster resource attributes corresponding to each candidate edge cluster; the candidate edge cluster is an edge cluster other than the first edge cluster in the at least two edge clusters, and satisfies the migration resource condition; according to the cluster resource attributes corresponding to each of the candidate edge clusters, the resource condition score of each of the candidate edge clusters is determined; the resource condition score is related to the selection priority of the candidate edge cluster; according to the resource condition scores of each of the candidate edge clusters, the candidate edge cluster with the highest priority is determined to be selected as the second edge cluster.
[0117] In one of the embodiments, the cluster resource attributes include at least one of CPU usage, memory usage, storage usage or distance, and the sending module is specifically used to obtain, for any candidate edge cluster among the candidate edge clusters, the resource attribute value corresponding to each of the cluster resource attributes of the candidate edge cluster; weighted summation is performed on the resource attribute values corresponding to each of the cluster resource attributes according to the weights corresponding to the cluster resource attributes to obtain the resource condition score of the candidate edge cluster; the resource condition score is negatively correlated with the selection priority of the candidate edge cluster.
[0118] In an exemplary embodiment, as shown in FIG9 , a virtual machine failover device is provided, which is applied to the second edge cluster as described above, and the method includes:
[0119] The receiving module 910 is used to receive the fault migration task issued by the central cloud cluster; the fault migration task carries the virtual machine identifier corresponding to the virtual machine to be migrated;
[0120] A download module 920, configured to download the disk backup file associated with the virtual machine identifier from the object storage;
[0121] The migration module 930 is used to migrate the virtual machine to be migrated to the second edge cluster to continue running according to the disk backup file.
[0122] In one embodiment, the migration module 930 is specifically used to restore the disk backup file to the block storage of the second edge cluster; create a backup virtual machine that matches the specifications of the virtual machine to be migrated on the second edge cluster, and mount the restored disk in the block storage for the backup virtual machine; the restored disk is a disk restored based on the disk backup file.
[0123] In an exemplary embodiment, as shown in FIG10 , a disk data backup device is provided, which is applied to the first edge cluster as described above, and the method includes:
[0124] The snapshot module 1010 is used to perform a snapshot operation on the target disk to obtain a current disk snapshot corresponding to the current data write operation when a data write operation is detected on the target disk;
[0125] The comparison module 1020 is used to obtain a historical disk snapshot corresponding to the last data write operation, and if there is a difference between the historical disk snapshot and the current disk snapshot, add a disk backup task of the target disk to the backup queue;
[0126] The backup module 1030 is used to execute the disk backup task according to the disk backup strategy matching the target disk, so as to back up the disk data of the target disk to the object storage.
[0127] Each module in the above-mentioned virtual machine fault migration and disk data backup device can be implemented in whole or in part by software, hardware and their combination. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the corresponding operations of each of the above modules.
[0128] In an exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be shown in FIG11. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface is connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a virtual machine fault migration and disk data backup method is implemented.
[0129] Those skilled in the art will understand that the structure shown in FIG. 11 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0130] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the above-mentioned method for virtual machine failure migration and disk data backup. The steps of the above-mentioned method for virtual machine failure migration and disk data backup may be the steps of the above-mentioned method for virtual machine failure migration and disk data backup in each of the above-mentioned embodiments.
[0131] In one embodiment, a computer-readable storage medium is provided, which stores a computer program. When the computer program is executed by a processor, the processor executes the steps of the above-mentioned method for virtual machine failure migration and disk data backup. The steps of the above-mentioned method for virtual machine failure migration and disk data backup can be the steps of the above-mentioned method for virtual machine failure migration and disk data backup in each of the above-mentioned embodiments.
[0132] In one embodiment, a computer program product is provided, including a computer program. When the computer program is executed by a processor, the processor executes the steps of the above-mentioned virtual machine failure migration and disk data backup method. The steps of the above-mentioned virtual machine failure migration and disk data backup method can be the steps of the above-mentioned virtual machine failure migration and disk data backup method in each of the above-mentioned embodiments.
[0133] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0134] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magneto resistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0135] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0136] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A virtual machine failure migration method, characterized in that: Applied to the central cloud cluster, the method includes: Detecting an abnormal first edge cluster among at least two edge clusters, and obtaining a virtual machine list of the first edge cluster; the virtual machine list includes virtual machine identifiers corresponding to the virtual machines to be migrated in the first edge cluster; Selecting a second edge cluster that meets the resource migration condition from the at least two edge clusters, and issuing a fault migration task to the second edge cluster; the fault migration task is used to enable the second edge cluster to migrate the virtual machine to be migrated to the second edge cluster for continued operation according to the disk backup file associated with the virtual machine identifier stored in the object storage; The disk backup file is obtained by backing up disk data of the target disk to the object storage when the first edge cluster responds to a change in a write operation disk snapshot of the target disk associated with the virtual machine identifier.
2. The method according to claim 1, characterized in that The step of detecting a first edge cluster having an abnormality in at least two edge clusters comprises: Receiving cluster status information reported by each of the at least two edge clusters; Determine a target edge cluster from the at least two edge clusters according to the cluster status information reported by each of the at least two edge clusters; the cluster status information corresponding to the target edge cluster meets a preset fault status condition; It is determined that the target edge cluster is the first edge cluster having an abnormality.
3. The method according to claim 1, characterized in that The step of selecting a second edge cluster that meets the resource migration condition from the at least two edge clusters includes: Acquire cluster resource attributes corresponding to each candidate edge cluster; the candidate edge cluster is an edge cluster other than the first edge cluster in the at least two edge clusters, and satisfies the migration resource condition; Determine a resource condition score of each candidate edge cluster according to the cluster resource attributes corresponding to each candidate edge cluster; the resource condition score is related to the selection priority of the candidate edge cluster; According to the resource condition scores of the candidate edge clusters, it is determined to select the candidate edge cluster with the highest priority as the second edge cluster.
4. The method according to claim 2, characterized in that: The cluster resource attribute includes at least one of CPU usage, memory usage, storage usage or cluster distance, and the resource condition score of each candidate edge cluster is determined according to the cluster resource attribute corresponding to each candidate edge cluster, including: For any candidate edge cluster among the candidate edge clusters, obtaining a resource attribute value corresponding to each cluster resource attribute of the any candidate edge cluster; According to the weights corresponding to the cluster resource attributes, the resource attribute values corresponding to the cluster resource attributes are weighted and summed to obtain the resource condition score of any candidate edge cluster; the resource condition score is negatively correlated with the selection priority of the candidate edge cluster.
5. A virtual machine failure migration method, characterized in that: Applied to the second edge cluster according to any one of claims 1 to 4, the method comprises: Receiving the fault migration task issued by the central cloud cluster; the fault migration task carries the virtual machine identifier corresponding to the virtual machine to be migrated; Downloading the disk backup file associated with the virtual machine identifier from the object storage; According to the disk backup file, the virtual machine to be migrated is migrated to the second edge cluster to continue running.
6. The method according to claim 5, characterized in that The step of migrating the virtual machine to be migrated to the second edge cluster for continued operation according to the disk backup file includes: Restoring the disk backup file to the block storage of the second edge cluster; A standby virtual machine matching the specifications of the virtual machine to be migrated is created on the second edge cluster, and a restored disk in the block storage is mounted for the standby virtual machine; the restored disk is a disk restored based on the disk backup file.
7. A disk data backup method, characterized in that: Applied to the first edge cluster according to any one of claims 1 to 4, the method comprises: When a data write operation is detected on the target disk, a snapshot operation is performed on the target disk to obtain a current disk snapshot corresponding to the current data write operation; Obtain a historical disk snapshot corresponding to the last data write operation, and if there is a difference between the historical disk snapshot and the current disk snapshot, add a disk backup task of the target disk to the backup queue; The disk backup task is executed according to the disk backup strategy matching the target disk, so as to back up the disk data of the target disk to the object storage.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Virtual machine backup method and device, computer equipment, readable storage medium and program product
CN120909847A