Data backup recovery method and device, electronic equipment and storage medium

By obtaining and rolling back the snapshot data of the target cloud host, ensuring the consistency of disk device numbers of the backup cloud host, solving the problems of data confusion and inconsistent correspondence relationships in cloud host data recovery, and achieving the improvement of data consistency and service availability.

CN119065891APending Publication Date: 2024-12-03TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310629243.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-05-30
Publication Date
2024-12-03

AI Technical Summary

Technical Problem

During the data recovery process of cloud hosts, data chaos exists in the backup cloud host, resulting in unavailability of customer services on the cloud hosts, and the correspondence between cloud disk and disk device numbers before and after backup is inconsistent, affecting data consistency.

Method used

By obtaining the disk identity and snapshot data of the target cloud host, create a backup cloud host with the same configuration as the target cloud host, and roll back the snapshot data to the backup cloud disk, mount the backup cloud disk to the backup cloud host according to the disk identity, ensuring that The corresponding relationship between cloud disk and disk device number before and after backup is the same.

Benefits of technology

It ensures that the restored data is consistent with the original data, avoids the unavailability of customer service caused by data chaos, and improves the accuracy and reliability of backup and recovery.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119065891A_ABST
    Figure CN119065891A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a data backup recovery method and device, electronic equipment and a storage medium. The method comprises the following steps: in response to a data backup recovery request, acquiring a disk identifier, corresponding to each target cloud disk in a target cloud host, in a plurality of target cloud disks mounted on the target cloud host and snapshot data of each target cloud disk; creating a backup cloud host corresponding to the target cloud host; rolling back the snapshot data corresponding to each target cloud disk to a backup cloud disk, and determining the backup cloud disk corresponding to each target cloud disk; and mounting a backup cloud disk corresponding to the target cloud disk to a disk corresponding to the disk identifier in the backup cloud host according to the disk identifier corresponding to the target cloud disk. By the adoption of the method, it can be guaranteed that the recovered data is consistent with the original data, and the corresponding relation between the cloud disk and the disk before and after backup is consistent, so that the situation that customer services on the cloud host are unavailable due to data chaos in the backup cloud host is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of data storage, and more specifically, to a data backup and recovery method, device, electronic device and storage medium. Background Art

[0002] With the continuous development of cloud computing technology, cloud computing is also facing more complex business scenarios such as hybrid architecture; therefore, users have higher requirements for the security of cloud host runtime systems and data. Since cloud hosts may be attacked by network hackers and some unexpected scenarios such as misoperation by operation and maintenance personnel during operation, it is currently an urgent need for cloud hosts to be able to quickly recover to the expected state when problems occur.

[0003] However, the inventor has discovered through research that in the related art, after data recovery, there is data confusion in the backup cloud host, and even the customer service on the cloud host is unavailable due to the data confusion. Summary of the invention

[0004] In view of this, the embodiments of the present application propose a data backup and recovery method, device, electronic device and storage medium, which can ensure that the restored data is consistent with the original data, and the correspondence between the cloud disk number mounted on the cloud host before and after the backup is consistent with the internal disk device number of the cloud host, thereby avoiding data confusion in the backup cloud host and even causing customer service on the cloud host to be unavailable.

[0005] In a first aspect, an embodiment of the present application provides a data backup and recovery method, the method comprising: in response to a data backup and recovery request, obtaining a disk identifier in a target cloud host and snapshot data of each target cloud disk corresponding to a plurality of target cloud disks mounted on the target cloud host; creating a backup cloud host corresponding to the target cloud host, the number of backup cloud disks mounted on the backup cloud host being the same as the number of target cloud disks mounted on the target cloud host; rolling back the snapshot data corresponding to each target cloud disk to a backup cloud disk, and determining a backup cloud disk corresponding to each target cloud disk; and mounting, according to the disk identifier corresponding to the target cloud disk, the backup cloud disk corresponding to the target cloud disk to the disk corresponding to the disk identifier in the backup cloud host.

[0006] In the second aspect, the embodiment of the present application provides a data backup and recovery device, which includes: a data acquisition module, a host creation module, a data rollback module and a cloud disk mounting module. The data acquisition module is used to respond to a data backup and recovery request, and obtain the disk identifier of each target cloud disk in the target cloud host and the snapshot data of each target cloud disk corresponding to the multiple target cloud disks mounted on the target cloud host; the host creation module is used to create a backup cloud host corresponding to the target cloud host, and the number of backup cloud disks mounted in the backup cloud host is the same as the number of target cloud disks mounted on the target cloud host; the data rollback module is used to roll back the snapshot data corresponding to each target cloud disk to a backup cloud disk, and determine the backup cloud disk corresponding to each target cloud disk; the cloud disk mounting module is used to mount the backup cloud disk corresponding to the target cloud disk to the disk corresponding to the disk identifier in the backup cloud host according to the disk identifier corresponding to the target cloud disk.

[0007] In one possible implementation, the data acquisition module is also used to obtain the disk identifier of each target cloud disk mounted on the target cloud host from the mother machine where the cloud host is located. The disk identifier of each target cloud disk is generated by a background program when the target cloud host is started for the first time.

[0008] In one possible implementation, the data backup and recovery request carries a host identifier of the target host, and the device further comprises an identifier acquisition module and a master machine confirmation module. The identifier acquisition module is used to obtain the host identifier of the cloud host corresponding to each of the multiple master machines and the host identifier of the target cloud host carried in the data backup and recovery request; the master machine confirmation module is used to confirm the master machine where the target cloud host is located according to the host identifier of the cloud host corresponding to each of the master machines and the host identifier of the target cloud host.

[0009] In one possible implementation, the data acquisition module includes a file acquisition submodule and an identifier acquisition submodule. The file acquisition submodule is used to acquire the markup language file in the memory of the mother machine where the cloud host is located; the identifier acquisition submodule is used to acquire the disk identifier of each target cloud disk mounted on the target cloud host from the markup language file.

[0010] In one possible implementation, the data rollback module includes an unhook processing submodule and a data rollback submodule. The unhook processing submodule is used to control the shutdown of the backup cloud host and unhook each backup cloud disk in the shutdown backup cloud host; the data rollback submodule is used to roll back the snapshot data corresponding to each target cloud disk to an unhooked backup cloud disk to obtain a backup cloud disk corresponding to each target cloud disk.

[0011] In one feasible implementation, each target cloud disk corresponds to a cloud disk identifier, and each backup cloud disk corresponds to a backup cloud disk identifier. The data rollback submodule is also used to determine the backup cloud disk corresponding to each target cloud disk based on the cloud disk number corresponding to each target cloud disk and the cloud disk number corresponding to each backup cloud disk; and roll back the snapshot data corresponding to each target cloud disk to the backup cloud disk corresponding to the target cloud disk.

[0012] In one possible implementation, the data rollback submodule is also used to determine the mounting order of the backup cloud disks corresponding to each target cloud disk according to the disk identifier corresponding to each target cloud disk, and mount each backup cloud disk to the disk corresponding to the disk identifier in the backup cloud host according to the corresponding mounting order.

[0013] In one possible implementation, the cloud disk mounting module is also used to determine the mounting order of the backup cloud disks corresponding to each target cloud disk according to the disk identifier corresponding to each target cloud disk, and mount each backup cloud disk to the disk corresponding to the disk identifier in the backup cloud host according to the corresponding mounting order.

[0014] In one possible implementation, the device further includes a snapshot module, which is used to perform a snapshot operation on the data files in each target cloud disk mounted on the target cloud host to generate snapshot data corresponding to each target cloud disk.

[0015] In one feasible implementation, the snapshot module is also used to perform snapshot operations on the data files in each target cloud disk mounted on the target cloud host at intervals of a preset duration to obtain multiple reference snapshot data and the snapshot operation time corresponding to each reference snapshot data; based on the snapshot operation time of each reference snapshot data corresponding to each target cloud disk and the specified snapshot time, the snapshot data of the target cloud disk is determined from the multiple reference snapshot data.

[0016] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor and a memory; one or more programs are stored in the memory and configured to be executed by the processor to implement the above method.

[0017] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which a program code is stored, wherein the above method is executed when the program code is executed by a processor.

[0018] In a fifth aspect, an embodiment of the present application provides a computer program product or a computer program, the computer program product or the computer program including computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device obtains the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the above method.

[0019] The embodiments of the present application provide a data backup and recovery method, device, electronic device and storage medium, the method comprising: since the backup cloud host and the target cloud host are created by the same background and mounted on the same mother machine, the internally set disk device numbers of the backup cloud host and the target cloud host are the same, and after the snapshot data corresponding to each target cloud disk is rolled back to a backup cloud disk, the backup cloud disk corresponding to the target cloud disk is mounted to the disk corresponding to the disk identifier in the backup cloud host according to the disk identifier corresponding to the target cloud disk, so that the restored data is consistent with the original data, and the correspondence between the cloud disk and the disk before and after the backup is consistent, and the correspondence between the cloud disk and the disk device number inside the host before and after the backup is also consistent, so that the consistency of the data read from the backup cloud host and the data read from the original cloud host (target cloud host) can be guaranteed, avoiding the situation where the customer service on the cloud host is unavailable due to data confusion in the backup cloud host. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0021] Figure 1 An application scenario diagram of a data backup and recovery method provided by an embodiment of the present application is shown;

[0022] Figure 2 A schematic diagram showing a flow chart of a data backup and recovery method proposed in an embodiment of the present application is shown;

[0023] Figure 3 Another schematic diagram of a data backup and recovery method proposed in an embodiment of the present application is shown;

[0024] Figure 4 A flowchart of a data backup and recovery method provided by an embodiment of the present application is shown;

[0025] Figure 5 A schematic diagram of a process for obtaining a disk identification provided by an embodiment of the present application is shown;

[0026] Figure 6 Another schematic diagram of a data backup and recovery method provided in an embodiment of the present application is shown;

[0027] Figure 7 A connection block diagram of a data backup and recovery device provided in an embodiment of the present application is shown;

[0028] Figure 8 A structural block diagram of an electronic device for executing the method of an embodiment of the present application is shown. DETAILED DESCRIPTION

[0029] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this application will be more comprehensive and complete and fully convey the concept of the example embodiments to those skilled in the art.

[0030] In addition, described feature, structure or characteristic can be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present application. However, those skilled in the art will appreciate that the technical scheme of the present application can be put into practice without one or more of the specific details, or other methods, components, devices, steps, etc. can be adopted. In other cases, known methods, devices, realizations or operations are not shown or described in detail to avoid blurring the various aspects of the application.

[0031] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0032] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.

[0033] It should be noted that the “plurality” mentioned in this article refers to two or more.

[0034] With the rapid development of cloud technology, related concepts such as cloud computing, cloud storage, and cloud security have gradually emerged. Among them, cloud storage is a new concept that extends and develops from the concept of cloud computing. Distributed cloud storage system (hereinafter referred to as storage system) refers to a storage system that uses cluster applications, grid technology, and distributed storage file systems to bring together a large number of different types of storage devices (storage devices are also called storage nodes) in the network through application software or application interfaces to work together and provide external data storage and business access functions.

[0035] At present, the storage method of the storage system is: create a logical volume, and when creating a logical volume, allocate physical storage space for each logical volume. The physical storage space may be composed of disks of a storage device or several storage devices. The client stores data on a logical volume, that is, stores the data on the file system. The file system divides the data into many parts, each of which is an object. The object contains not only data but also additional information such as data identification (ID, ID entity). The file system writes each object into the physical storage space of the logical volume (cloud disk) separately, and the file system records the storage location information of each object, so that when the client requests to access the data, the file system can allow the client to access the data according to the storage location information of each object.

[0036] The process of allocating physical storage space to a logical volume (i.e., cloud disk) by the storage system is as follows: based on the estimated capacity of the objects stored in the logical volume (this estimate often has a large margin relative to the actual capacity of the objects to be stored) and the grouping of independent redundant disk arrays (RAID, Redundant Array of Independent Disks), the physical storage space is pre-divided into stripes. A logical volume can be understood as a stripe, thereby allocating physical storage space to the logical volume.

[0037] Before going into detail, the terms used in this application are explained as follows:

[0038] Cloud hosting is an important component of cloud computing in infrastructure applications and is located at the bottom of the pyramid of the cloud computing industry chain. Cloud hosting is a virtualization technology similar to VPS hosting. VPS uses virtual software, VZ or VM to virtualize multiple parts similar to independent hosts on a host, which can achieve single-machine multi-user. Each part can have a separate operating system and the management method is the same as the host. Cloud hosting is to virtualize multiple parts similar to independent hosts on a group of cluster hosts. Each host in the cluster has a mirror of the cloud host.

[0039] Cloud disk is a professional Internet storage tool and a product of Internet cloud technology. It provides information storage, reading, downloading and other services for enterprises and individuals through the Internet. Cloud disk is a disk instance built on a distributed storage system. It can be read and written in a cloud server like a computer disk. It has the characteristics of security, stability and massive storage. Compared with other physical disks, cloud disk is more convenient. Specifically, users do not need to carry their important information, files and data with them at all times. Instead, they can directly download their important information from the cloud through the Internet and use it directly after downloading.

[0040] Disks are the main storage media of computers. They can store large amounts of binary data and keep the data intact even after a power outage. The disk in the present application embodiment refers to the disk allocated to the cloud host.

[0041] Snapshot is a fast file system backup for the entire disk volume (cloud disk). The main difference from other backup methods is speed. When taking a disk snapshot, no file copying is involved. Even if the amount of data is large, generally speaking, the backup can be completed within one second. When creating a disk snapshot, it is not necessary to copy the data itself. It only notifies the LX Series NAS server to keep all the disk blocks with data and not overwrite them.

[0042] The following describes an exemplary application of a device for executing the above-mentioned data backup and recovery method provided by an embodiment of the present invention.

[0043] See also Figure 1 , which shows a schematic diagram of an application scenario of a virtual machine snapshot method provided by an embodiment of the present invention, the application scenario includes a user terminal and a server, the server can be used to run a background program, and the background program can be used to manage the above-mentioned mother machine, wherein the server includes a business cluster (multiple cloud hosts), the user inputs a data backup instruction through the user terminal and sends the data backup instruction to the server, and the background running in the server performs a snapshot operation on the data file in the business cluster according to the data backup instruction input by the user to obtain the snapshot data. The user can also input a data backup and recovery instruction through the user terminal and send a data backup and recovery instruction to the server, and the server can also obtain the disk identifier and snapshot data of each target cloud disk corresponding to the multiple target cloud disks mounted by the target cloud host in the target cloud host according to the received data backup and recovery instruction; create a backup cloud host corresponding to the target cloud host, and the number of backup cloud disks mounted in the backup cloud host is the same as the number of target cloud disks mounted by the target cloud host; obtain the snapshot data corresponding to each target cloud disk from the backup cluster, and roll back the snapshot data corresponding to each target cloud disk to a backup cloud disk, and determine the backup cloud disk corresponding to each target cloud disk. According to the disk ID corresponding to the target cloud disk, the backup cloud disk corresponding to the target cloud disk is mounted to the disk corresponding to the disk ID in the backup cloud host. This ensures that the restored data is consistent with the original data, and the correspondence between the cloud disk and the disk is consistent before and after the backup, thus avoiding the situation where the customer service on the cloud host is unavailable due to data confusion in the backup cloud host.

[0044] In the embodiments of this specification, the user terminal may include physical devices such as smart phones, desktop computers, tablet computers, laptops, digital assistants, smart wearable devices, etc., and may also include software running in the physical devices, such as test programs, etc. The operating system running on the user terminal in the embodiments of this application may include but is not limited to Android system, IOS system, Linux, Windows, Mac, etc.

[0045] In an embodiment of the present specification, a business cluster may include a standard database interface and / or a custom database interface. The standard database interface may include a mysql (Structured Query Language) interface, a zk (zookeeper) interface, and an HTTP JSON interface. The custom database interface may include an agent module (Agent) and / or a test adapter (TA).

[0046] See also Figure 2 As shown, an embodiment of the present application provides a data backup and recovery method, which can be applied to the above-mentioned server, that is, the above-mentioned data backup and recovery method can be executed by a background service running on the above-mentioned server, and the method includes:

[0047] Step S110: In response to a data backup and recovery request, obtaining a disk identifier of each target cloud disk in the target cloud host corresponding to a plurality of target cloud disks mounted on the target cloud host and snapshot data of each target cloud disk.

[0048] The target cloud host is the cloud host on which data backup and recovery are currently being performed; the target cloud disk is the cloud disk in the target cloud host, and the target cloud host can be divided into multiple cloud disks; the disk corresponding to the cloud host refers to the disk allocated to the cloud host in the parent machine, and the resources in the target cloud host used by the cloud disk in the target cloud host are actually the resources provided by the disk corresponding to the target cloud host.

[0049] The data backup and recovery request may be sent by a terminal device associated with the server, or may be generated by the server based on a preset rule, such as when it is detected that the corresponding snapshot data generation time reaches a preset time, or when it is detected that new snapshot data is generated, etc. It should be understood that the above-mentioned data recovery request generation process is only illustrative, and will not be described one by one in the embodiments of the present application.

[0050] The disk identifier of each target cloud disk corresponding to the target cloud host is used to identify the uniqueness of the disk mounted corresponding to each target cloud disk in the target cloud host. Accordingly, the disk identifier can be used to represent the specific mount location of the target cloud disk when it is mounted on the target host. Therefore, the disk identifier corresponding to each target cloud host can be any identifier, string or address data that can identify the specific mount location of the target cloud host mounted on the target cloud host.

[0051] In one possible implementation of the present application, when the number of cloud hosts mounted in the mother machine corresponding to the target cloud host is one, the disk identification may only include the Slot number. When the number of cloud hosts corresponding to the mother machine corresponding to the target cloud host is multiple, the disk identification may also include the Slot number, the Bus number and the Function number, that is, the disk identification is composed of the Slot number, the Bus number and the Function number. Among them, the bus connecting the disk is a tree structure, and each node of the tree structure is a Bus. The Bus number is used to identify the bus to which the device (for example, a disk) is connected. Each device on the bus corresponding to the disk has a unique Bus number. Multiple devices (for example, disks) can be connected to each Bus, and each device has a unique Slot number. The Slot number is used to identify the position of the device on the bus. Each device can have multiple functions, for example, a network card can have multiple ports. Each function has a unique Function number.

[0052] The disk identifier of each target cloud disk corresponding to the target cloud host can be generated by the background program when the target cloud host is first started, or it can be generated by the background program when the target cloud host is reset. The disk identifier of each target cloud disk can be stored in a database or storage device associated with the target cloud host, or it can be stored in the mother machine corresponding to the target cloud host. Accordingly, the above-mentioned acquisition of the disk identifier of each target cloud disk mounted on the target cloud host corresponding to the target cloud host can be: obtaining the disk identifier of each target cloud disk mounted on the target cloud host from the mother machine where the target cloud host is located. It can also be obtained from the database or storage device corresponding to the cloud host.

[0053] Among them, it should be noted that the mother machine is a physical host, sometimes also called a physical server. And the server is generally called a mother machine when opening a vps, cloud host, or virtual host. All independent servers can become mother machines after virtualization. In simple terms, the mother machine server is a high-end dedicated server used to create a VPS host. The mother machine refers to a physical server with large memory and large storage. In this application, the mother machine corresponding to the target cloud host refers to the physical device where the target cloud host is located. The mother machine in this embodiment is not the server for executing the above-mentioned data backup and recovery method.

[0054] Considering that in the process of cloud computing, there are usually a large number of servers, that is, a large number of mother machines. When it is necessary to obtain the disk identifier of each target cloud disk corresponding to the multiple target cloud disks mounted by the target cloud host from the mother machine corresponding to the target cloud host, it is necessary to first confirm the mother machine where the target cloud host is located. Accordingly, in order to realize the confirmation of the mother machine where the target cloud host is located, in one embodiment of the present application, the server can send a request message for obtaining the disk identifier in the target cloud host to each mother machine, and the request message carries the identification information of the cloud host (such as UUID (Universally Unique Identifier)), so that each mother machine, when receiving the request message for obtaining the disk identifier in the target cloud host, checks whether the UUID of the requested target cloud host is stored in the mother machine. If it is found to be stored, the Libvrit API in the mother machine can be called to obtain the markup language file of the cloud host, and the editing language file can be parsed to obtain the disk identifier, disk type and other information of each target cloud disk mounted in the target cloud host and feed it back to the target cloud host.

[0055] The snapshot data corresponding to each target cloud disk can be obtained by pre-snapshotting the target cloud disk. By performing a snapshot operation on the target cloud host, snapshot data including the system status, data disk information, resource specification information, network card configuration information, etc. of the target cloud host is obtained, and then the snapshot data is saved; and the backup information corresponding to the target cloud host for the snapshot operation (including the cloud platform files and data of the cloud host) is saved in a group of cloud hard disks (Original) of the storage node. When creating a backup for the target cloud host, ICOS (InCloud OpenStack, cloud platform) will perform a full copy (Backup) of the backup information on the storage node to generate a new cloud hard disk. The snapshot data can be obtained from the new cloud hard disk later, and the target cloud host can be restored to the backup time of the snapshot operation to restore it to the state of the original cloud host at the backup time (snapshot operation).

[0056] Step S120: creating a backup cloud host corresponding to the target cloud host, wherein the number of backup cloud disks mounted in the backup cloud host is the same as the number of target cloud disks mounted in the target cloud host.

[0057] The backup cloud host and the target cloud host are of the same type. After the backup cloud host is created, the target cloud host can be replaced by the backup cloud host. Therefore, the configuration information such as the IP address, key pair, and disk configuration corresponding to the backup cloud host and the target cloud host can also be the same.

[0058] The method of creating a backup cloud host corresponding to the target cloud host may specifically include automatically creating a backup cloud host corresponding to the target cloud host, or creating a backup cloud host based on a user operation.

[0059] The method of automatically creating a backup cloud host corresponding to the target cloud host may be to obtain configuration information of the target cloud host and create a backup cloud host according to the configuration information of the target cloud host, so that the configuration information of the created backup cloud host is the same as the configuration information of the target cloud host.

[0060] Among them, the method of creating a backup cloud host based on the user's operation can be to obtain a cloud host creation instruction including the configuration information of the target cloud host sent by the user through the user terminal, and in response to the host creation instruction, create a backup cloud host corresponding to the target cloud host according to the configuration information included in the cloud host creation instruction.

[0061] Exemplarily, take the example of a user using Open Stake to create a backup cloud host corresponding to the target cloud host, where OpenStack is an open source cloud computing management platform project and a combination of a series of software open source projects. The specific creation process is as follows: When the user logs in to the OpenStack console through the user terminal, enter the "Cloud Host" page. Click the "Create Cloud Host" button to enter the cloud host creation wizard. Based on the configuration information of the target cloud host, select the project and data center (or region) where the backup cloud host to be created is located, and select the image (i.e., operating system) and specifications (i.e., CPU and memory size) of the backup cloud host, and select the network where the backup cloud host is located according to the configuration information corresponding to the target cloud host, and assign a name and password to the backup cloud host. After that, if necessary, a public IP address or a key pair can be configured for the backup cloud host. After that, click the "Create Cloud Host" button to start creating the backup cloud host. During the creation process, Open Stack will automatically allocate resources and install the selected operating system based on the aforementioned configuration information.

[0062] Step S130: rolling back the snapshot data corresponding to each target cloud disk to a backup cloud disk, and determining a backup cloud disk corresponding to each target cloud disk.

[0063] Among them, the above steps can be: for each target cloud disk, a backup cloud disk is selected, the snapshot data corresponding to the target cloud disk is rolled back to a corresponding selected backup cloud disk, and the backup cloud disk storing the data corresponding to the target cloud disk after the rollback is determined as the backup cloud disk corresponding to the target cloud disk.

[0064] The above steps may also be: establishing a correspondence between the cloud disk identifier of the target cloud disk and the backup cloud disk identifier according to the cloud disk identifier corresponding to each target cloud disk and the backup cloud disk identifier corresponding to each backup cloud disk, so as to determine the backup cloud disk corresponding to each target cloud disk based on the correspondence; and rolling back the snapshot data corresponding to each target cloud disk to the backup cloud disk corresponding to the target cloud disk.

[0065] In this implementation manner, the above-mentioned step S130 can specifically be: sorting multiple target cloud disks according to the cloud disk identifier corresponding to each target cloud disk to obtain a first sorting, and sorting multiple backup cloud disks according to the backup cloud disk identifier corresponding to each backup cloud disk to obtain a second sorting; rolling back the corresponding snapshot data in each target cloud disk to a backup cloud disk with the same sorting sequence number as the target cloud disk, that is, the sequence number of the target cloud disk in the first sorting is the same as the sequence number of the backup cloud disk corresponding to the target cloud disk in the second sorting, thereby realizing that the backup cloud disk that backs up the data corresponding to the target cloud disk is determined as the backup cloud disk corresponding to the target cloud disk.

[0066] The cloud disk identifier corresponding to the target cloud disk is used to uniquely identify the corresponding target cloud disk; the backup cloud disk identifier corresponding to the backup cloud disk is used to uniquely identify the corresponding backup cloud disk. The cloud disk identifier (or backup cloud disk identifier) ​​mentioned above can be identification information used to uniquely identify each cloud disk, and the identification information can be composed of one or more of characters, numbers, or characters, as long as it can uniquely identify the disk.

[0067] For example, there are four target cloud disks mounted on the target cloud host, and there are also four backup cloud disks mounted on the corresponding backup cloud host. The cloud disk identifiers corresponding to the four target cloud disks are: the cloud disk identifier of the first target cloud disk is disk-1, the cloud disk identifier corresponding to the second target cloud disk is disk-2, the cloud disk identifier corresponding to the third target cloud disk is disk-3, and the cloud disk identifier corresponding to the fourth target cloud disk is disk-4; the cloud disk identifiers corresponding to the four backup cloud disks are: the cloud disk identifier of the first backup cloud disk is disk-11, the cloud disk identifier of the second backup cloud disk is disk-21, and the cloud disk identifier of the third target cloud disk is disk-32. Taking the cloud disk identifier of the first backup cloud disk as disk-22, the cloud disk identifier corresponding to the third backup cloud disk as disk-33, and the cloud disk identifier corresponding to the fourth backup cloud disk as disk-44 as an example, when using the above step S130 to roll back data, the target cloud disks are sorted according to the order of the numbers in the cloud disk identifiers of each target cloud disk to obtain a first sort, and the multiple backup cloud disks are sorted according to the order of the numbers in the cloud disk identifiers of each backup cloud disk to obtain a second sort; the corresponding snapshot data in each target cloud disk is rolled back to the backup cloud disk with the same sorting sequence number as the target cloud disk. In order to roll back the data corresponding to the first target cloud disk (disk-1) to the first backup cloud disk (disk-11), roll back the data corresponding to the second target cloud disk (disk-2) to the second backup cloud disk (disk-22), roll back the data corresponding to the third target cloud disk (disk-3) to the third backup cloud disk (disk-33), and roll back the data corresponding to the fourth target cloud disk (disk-4) to the fourth backup cloud disk (disk-44), thereby completing the rollback of the data corresponding to each target cloud disk, and determining the backup cloud disk that has backed up the data corresponding to the target cloud disk as the backup cloud disk corresponding to the target cloud disk.

[0068] Step S140: according to the disk identifier corresponding to the target cloud disk, the backup cloud disk corresponding to the target cloud disk is mounted to the disk corresponding to the disk identifier in the backup cloud host.

[0069] The above step S140 may specifically be to determine the disk corresponding to the target cloud disk according to the disk identifier corresponding to the target cloud disk, and mount the backup cloud disk corresponding to the target cloud disk to the disk corresponding to the target cloud disk in the backup cloud host.

[0070] The above-mentioned step S140 may also be, according to the slot number in the disk identifier corresponding to each target cloud disk, sorting the backup cloud disks corresponding to multiple target cloud disks to obtain a third sorting, using the third sorting as the mounting order of the backup cloud disks, and then mounting each backup cloud disk to the disk with the disk identifier corresponding to the backup cloud host according to the mounting order of each backup cloud disk, so that the backup cloud disk can access the disk indicated by the disk identifier corresponding to the corresponding target cloud disk.

[0071] In this implementation, since the cloud hosts created by the same background or the cloud hosts corresponding to the same host (target cloud hosts and backup cloud hosts) have the same disk device numbering method, when the cloud host mounts the cloud disk, the sequence number of the cloud disk when it is mounted determines the disk number (disk ID) of the physical disk that the cloud disk can access when it is mounted on the cloud host, and the corresponding disk device number can be used to characterize the physical disk mounted thereon. Therefore, when the backup cloud host mounts the backup cloud disk, the sequence of mounting the backup cloud disk determines the disk device number corresponding to each backup cloud disk, that is, determines the disk corresponding to each backup cloud disk. The disk device number and disk ID are different ways of identifying disks in cloud technology.

[0072] In addition, since the disk identifier is generated by the background server when the cloud host is first started, it is used to refer to the physical disk mounted on the cloud disk in the cloud host. Accordingly, the disk identifier is unique, and each target cloud disk and the backup cloud disk corresponding to each target cloud disk are also unique. Therefore, by mounting the backup cloud disk corresponding to the target cloud disk to the disk corresponding to the disk identifier in the backup cloud host according to the disk identifier corresponding to the target cloud disk, the identifier mounted on the cloud host before and after the backup is consistent with the corresponding relationship between the disk device number inside the cloud host. Therefore, when the application corresponding to the customer service includes the disk identifier or the disk device number inside the cloud host, the customer service can also be used normally. Thereby improving the accuracy and reliability of data access to the backup cloud host.

[0073] The target cloud host and the backup cloud host each include 5 cloud disks. Since the backup cloud host and the target cloud host are created by the same background and mounted on the same host machine, the disk device numbers of the backup cloud host and the target cloud host are the same. For example, the 5 disk device numbers can be dev / vdb, dev / vdc, dev / vdd, dev / vde, dev / vdf, and the disk device numbers corresponding to the same cloud disk have a corresponding relationship with each disk identifier. The disk identifier of the target cloud host includes an identifier composed of a bus number, a slot number, and a function number (for example, the disk identifier is: bus number-slot number-function number). The five target cloud hosts in the target cloud host have the same disk device numbers. The disk identifiers corresponding to the target cloud disks are 0x00-0x03-0x0, 0x00-0x04-0x0, 0x00-0x05-0x0, 0x00-0x06-0x0, and 0x00-0x07, respectively. The cloud disk identifiers of the target cloud disks in the target cloud host are disk1, disk2, disk3, disk4, and disk5. The disk identifiers corresponding to the obtained target cloud disks are: disk1→0x00-0x03-0x0, disk2→0x00-0x04-0x0, disk3→0x00-0x05-0x0, disk4→0x00-0x06-0x0, and disk5→0x00-0x07-0x0.

[0074] In this application, for the convenience of description, the corresponding target cloud disk is referred to by the cloud disk identifier, the corresponding disk is referred to by the disk identifier, and the corresponding backup cloud disk is referred to by the backup cloud disk identifier. The disk device numbers corresponding to the target cloud disks obtained are: target cloud disk disk1→disk dev / vdb, target cloud disk disk2→disk dev / vdc, target cloud disk disk3→disk dev / vdd, target cloud disk disk4→disk dev / vde, target cloud disk disk5→disk dev / vdf. The cloud disk identifiers of the backup cloud disks in the backup cloud host are disk11, disk22, disk33, disk44, and disk55. After backing up each target cloud disk to a corresponding backup cloud disk according to the cloud disk identifier of each target cloud disk and the backup cloud disk identifier of each backup cloud disk, the backup cloud disks corresponding to each target cloud disk are determined as: target cloud disk disk1→backup cloud disk disk11, target cloud disk disk2→backup cloud disk disk22, target cloud disk disk3→backup cloud disk disk33, target cloud disk disk4→backup cloud disk disk44, and target cloud disk disk5→backup cloud disk disk55.

[0075] Determine the mounting order of the backup cloud disks corresponding to each target cloud disk according to the sorting order of the slot numbers in the disk identifiers corresponding to each target cloud disk, and mount each backup cloud disk to the backup cloud host according to the mounting order of each backup cloud disk, so that the corresponding relationship between each mounted backup cloud disk and each disk device number in the backup cloud host is: backup cloud disk disk11→disk dev / vdb, backup cloud disk disk22→disk dev / vdc, backup cloud disk disk33→disk dev / vdd, backup cloud disk disk44→disk dev / vde, backup cloud disk disk55→disk dev / vdf. After mounting, the corresponding relationship between the cloud disk ID of each backup cloud disk and the disk ID of the disk is disk11→0x00-0x03-0x0, disk22→0x00-0x04-0x0, disk33→0x00-0x05-0x0, disk44→0x00-0x06-0x0, and disk55→0x00-0x07-0x0. Through the above exemplary analysis, it can be seen that by adopting the above data backup and recovery method, after the snapshot data corresponding to each target cloud disk is rolled back to a backup cloud disk, the backup cloud disk corresponding to the target cloud disk is mounted to the disk corresponding to the disk ID in the backup cloud host according to the disk ID corresponding to the target cloud disk, so as to ensure that the restored data is consistent with the original data, and the correspondence between the cloud disk and the disk before the backup is consistent with the correspondence between the backup cloud disk and the disk after the backup, thereby avoiding data confusion in the backup host due to the inconsistency between the correspondence between the cloud disk and the disk and the correspondence between the backup cloud disk and the disk, and thus avoiding the situation where customer service on the backup cloud host is unavailable.

[0076] See also Figure 3 , an embodiment of the present application provides a data backup and recovery method, the method comprising:

[0077] Step S210: Perform a snapshot operation on the data files in each target cloud disk mounted on the target cloud host to generate snapshot data corresponding to each target cloud disk.

[0078] There are many ways to perform snapshot operations on the data files in each target cloud disk mounted by the target cloud host and generate snapshot data corresponding to each target cloud disk. For example, it can be that in response to a data backup request sent by a user through a user terminal, a snapshot operation is performed on the target cloud disk to obtain snapshot data. It can also be that a snapshot operation is performed on the target cloud disk at a preset interval to obtain multiple reference snapshot data, and the target snapshot data is selected from the multiple reference snapshot data based on the snapshot operation time corresponding to each reference snapshot data. Among them, the target snapshot data can be the reference snapshot data whose corresponding snapshot operation time is closest to the current moment, or it can be the reference snapshot data whose snapshot operation time is closest to the specified moment. It can also be that when the target host is detected to meet the snapshot data acquisition condition preset by the target cloud host, a snapshot operation is performed on the target cloud disk to obtain snapshot data, such as when the occupied memory information of the target cloud host is detected to reach a preset threshold, a snapshot operation is performed on the target cloud disk; or when the target cloud host is detected to be running abnormally (such as the software installation time exceeds the preset time or the software is running abnormally), a snapshot operation is performed on the target cloud disk to obtain snapshot data.

[0079] In order to realize the recovery of snapshot data within a specified time or a specified time period based on user needs, in one embodiment of the present application, the above-mentioned step S210 can specifically be: perform a snapshot operation on the data files in each target cloud disk mounted on the target cloud host at a preset time interval to obtain multiple reference snapshot data and the snapshot operation time corresponding to each reference snapshot data; determine the snapshot data of the target cloud disk from the multiple reference snapshot data according to the snapshot operation time of each reference snapshot data corresponding to each target cloud disk and the specified snapshot time; wherein the snapshot data of the target cloud disk refers to the reference snapshot data whose corresponding snapshot operation time is the shortest with the specified snapshot time. For example, if the specified snapshot time is the same as a snapshot operation time, the snapshot data of the determined target cloud disk is the reference snapshot data whose corresponding snapshot operation time is the specified snapshot time.

[0080] The preset duration may be 5 minutes, 10 minutes, 15 minutes, 20 minutes, etc. When the user needs to restore snapshot data at a specified time, the specified time is used as the specified snapshot time, and the reference snapshot data corresponding to the snapshot operation time with the shortest distance from the specified snapshot time (or the snapshot operation time with the shortest distance from the specified snapshot time before the specified snapshot time) corresponding to the snapshot operation time corresponding to the reference snapshot data is determined as the snapshot data corresponding to the target cloud disk.

[0081] When multiple snapshot operations are performed on the target cloud disk to obtain snapshot data corresponding to each snapshot operation time, all data of the target cloud disk at each snapshot operation time can be copied, or all data of the target cloud disk at the first snapshot operation time can be copied. Each subsequent snapshot operation only copies the data that has changed at the current moment of the target cloud disk relative to the previous snapshot operation.

[0082] It should be noted that when performing a snapshot operation on a target cloud disk in a target cloud host, the target cloud host may be in a powered-on state or in a powered-off state. Therefore, before performing a snapshot operation on the target cloud disk, the host machine or the background server may determine whether the target cloud host is in a powered-on state to select a corresponding snapshot method according to the state of the target cloud host to perform the operation and thereby obtain snapshot data of each target cloud disk in the target cloud host. For example, the computing component Nova-compute in the cloud computing management platform architecture OpenStack runs on the control node. If the processing terminal sends an application programming interface API to the cloud computing management platform architecture to create a snapshot request for the target cloud host, and the request does not distinguish whether the created snapshot is a powered-on snapshot or a powered-on snapshot, the computing component Nova-compute in the cloud computing management platform architecture OpenStack may determine whether the snapshot is a powered-on snapshot or a powered-on snapshot by the state of the instance Instance (that is, the target cloud host). If it is a powered-off snapshot, the powered-off snapshot interface is called to perform an offline snapshot (cold-snapshot) of the target cloud disk. If it is a powered-on snapshot, the virtual machine interface is called to perform an online snapshot (live-snapshot) of the target cloud disk.

[0083] Step S220: In response to the data backup and recovery request, obtain the markup language file in the memory of the host computer where the cloud host is located.

[0084] The markup language file is generated by the master machine when it detects that the cloud host is started for the first time, or when it creates the cloud host, or when the cloud host detects that the cloud host is reset, which is not specifically limited in the present embodiment of the application. The number of markup language files stored in the master machine can be multiple, and the master machine stores a markup language file corresponding to each of its corresponding cloud hosts.

[0085] The markup language file includes a disk identifier, which is generated by the host machine when it detects that the cloud host is started for the first time, wherein the markup language file can be specifically generated by the hypervisor in the background program when the cloud host is started for the first time, wherein different background programs may correspond to different hypervisors. Exemplarily, in one embodiment, the above-mentioned disk identifier can be specifically generated by libvirt when the cloud host is started for the first time. Libvirt is an open source API, background program and management tool for managing virtualization platforms. It can be used to manage KVM, Xen, VMware ESX, QEMU and other virtualization technologies; and libvirt is a collection of software that provides a convenient way to manage virtual machines and other virtualization functions, such as storage and network interface management. These software include an API library, a daemon (Libvirtd), and a command line utility (virsh).

[0086] The type of markup language file can be any one of XML language file, HTML language file or SGML language file. Among them, XML (eXtensible Markup Language) is the universal language of data on the Web. It enables developers to pass structured data from many different applications to the desktop for local calculation and presentation. XML allows the creation of a unique data format for a specific application. It is also an ideal format for transmitting structured data between servers. XML is a simple, platform-independent and widely adopted standard. It is a metalanguage used to define other languages. Its predecessor is SGML (Standard Generalized Markup Language). Simply put, XML provides a method to describe structured data. It not only completes the tasks that HML cannot complete, but also provides the Internet world with a tool to define "professional terms" in various industries. HTML Hypertext Marked Language is a simple markup language used to create hypertext documents. The Hypertext Transfer Protocol specifies the rules and operations that browsers follow when running HTML documents. SGML (Standard Generalized Markup Language) is a metalanguage for specifying a document markup language or tag setting method. The standard itself is a Document Type Definition (DTD). SGML is a descendant of IBM's Generalized Markup Language (GML). SGML is based on the idea of ​​having structured documents and other semantic elements that can describe how these elements are displayed. SGML provides a variety of markup syntaxes that can be used in many applications. SGML can create documents that are independent of specific hardware and software, so it is easy to exchange documents with users using different computer systems.

[0087] In one possible implementation of the present application, the above-mentioned markup language file is an XML language file. It should be understood that if the program language used to configure the cloud server in the mother machine is different or the program language used by the background program is different, the way in which the background program obtains the XML language file from the above-mentioned markup language file will be different. Exemplarily, the background program can call the API interface provided by the agent on the mother machine where the target cloud host is located to obtain the XML file of the target cloud host from the mother machine. Among them, the API interface provided by the agent refers to the API interface agent developed by PHP, which supports cross-domain interface proxy and interface merge request functions. And the API interface provided by the agent is not only an interface proxy project, but can also be used as a class library.

[0088] It should be understood that in order to obtain the identifiers of each cloud disk mounted on each target cloud host in the language file, the above process can also be directly executed by the host machine.

[0089] Step S230: Obtain the disk identifier of each target cloud disk mounted on the target cloud host from the markup language file.

[0090] The markup language file stores disk identifications and configuration information of different target cloud disks, identifications and configuration information of cloud hosts, etc. Different information in the markup language may correspond to different identifiers or signs. Specifically, step S230 may be to obtain the disk identifications of each target cloud disk mounted on the target cloud host from the markup language file according to the identifier or sign corresponding to the cloud disk.

[0091] In order to obtain the disk identifiers of each target cloud host in the language file, the above process can also be directly executed by the master machine. That is, the background program can send a disk identifier acquisition instruction to the master machine in response to the data backup and recovery request, so that the master machine can obtain the markup language file corresponding to the target cloud host in response to the above disk identifier acquisition instruction, and after obtaining the markup language file, obtain the disk identifier corresponding to each target cloud disk mounted on each target cloud host from the markup language file according to the preset identifier or tag corresponding to the disk identifier.

[0092] Step S240: creating a backup cloud host corresponding to the target cloud host, wherein the number of backup cloud disks mounted in the backup cloud host is the same as the number of target cloud disks mounted in the target cloud host.

[0093] Step S250: Control the backup cloud host to shut down, and unmount each backup cloud disk in the shutdown backup cloud host.

[0094] When unmounting each backup cloud disk in the backup cloud host, each backup cloud disk may be unmounted in the order of the cloud disk numbers of each backup cloud disk, or may be unmounted randomly in a random order, or may be unmounted synchronously.

[0095] By controlling the shutdown of the backup cloud host and unmounting the backup cloud disks in the backup cloud host after shutdown, it is possible to avoid processes interfering with the unmounting operation of the disk, thereby avoiding the problem that some backup cloud disks cannot be unmounted, and effectively shorten the unmounting time and improve the unmounting efficiency.

[0096] Step S260: Roll back the snapshot data corresponding to each target cloud disk to an unmounted backup cloud disk to obtain a backup cloud disk corresponding to each target cloud disk.

[0097] Step S270: According to the disk identifier corresponding to the target cloud disk, the backup cloud disk corresponding to the target cloud disk is mounted to the disk corresponding to the disk identifier in the backup cloud host.

[0098] For the detailed description of the above steps S260-S270, please refer to the detailed description of steps S130-S140 above, which will not be described one by one in the embodiment of the present application.

[0099] By adopting the above-mentioned data backup and recovery method, after the data in the target cloud disk is snapshotted to obtain the snapshot data of each target cloud disk, if a data backup and recovery request is obtained, the markup language file in the memory of the host computer where the cloud host is located can be obtained in response to the data backup and recovery request, and the disk identifier of each target cloud disk mounted on the target cloud host can be obtained from the markup language file, so as to ensure the accuracy of the obtained disk identifier. Furthermore, by creating a backup cloud host corresponding to the target cloud host, controlling the shutdown of the backup cloud host, and unmounting each backup cloud disk in the shutdown backup cloud host, it is possible to avoid the unmounting speed being too slow, thereby improving the data backup and recovery efficiency. After that, the snapshot data corresponding to each target cloud disk is rolled back to an unmounted backup cloud disk to obtain the backup cloud disk corresponding to each target cloud disk, and according to the disk identifier corresponding to the target cloud disk, the backup cloud disk corresponding to the target cloud disk is mounted to the disk corresponding to the disk identifier in the backup cloud host. It can ensure that the restored data is consistent with the original data, and the correspondence between the cloud disk and the disk is consistent before and after the backup, thus avoiding the situation where the customer service on the cloud host is unavailable due to data confusion in the backup cloud host.

[0100] Please combine Figure 4-Figure 6The present application provides a data backup and recovery method, which can be specifically used to back up and restore five target cloud disks mounted on a target cloud host (the cloud disk identifiers of the five target cloud disks are disk-1, disk-2, disk-3, disk-4, and disk-5, respectively). The specific backup process includes taking a snapshot of the data to obtain the snapshot data. Figure 4 As shown in the figure, the backup and recovery process includes obtaining data, generating a backup cloud host, controlling the shutdown of the backup cloud host, unmounting the backup cloud disk, rolling back the snapshot data to the backup cloud disk, mounting each backup cloud disk, and starting up. The specific backup and recovery process is as follows:

[0101] 1. Backup: The backend can perform snapshot operations on the data in the target cloud disk mounted on the target cloud host during its operation, obtain the snapshot data in each target cloud disk, and save the data in each target cloud disk in a group of cloud hard disks of the storage node.

[0102] 2. Backup and recovery:

[0103] 1. Get data:

[0104] When the backend receives a data backup and recovery request for the target cloud host, it can send a request message to multiple host machines in the platform to obtain the disk ID of each target cloud disk in the target cloud host. The request message carries the identification information (UUID) of the target cloud host. The data obtained here is...

[0105] like Figure 5 As shown, each host receives the request information; after receiving the request information, it checks whether the UUID of the requested target cloud host is on the host. If the host detection result is yes (the UUID of the requested target cloud host is on the host), libvritAPI is called to obtain the XML markup language file corresponding to the target cloud host. The host parses the XML markup language file it obtains and obtains data with an identifier of disk type to obtain the disk identifier of each target cloud disk in the target cloud host.

[0106] Specifically, after receiving the request information, each host machine verifies whether the target cloud host is on the current host machine. The virsh list-all command can be used to query all cloud hosts on the current host machine. If the uuid of the target cloud host of this request is not on the host machine, a corresponding error is returned; if the uuid of the target cloud host of this request is on the host machine, the host machine calls the libvirt API to obtain the xml of the cloud host in the memory, and uses tools such as etree to analyze and filter out devices with type=disk (type is disk), which is the cloud disk mounted on the target cloud host, and obtains the bus / slot / function (bdf for short) number in the address tag.

[0107] By using the above method, you can get the bdf number of each target cloud disk as shown in the following table

[0108] Target cloud disk bus slot Function disk1 0x00 0x03 0x0 disk2 0x00 0x04 0x0 disk3 0x00 0x06 0x0 disk4 0x00 0x07 0x0 disk5 0x00 0x08 0x0

[0109] 2. Production backup cloud host

[0110] When performing backup and recovery, a backup cloud host corresponding to the target cloud host will be created. The number of backup cloud disks in the backup cloud host is the same as the number of target cloud disks in the target cloud host. Since the backup cloud host and the target cloud host are created by the same background, the disk device numbers corresponding to the cloud disks in the backup cloud host and the target cloud host are the same in their respective cloud hosts.

[0111] The created backup cloud disk and target cloud disk correspond to the disk device numbers in their respective cloud hosts as shown in the following table:

[0112] Target cloud disk The disk device number inside the cloud host Backup cloud disk disk1 dev / vdb disk11 disk2 dev / vdc disk22 disk3 dev / vdd disk33 disk4 dev / vde disk44 disk5 dev / vdf disk55

[0113] According to the above table, the disk device numbers corresponding to each target cloud disk are: disk1→dev / vdb, disk2→dev / vdc, disk3→dev / vdd, disk4→dev / vde, disk5→dev / vdf. The cloud disk identifiers of the five backup cloud disks in the backup cloud host are disk11, disk22, disk33, disk44, and disk55, respectively. After the backup cloud host is created.

[0114] 3. Control the shutdown of the backup cloud host:

[0115] 4. Unmount the backup cloud disk:

[0116] Unmount each backup cloud disk in the backup cloud host.

[0117] 5. Roll back snapshot data to the backup cloud disk:

[0118] Sort the target cloud disks according to the cloud disk identifier corresponding to each target cloud disk to obtain the first sorting order of each target cloud disk, and sort the backup cloud disks according to the backup cloud disk identifier corresponding to each backup cloud disk to obtain the second sorting order of each backup cloud disk; roll back the corresponding snapshot data in each target cloud disk to the backup cloud disk with the same sorting number as the target cloud disk, that is, roll back the snapshot data corresponding to disk-1 to disk-11, roll back the snapshot data corresponding to disk-2 to disk-22, roll back the snapshot data corresponding to disk-3 to disk-33, roll back the snapshot data corresponding to disk-4 to disk-44, and roll back the snapshot data corresponding to disk-5 to disk-55.

[0119] 6. Mount each backup cloud disk

[0120] After the snapshot data is rolled back, the mounting order of the backup cloud disks corresponding to each target cloud disk is determined according to the sorting order of the disk identifiers corresponding to each target cloud disk, so that each backup cloud disk is mounted to the backup cloud host according to the corresponding mounting order; that is, the mounting order of the backup cloud disks corresponding to each target cloud disk is determined according to the sorting order of the slot numbers in the target cloud disk from small to large. The following table shows the mounting order of the backup cloud disks of the target cloud disk:

[0121] Mount order Backup cloud disk The slot number of the target cloud disk Target cloud disk 1 disk11 0x03 disk1 2 disk22 0x04 disk2 3 disk33 0x06 disk3 4 disk44 0x07 disk4 5 disk55 0x08 disk5

[0122] After mounting each backup cloud disk in sequence, the relationship between each backup cloud disk and the disk device number inside the host is as follows:

[0123]

[0124]

[0125] After completing the mounting operation of each backup cloud disk, start the backup cloud host and you can use the backup cloud host.

[0126] According to the above-mentioned relationship tables, by adopting the data backup and recovery method of the present application, it can be achieved that the corresponding data stored in the cloud host before and after the backup are the same, and the correspondence between the cloud disk number mounted on the cloud host and the internal disk device number of the cloud host is consistent, avoiding the problem in the related technology that some customer programs (that is, customer service) may be hard-coded. For example, when writing data specifically includes the internal disk number of the cloud host, if the order after backup is incorrect, it may cause the data to be written to other disks, which is not as expected.

[0127] Compared with the backup and recovery process in the related art, after creating a new backup cloud host, the related art randomly mounts the backup cloud disk to the backup cloud host, resulting in the inconsistency between the cloud disk number mounted by the cloud host before and after the backup and the disk device number inside the cloud host. For example, when the backup cloud disk is randomly mounted to the backup host, the correspondence between the cloud disk ID of the backup cloud disk and the disk device ID inside the cloud disk host may become disk33 corresponds to / dev / vdb (the correct situation is disk11 corresponds to / dev / vdb), dis22 corresponds to / dev / vdc, disk55 corresponds to / dev / vdd (the correct situation is disk44 corresponds to / dev / vdb), disk11 corresponds to / dev / vde (the correct situation is disk55 corresponds to / dev / vdb), and disk44 corresponds to / dev / vdf (the correct situation is disk33 corresponds to / dev / vdb). Due to the inconsistent correspondence, it is possible that the customer service using the cloud host is unavailable, and even the disk that the backup cloud host needs to access is inconsistent with the disk actually accessed. The data backup and recovery method of the present application can ensure that the restored data is consistent with the original data, and the correspondence between the cloud disk and the disk is consistent before and after the backup, and the disk device identifier inside the cloud host corresponding to the cloud disk is also consistent before and after the backup. Even when a specific disk identifier or a disk device identifier inside the target cloud host is carried in the customer service, the customer service can be used. Therefore, by adopting the data backup and recovery method of the present application, the reliability of the data after backup and recovery can also be effectively improved.

[0128] Figure 7 A data backup and recovery device 300 is shown according to an embodiment. Figure 7 As shown, the data backup and recovery device 300 includes: a data acquisition module 310, a host creation module 320, a data rollback module 330 and a cloud disk mounting module 340. The data acquisition module 310 is used to respond to a data backup and recovery request, and obtain the disk identifier of each target cloud disk in the target cloud host and the snapshot data of each target cloud disk corresponding to the multiple target cloud disks mounted on the target cloud host; the host creation module 320 is used to create a backup cloud host corresponding to the target cloud host, and the number of backup cloud disks mounted in the backup cloud host is the same as the number of target cloud disks mounted on the target cloud host; the data rollback module 330 is used to roll back the snapshot data corresponding to each target cloud disk to a backup cloud disk, and determine the backup cloud disk corresponding to each target cloud disk; the cloud disk mounting module 340 is used to mount the backup cloud disk corresponding to the target cloud disk to the disk corresponding to the disk identifier in the backup cloud host according to the disk identifier corresponding to the target cloud disk.

[0129] In one possible implementation, the data acquisition module 310 is also used to obtain the disk identifier of each target cloud disk mounted on the target cloud host from the host machine where the target cloud host is located. The disk identifier of each target cloud disk is generated by the background program when the target cloud host is started for the first time.

[0130] In one possible implementation, the data backup and recovery request carries a host identifier of the target host, and the device further comprises an identifier acquisition module and a master machine confirmation module. The identifier acquisition module is used to obtain the host identifier of the cloud host corresponding to each of the multiple master machines and the host identifier of the target cloud host carried in the data backup and recovery request; the master machine confirmation module is used to confirm the master machine where the target cloud host is located according to the host identifier of the cloud host corresponding to each master machine and the host identifier of the target cloud host.

[0131] In one possible implementation, the data acquisition module 310 includes a file acquisition submodule and an identifier acquisition submodule. The file acquisition submodule is used to acquire the markup language file in the memory of the mother machine where the cloud host is located; the identifier acquisition submodule is used to acquire the disk identifier of each target cloud disk mounted on the target cloud host from the markup language file.

[0132] In one possible implementation, the data rollback module 330 includes a de-hanging processing submodule and a data rollback submodule. The de-hanging processing submodule is used to control the shutdown of the backup cloud host and de-hang each backup cloud disk in the shutdown backup cloud host; the data rollback submodule is used to roll back the snapshot data corresponding to each target cloud disk to an un-hanging backup cloud disk to obtain a backup cloud disk corresponding to each target cloud disk.

[0133] In one feasible implementation, each target cloud disk corresponds to a cloud disk identifier, and each backup cloud disk corresponds to a backup cloud disk identifier. The data rollback submodule is also used to determine the backup cloud disk corresponding to each target cloud disk based on the cloud disk number corresponding to each target cloud disk and the cloud disk number corresponding to each mounted backup cloud disk; and roll back the snapshot data corresponding to each target cloud disk to the backup cloud disk corresponding to the target cloud disk.

[0134] In one possible implementation, the data rollback submodule is also used to determine the mounting order of the backup cloud disks corresponding to each target cloud disk according to the disk identifier corresponding to each target cloud disk, and mount each backup cloud disk to the disk corresponding to the disk identifier in the backup cloud host according to the corresponding mounting order.

[0135] In one possible implementation, the cloud disk mounting module 340 is also used to determine the mounting order of the backup cloud disks corresponding to each target cloud disk according to the disk identifier corresponding to each target cloud disk, and mount each backup cloud disk to the disk corresponding to the disk identifier in the backup cloud host according to the corresponding mounting order.

[0136] In one possible implementation, the device further includes a snapshot module, which is used to perform a snapshot operation on the data files in each target cloud disk mounted on the target cloud host to generate snapshot data corresponding to each target cloud disk.

[0137] In one feasible implementation, the snapshot module is also used to perform snapshot operations on the data files in each target cloud disk mounted on the target cloud host at intervals of a preset duration, to obtain multiple reference snapshot data and the snapshot operation time corresponding to each reference snapshot data; based on the snapshot operation time of each reference snapshot data corresponding to each target cloud disk and the specified snapshot time, the snapshot data of the target cloud disk is determined from the multiple reference snapshot data.

[0138] It should be noted that the device embodiment in the present application corresponds to the aforementioned method embodiment. The specific principles in the device embodiment can be found in the contents of the aforementioned method embodiment and will not be repeated here.

[0139] The following will be combined Figure 8 An electronic device provided by the present application is described.

[0140] See also Figure 8 Based on the data backup and recovery method provided in the above embodiment, the embodiment of the present application also provides another electronic device 100 including a processor 102 that can execute the above method, and the electronic device 100 can be a server.

[0141] The electronic device 100 further includes a memory 104 . The memory 104 stores a program that can execute the contents of the aforementioned embodiments, and the processor 102 can execute the program stored in the memory 104 .

[0142] Among them, the processor 102 may include one or more cores for processing data and a message matrix unit. The processor 102 uses various interfaces and lines to connect various parts of the entire electronic device 100, and executes various functions and processes data of the electronic device 100 by running or executing instructions, programs, code sets or instruction sets stored in the memory 104, and calling data stored in the memory 104. Optionally, the processor 102 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 102 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 102, but may be implemented separately through a communication chip.

[0143] The memory 104 may include a random access memory (RAM) or a read-only memory (ROM). The memory 104 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 104 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function, instructions for implementing the following various method embodiments, etc. The data storage area may also store data (e.g., disk identification, host identification) acquired by the electronic device 100 during use, etc.

[0144] In some embodiments, the electronic device 100 may further include: a peripheral interface 106 and at least one peripheral device. The processor 102, the memory 104 and the peripheral interface 106 may be connected via a bus or a signal line. Each peripheral device may be connected to the peripheral interface via a bus, a signal line or a circuit board. Exemplarily, in this embodiment, the peripheral device may include a network module 108, which is used to receive and send electromagnetic waves, realize the mutual conversion of electromagnetic waves and electrical signals, and thus communicate with a communication network or other devices, such as communicating with an audio playback device. The network module 108 may include various existing circuit elements for performing these functions, such as an antenna, a radio frequency transceiver, a digital signal processor, an encryption / decryption chip, a user identity module (SIM) card, a memory, etc. The network module 108 may communicate with various networks such as the Internet, an intranet, a wireless network, or communicate with other devices via a wireless network. The above-mentioned wireless network may include a cellular telephone network, a wireless local area network or a metropolitan area network.

[0145] The embodiment of the present application also provides a structural block diagram of a computer-readable storage medium. The computer-readable medium stores program codes, which can be called by a processor to execute the method described in the above method embodiment.

[0146] The computer-readable storage medium may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM, a hard disk, or a ROM. Optionally, the computer-readable storage medium includes a non-transitory computer-readable storage medium. The computer-readable storage medium has storage space for program codes that execute any of the method steps in the above method. These program codes can be read from or written to one or more computer program products. The program code can be compressed, for example, in an appropriate form.

[0147] The embodiment of the present application also provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device performs the method described in the above various optional implementations.

[0148] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A data backup and recovery method, characterized in that: The method comprises: In response to a data backup and recovery request, obtaining a disk identifier of each target cloud disk in the target cloud host corresponding to a plurality of target cloud disks mounted on the target cloud host and snapshot data of each target cloud disk; Creating a backup cloud host corresponding to the target cloud host, wherein the number of backup cloud disks mounted in the backup cloud host is the same as the number of target cloud disks mounted in the target cloud host; Rolling back the snapshot data corresponding to each target cloud disk to a backup cloud disk, and determining a backup cloud disk corresponding to each of the target cloud disks; According to the disk identifier corresponding to the target cloud disk, the backup cloud disk corresponding to the target cloud disk is mounted to the disk corresponding to the disk identifier in the backup cloud host.

2. The method according to claim 1, characterized in that The obtaining of a disk identifier in the target cloud host corresponding to each of the multiple target cloud disks mounted on the target cloud host includes: The disk identifier of each target cloud disk mounted on the target cloud host is obtained from the host machine where the cloud host is located. The disk identifier of each target cloud disk is generated by a background program when the target cloud host is started for the first time.

3. The method according to claim 2, characterized in that The data backup and recovery request carries a host identifier of the target host. Before obtaining the disk identifier of each target cloud disk in the target cloud host and the snapshot data of each target cloud disk, the method further includes: Obtaining a host identifier of a cloud host corresponding to each of the multiple host machines and a host identifier of a target cloud host carried in the data backup and recovery request; The host machine where the target cloud host is located is confirmed according to the host identifier of the cloud host corresponding to each of the host machines and the host identifier of the target cloud host.

4. The method according to claim 2, characterized in that: The obtaining, from the host computer where the cloud host is located, the disk identifier of each target cloud disk mounted on the target cloud host includes: Get the markup language file in the memory of the host computer where the cloud host is located; The disk identifier of each target cloud disk mounted on the target cloud host is obtained from the markup language file.

5. The method according to claim 1, characterized in that The step of rolling back the snapshot data corresponding to each target cloud disk to a backup cloud disk and determining the backup cloud disk corresponding to each target cloud disk includes: Control the backup cloud host to shut down, and unhook each backup cloud disk in the shutdown backup cloud host; The snapshot data corresponding to each target cloud disk is rolled back to an unmounted backup cloud disk to obtain a backup cloud disk corresponding to each target cloud disk.

6. The method according to claim 5, characterized in that Each target cloud disk corresponds to a cloud disk identifier, and each backup cloud disk corresponds to a backup cloud disk identifier. The snapshot data corresponding to each target cloud disk is rolled back to an unmounted backup cloud disk to obtain a backup cloud disk corresponding to each target cloud disk, including: Determine a backup cloud disk corresponding to each of the target cloud disks according to the cloud disk numbers corresponding to the target cloud disks and the cloud disk numbers corresponding to the backup cloud disks; Roll back the snapshot data corresponding to each of the target cloud disks to the backup cloud disk corresponding to the target cloud disk.

7. The method according to claim 1, characterized in that The step of mounting the backup cloud disk corresponding to the target cloud disk to the disk corresponding to the disk identifier in the backup cloud host according to the disk identifier corresponding to the target cloud disk includes: The mounting order of the backup cloud disks corresponding to each target cloud disk is determined according to the disk identifier corresponding to each target cloud disk, and each backup cloud disk is mounted to the disk corresponding to the disk identifier in the backup cloud host according to the corresponding mounting order.

8. The method according to claim 1, characterized in that Before obtaining the disk identifier of each target cloud disk in the target cloud host and the snapshot data of each target cloud disk, the method further includes: Perform snapshot operations on the data files in each target cloud disk mounted on the target cloud host to generate snapshot data corresponding to each target cloud disk.

9. The method according to claim 8, characterized in that The step of performing a snapshot operation on the data files in each target cloud disk mounted on the target cloud host to generate snapshot data corresponding to each target cloud disk includes: Performing snapshot operations on the data files in each target cloud disk mounted on the target cloud host at preset intervals to obtain multiple reference snapshot data and the snapshot operation time corresponding to each reference snapshot data; According to the snapshot operation time and the designated snapshot time of each reference snapshot data corresponding to each target cloud disk, the snapshot data of the target cloud disk is determined from the multiple reference snapshot data.

10. A data backup and recovery device, characterized in that: The device comprises: A data acquisition module, configured to respond to a data backup and recovery request and obtain a disk identifier of each target cloud disk in the target cloud host corresponding to each target cloud disk mounted on the target cloud host and snapshot data of each target cloud disk; A host creation module, used to create a backup cloud host corresponding to the target cloud host, wherein the number of backup cloud disks mounted in the backup cloud host is the same as the number of target cloud disks mounted in the target cloud host; A data rollback module, used to roll back the snapshot data corresponding to each target cloud disk to a backup cloud disk, and determine the backup cloud disk corresponding to each of the target cloud disks; The cloud disk mounting module is used to mount the backup cloud disk corresponding to the target cloud disk to the disk corresponding to the disk identifier in the backup cloud host according to the disk identifier corresponding to the target cloud disk.

11. An electronic device, characterized in that: include: one or more processors; Memory; One or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the method according to any one of claims 1 to 9.

12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program codes, and the program codes can be called by a processor to execute the method according to any one of claims 1 to 9.

13. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method described in any one of claims 1 to 9 are implemented.