Method and related device for backup and recovery of service cluster instance

By setting persistent volume declarations and objects for each container group in the Kubernetes cluster, overall data backup of the business cluster instance is achieved, solving the problem of low backup efficiency in existing technologies and enabling fast backup and recovery.

CN117909020BActive Publication Date: 2026-11-20TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211247839.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-12
Publication Date
2026-11-20
Estimated Expiration
2042-10-12

AI Technical Summary

Technical Problem

In existing technologies, data backup of Kubernetes clusters is performed only on a single container group basis, which cannot achieve overall backup of database business cluster instances, resulting in low backup efficiency and the inability to achieve fast backup.

Method used

By setting source persistent volume declarations and source persistent volume objects for each container group, and creating backup persistent volume declarations and backup persistent volume objects, the overall data backup of the business cluster instance is achieved. This includes determining the business cluster instance to be backed up, obtaining and storing the data to be backed up for the container group, and performing backup when the backup trigger conditions are met.

Benefits of technology

It improves the backup efficiency of business cluster instances, enables rapid backup and recovery of business cluster instances, and meets the requirements for data storage continuity and recoverability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117909020B_ABST
    Figure CN117909020B_ABST
Patent Text Reader

Abstract

This application discloses a method and related equipment for backing up and restoring a business cluster instance. The relevant embodiments can be applied to various scenarios such as cloud technology, artificial intelligence, intelligent transportation, and assisted driving. Specifically, for database data backup, for each container group in the business cluster instance to be backed up, a source persistent volume declaration and a source persistent volume object are set for each container group. The container group is then stored based on the source persistent volume object. When the business cluster instance meets the backup trigger condition, for each container group, a backup persistent volume declaration and a backup persistent volume object are created according to the source persistent volume declaration and the source persistent volume object. The data to be backed up for the container group is obtained based on the source persistent volume object. According to the backup persistent volume declaration of the container group, the data to be backed up is backed up to the storage area pointed to by the backup persistent volume object, thereby realizing data backup for each container group in the business cluster instance. This application improves the backup efficiency of business cluster instances.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, specifically to a method for backing up and restoring a business cluster instance and related equipment. Background Technology

[0002] Kubernetes is an open-source container orchestration engine that supports automated deployment, massive scalability, and containerized application management. A Kubernetes cluster can include at least one container group, within which application instances can run. To ensure the continuity, recoverability, and high availability of data storage, Kubernetes cluster data needs to implement disaster recovery backups to a certain extent.

[0003] In current technologies, data backup for database clusters is typically performed on a per-container basis, which does not enable backup of the entire business cluster instance in the database. While this achieves the backup function, the backup efficiency is low and fast backup of the business cluster instance is not possible. Summary of the Invention

[0004] This application provides a method and related equipment for backing up and restoring a business cluster instance. The related equipment may include a backup and recovery device for the business cluster instance, electronic equipment, computer-readable storage media, and computer program products. This method can perform backup processing on the entire business cluster instance, improving backup efficiency and facilitating rapid backup of the business cluster instance. Specifically, the business cluster instance is a stateful service business cluster.

[0005] This application provides a method for backing up a service cluster instance, including:

[0006] Identify the business cluster instance to be backed up, wherein the business cluster instance includes at least one container group;

[0007] For each container group, a source persistent volume declaration and a source persistent volume object are set for the container group, and the container group is stored based on the source persistent volume object. The source persistent volume declaration is used to declare the storage attribute information required by the container group, and the source persistent volume object points to the data storage area of ​​the container group.

[0008] When the business cluster instance meets the backup triggering condition, for each container group, a backup persistent volume declaration and a backup persistent volume object corresponding to the container group are created according to the source persistent volume declaration and the source persistent volume object corresponding to the container group.

[0009] Based on the source persistent volume object, obtain the data to be backed up for the container group;

[0010] For each container group, based on the backup persistent volume declaration corresponding to the container group, the data to be backed up for the container group is backed up to the storage area pointed to by the backup persistent volume object, so as to realize the data backup of each container group in the business cluster instance.

[0011] This application provides a method for restoring a service cluster instance, including:

[0012] When an instance recovery request for a business cluster instance is received, the backup data of each container group in the business cluster instance is obtained.

[0013] For each container group, based on the backup data of the container group, a target backup persistent volume declaration and a target backup persistent volume object are created for the container group. The target backup persistent volume declaration is used to declare the storage attribute information required by the container group, and the target backup persistent volume object points to the storage area of ​​the backup data of the container group.

[0014] Based on the target backup persistent volume declaration and the target backup persistent volume object, create the target persistent volume declaration and target persistent volume object corresponding to the container group;

[0015] Based on the target persistent volume declaration and target persistent volume object corresponding to the container group, run the container group to resume operation of each container group in the business cluster instance.

[0016] Accordingly, embodiments of this application provide a backup device for a service cluster instance, comprising:

[0017] A determining unit is used to determine the business cluster instance to be backed up, wherein the business cluster instance includes at least one container group;

[0018] A storage unit is used to set a source persistent volume declaration and a source persistent volume object for each container group, and to store the container group based on the source persistent volume object. The source persistent volume declaration is used to declare the storage attribute information required by the container group, and the source persistent volume object points to the data storage area of ​​the container group.

[0019] The first creation unit is used to create a backup persistent volume declaration and a backup persistent volume object corresponding to the container group for each container group when the business cluster instance meets the backup triggering conditions.

[0020] The first acquisition unit is used to acquire the data to be backed up of the container group based on the source persistent volume object;

[0021] The backup unit is used to back up the data to be backed up for each container group to the storage area pointed to by the backup persistent volume object, based on the backup persistent volume declaration corresponding to the container group, so as to realize the data backup of each container group in the business cluster instance.

[0022] Accordingly, this application embodiment provides a recovery device for a service cluster instance, including:

[0023] The second acquisition unit is used to acquire backup data of each container group in the business cluster instance when it receives an instance recovery request for the business cluster instance.

[0024] The second creation unit is used to create a target backup persistent volume declaration and a target backup persistent volume object for each container group based on the backup data of the container group. The target backup persistent volume declaration is used to declare the storage attribute information required by the container group, and the target backup persistent volume object points to the storage area of ​​the backup data of the container group.

[0025] The third creation unit is used to create the target persistent volume declaration and target persistent volume object corresponding to the container group based on the target backup persistent volume declaration and the target backup persistent volume object;

[0026] The running unit is used to run the container group according to the target persistent volume declaration and target persistent volume object corresponding to the container group, so as to restore the operation of each container group in the business cluster instance.

[0027] Optionally, in some embodiments of this application, the backup unit may include a first binding subunit and a backup subunit, as follows:

[0028] The first binding subunit is used to establish a binding relationship between the backup persistent volume declaration and the backup persistent volume object of each container group;

[0029] The backup subunit is used to back up the data to be backed up in the container group to the storage area pointed to by the backup persistent volume object, based on the backup persistent volume declaration corresponding to the container group and the binding relationship.

[0030] Optionally, in some embodiments of this application, the first binding subunit may be specifically used to obtain the object attribute identifier of the backup persistent volume object of the container group for each container group; and write the object attribute identifier into the configuration information of the backup persistent volume declaration of the container group, so as to establish a binding relationship between the backup persistent volume declaration and the backup persistent volume object of the container group.

[0031] Optionally, in some embodiments of this application, the storage unit may include a setting subunit, a set acquisition subunit, an establishment subunit, and a storage subunit, as follows:

[0032] The setting subunit is used to set the source persistent volume declaration corresponding to each container group, wherein the source persistent volume declaration includes the storage capacity and file system type required by the container group;

[0033] The collection retrieves a sub-unit, used to retrieve a collection of persistent volume objects that are currently in an available state;

[0034] A subunit is established to select a source persistent volume object that matches the storage capacity and the file system type from the persistent volume object set, and to establish a binding relationship between the selected source persistent volume object and the source persistent volume declaration;

[0035] The storage subunit is used to store the data of the container group to the data storage area pointed to by the source persistent volume object according to the source persistent volume declaration and the binding relationship.

[0036] Optionally, in some embodiments of this application, the service cluster instance includes at least one service component, and the service component includes at least one container group;

[0037] The first acquisition unit may include a first determining subunit, a second determining subunit, a third determining subunit, and a data acquisition subunit, as follows:

[0038] The first determining subunit is used to determine the instance data storage area of ​​the business cluster instance to which the container group belongs based on the instance address information in the source persistent volume object of the container group;

[0039] The second determining subunit is used to determine the component data storage area of ​​the business component to which the container group belongs from the instance data storage area based on the component address information in the source persistent volume object of the container group;

[0040] The third determining subunit is used to determine the data storage area of ​​the container group from the component data storage area based on the container group address information in the source persistent volume object of the container group;

[0041] The data acquisition subunit is used to acquire the data to be backed up from the data storage area of ​​the container group.

[0042] Optionally, in some embodiments of this application, the backup device for the service cluster instance may further include a resource-dependent backup unit, as follows:

[0043] The dependent resource backup unit is used to analyze the resource reference associations of the business cluster instance, determine the dependent resources of the business cluster instance, and perform backup processing on the dependent resources.

[0044] Optionally, in some embodiments of this application, the first creation unit may be specifically used to create a backup persistent volume declaration and a backup persistent volume object corresponding to each container group when it is detected that the business cluster instance has been deleted and is in a backup startup state.

[0045] Optionally, in some embodiments of this application, the first creation unit may be specifically used to create a backup persistent volume declaration and a backup persistent volume object corresponding to the container group for each container group when the current time meets the backup trigger time condition of the business cluster instance, based on the source persistent volume declaration and the source persistent volume object corresponding to the container group.

[0046] Optionally, in some embodiments of this application, the running unit may include a second binding subunit and a running subunit, as follows:

[0047] The second binding subunit is used to bind the target persistent volume declaration and the target persistent volume object corresponding to the container group;

[0048] The running subunit is used to run the container group when the target persistent volume declaration and the target persistent volume object are bound to each other, so as to resume the operation of each container group in the business cluster instance.

[0049] Optionally, in some embodiments of this application, the second binding subunit may be specifically used to obtain the object attribute identifier of the target persistent volume object of the container group; and write the object attribute identifier into the configuration information of the target persistent volume declaration corresponding to the container group, so as to establish a binding relationship between the target persistent volume declaration and the target persistent volume object.

[0050] Optionally, in some embodiments of this application, the backup data of the container group is located in a first storage area, and the instance recovery request indicates that the business cluster instance be recovered in a second storage area;

[0051] The second creation unit may include a creation subunit and an update subunit, as follows:

[0052] The creation subunit is used to create, for each container group, an initial backup persistent volume object and a target backup persistent volume declaration in the second storage area, based on the backup data of the container group.

[0053] The update subunit is used to update the binding declaration information in the initial backup persistent volume object based on the target backup persistent volume declaration, so as to obtain the target backup persistent volume object.

[0054] Optionally, in some embodiments of this application, the running unit may include a resource acquisition subunit and an instance running subunit, as follows:

[0055] The dependent resource acquisition subunit is used to acquire backup data corresponding to the dependent resources of the business cluster instance;

[0056] The instance running subunit is used to run the container group based on the backup data corresponding to the dependent resources, the target persistent volume declaration and the target persistent volume object corresponding to the container group, so as to restore the operation of each container group in the business cluster instance.

[0057] An electronic device provided in this application includes a processor and a memory. The memory stores multiple instructions, and the processor loads the instructions to execute the steps in the backup and recovery method for a service cluster instance provided in this application.

[0058] This application also provides a computer-readable storage medium storing a computer program thereon, wherein the computer program, when executed by a processor, implements the steps in the backup and recovery method for a business cluster instance provided in this application.

[0059] Furthermore, this application also provides a computer program product, including a computer program or instructions, which, when executed by a processor, implement the steps in the backup and recovery method for a business cluster instance provided in this application.

[0060] This application provides a method and related equipment for backing up and restoring a business cluster instance. It can determine the business cluster instance to be backed up, the business cluster instance including at least one container group. For each container group, a source persistent volume declaration and a source persistent volume object are set, and the container group is stored based on the source persistent volume object. The source persistent volume declaration declares the storage attribute information required by the container group, and the source persistent volume object points to the data storage area of ​​the container group. When the business cluster instance meets the backup triggering condition, for each container group, a backup persistent volume declaration and a backup persistent volume object are created according to the source persistent volume declaration and source persistent volume object. Based on the source persistent volume object, the data to be backed up for the container group is obtained. For each container group, according to the backup persistent volume declaration, the data to be backed up for the container group is backed up to the storage area pointed to by the backup persistent volume object, thereby achieving data backup for each container group in the business cluster instance. This application can perform backup processing on the entire business cluster instance, improving the backup efficiency of the business cluster instance and facilitating rapid backup of the business cluster instance. Attached Figure Description

[0061] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0062] Figure 1a This is a schematic diagram illustrating a scenario of the backup and recovery method for a business cluster instance provided in an embodiment of this application;

[0063] Figure 1b This is a flowchart illustrating the backup and recovery method for a service cluster instance provided in this application embodiment;

[0064] Figure 1c This is an illustrative diagram illustrating the backup and recovery method for a business cluster instance provided in the embodiments of this application;

[0065] Figure 1d This is another illustrative diagram of the backup and recovery method for a business cluster instance provided in the embodiments of this application;

[0066] Figure 1e This is another illustrative diagram of the backup and recovery method for a business cluster instance provided in the embodiments of this application;

[0067] Figure 1f This is another illustrative diagram of the backup and recovery method for a business cluster instance provided in the embodiments of this application;

[0068] Figure 2a This is another flowchart of the backup and recovery method for a business cluster instance provided in the embodiments of this application;

[0069] Figure 2b This is another illustrative diagram of the backup and recovery method for a business cluster instance provided in the embodiments of this application;

[0070] Figure 2c This is another illustrative diagram of the backup and recovery method for a business cluster instance provided in the embodiments of this application;

[0071] Figure 2d This is another illustrative diagram of the backup and recovery method for a business cluster instance provided in the embodiments of this application;

[0072] Figure 3a This is a schematic diagram of the structure of the backup device for the service cluster instance provided in the embodiments of this application;

[0073] Figure 3b This is a schematic diagram of the structure of the recovery device for a service cluster instance provided in the embodiments of this application;

[0074] Figure 4 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0075] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0076] This application provides a method for backing up and restoring a business cluster instance, as well as related equipment. The related equipment may include a backup and restore device for the business cluster instance, an electronic device, a computer-readable storage medium, and a computer program product.

[0077] Specifically, embodiments of this application provide a backup device for a service cluster instance applicable to a first electronic device, which may be a server or other device; embodiments of this application also provide a recovery device for a service cluster instance applicable to a second electronic device, which may be a server or other device.

[0078] like Figure 1aAs shown, an example is a method for backing up and restoring a business cluster instance using both a terminal and a server. The business cluster instance backup and recovery system provided in this application includes a terminal 10 and a server 11, etc.; the terminal 10 and the server 11 are connected via a network, such as a wired or wireless network, etc., wherein the backup and recovery device for the business cluster instance can be integrated into the server.

[0079] In one embodiment, server 11 can be configured to: determine a business cluster instance to be backed up, the business cluster instance including at least one container group; for each container group, set a source persistent volume declaration and a source persistent volume object corresponding to the container group, and store the container group based on the source persistent volume object, wherein the source persistent volume declaration is used to declare the storage attribute information required by the container group, and the source persistent volume object points to the data storage area of ​​the container group; when the business cluster instance meets the backup triggering condition, for each container group, create a backup persistent volume declaration and a backup persistent volume object corresponding to the container group according to the source persistent volume declaration and the source persistent volume object corresponding to the container group; obtain the data to be backed up for the container group based on the source persistent volume object; for each container group, back up the data to be backed up for the container group to the storage area pointed to by the backup persistent volume object according to the backup persistent volume declaration corresponding to the container group, so as to realize the data backup of each container group in the business cluster instance. The server 11 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. The backup and recovery method or apparatus for the business cluster instance disclosed in this application allows multiple servers to form a blockchain, with each server acting as a node on the blockchain.

[0080] Terminal 10 can be used to send data backup instructions for a business cluster instance to server 11, so that server 11 can perform data backup for each container group in the business cluster instance based on the data backup instructions. Terminal 10 may include a mobile phone, smart voice interaction device, smart home appliance, vehicle terminal, aircraft, tablet computer, laptop computer, or personal computer (PC), etc. A client can also be set on terminal 10, which can be an application client or a browser client, etc.

[0081] In another embodiment, server 11 can be configured to: upon receiving an instance recovery request for a business cluster instance, obtain backup data for each container group in the business cluster instance; for each container group, based on the backup data of the container group, create a target backup persistent volume declaration and a target backup persistent volume object corresponding to the container group, wherein the target backup persistent volume declaration is used to declare the storage attribute information required by the container group, and the target backup persistent volume object points to the storage area of ​​the backup data of the container group; based on the target backup persistent volume declaration and the target backup persistent volume object, create a target persistent volume declaration and a target persistent volume object corresponding to the container group; and based on the target persistent volume declaration and the target persistent volume object corresponding to the container group, run the container group to restore the operation of each container group in the business cluster instance.

[0082] Terminal 10 can be used to send an instance recovery request for a business cluster instance to server 11 according to business needs, so that server 11 can restore the operation of each container group in the business cluster instance based on the instance recovery request.

[0083] The backup and recovery method for business cluster instances provided in this application relates to cloud storage and database technologies in the field of cloud technology.

[0084] Cloud technology refers to a hosting technology that unifies hardware, software, and network resources within a wide area network (WAN) or local area network (LAN) to achieve data computation, storage, processing, and sharing. Cloud technology is a general term encompassing network technology, information technology, integration technology, management platform technology, and application technology based on the cloud computing business model. It can form resource pools, providing flexible and convenient on-demand access. Cloud computing technology will become a crucial support. Backend services of technical network systems require substantial computing and storage resources, such as video websites, image websites, and many portal websites. With the rapid development and application of the internet industry, every item may have its own identification mark in the future, requiring transmission to backend systems for logical processing. Data at different levels will be processed separately, and various industry data will require robust system support, which can only be achieved through cloud computing.

[0085] Among them, cloud storage is a new concept that has been extended and developed from the concept of cloud computing. A distributed cloud storage system (hereinafter referred to as a 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 storage devices of various types in the network (storage devices are also called storage nodes) to work together through application software or application interfaces to provide data storage and business access functions to the outside world.

[0086] Currently, the storage method of storage systems is as follows: Logical volumes are created. During the creation of a logical volume, physical storage space is allocated to each logical volume. This physical storage space may consist of a single storage device or the disks of several storage devices. Clients store data on a logical volume, which means storing the data on the file system. The file system divides the data into many parts, each part being an object. Each object contains not only the data but also additional information such as a data identifier (ID, ID entity). The file system writes each object to the physical storage space of that logical volume and records the storage location information of each object. Therefore, when a client requests access to data, the file system can allow the client to access the data based on the storage location information of each object.

[0087] The process by which a storage system allocates physical storage space to a logical volume involves the following steps: Based on a capacity estimate of the objects to be stored on 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 Redundant Array of Independent Disks (RAID), the physical storage space is pre-divided into stripes. A logical volume can be understood as a stripe, thus allocating physical storage space to the logical volume. Storage systems enable storage for applications and stateful services.

[0088] In short, a database can be viewed as an electronic filing cabinet—a place to store electronic files, where users can perform operations such as adding, querying, updating, and deleting data. A "database" is a collection of data stored together in a certain way, capable of being shared by multiple users, with minimal redundancy, and independent of application programs.

[0089] A Database Management System (DBMS) is a computer software system designed to manage databases, generally possessing basic functions such as storage, retrieval, security, and backup. DBMSs can be classified according to the database model they support, such as relational or XML (Extensible Markup Language); or according to the type of computer they support, such as server clusters or mobile devices; or according to the query language used, such as SQL (Structured Query Language) or XQuery; or according to performance priorities, such as maximum scale or maximum operating speed; or other classification methods. Regardless of the classification method used, some DBMSs can cross categories, for example, simultaneously supporting multiple query languages.

[0090] The following sections provide detailed descriptions of each example. It should be noted that the order in which the embodiments are described is not intended to limit the preferred order of the embodiments.

[0091] This embodiment will be described from the perspective of the backup device of the business cluster instance. Specifically, the backup device of the business cluster instance can be integrated into a first electronic device, which can be a server or a terminal or other device.

[0092] This embodiment can be applied to various scenarios such as cloud technology, artificial intelligence, smart transportation, and assisted driving.

[0093] like Figure 1b As shown, the specific process for backing up this business cluster instance can be as follows:

[0094] 101. Determine the business cluster instance to be backed up, wherein the business cluster instance includes at least one container group.

[0095] Specifically, a business cluster instance can be a cluster instance shipped by a stateful service (database), which can be referred to as a Cluster. It can be a cluster composed of multiple containers, which can be a cluster managed by a container orchestration engine (Kubernetes, or K8s for short). This container orchestration engine can be used to manage containerized applications on multiple hosts in the cloud platform.

[0096] Kubernetes is an open-source system for automatically deploying, scaling, and managing containerized applications. It can combine several containers into a service and dynamically allocate hosts for running containers.

[0097] Specifically, a business cluster instance can include at least one business component, and each business component can include at least one container group. For example... Figure 1c As shown, a business cluster instance can be abstracted into a three-layer resource management model, from top to bottom: cluster, sets, and pods. The cluster corresponds to the business instance, sets correspond to business components, and pods correspond to container groups. For example, for the LibraDB product, the cluster instance is tdach-xxx, the sets include zookeeper and clickhouse, and the pods include zookeeper pods and clickhouse-pods, thus meeting the resource management needs of the database product. This resource management model also supports the access of various business products and allows for features such as the sequential startup order of business components, custom configuration of parameters for each business component, and multiple shards and replicas for business pods.

[0098] LibraDB is a distributed HTAP (Hybrid Transaction and Analytical Process) database. Based on a pluggable engine design, powerful data fusion capabilities, and a cloud-native system architecture, it provides users with an integrated product experience. ZooKeeper is a distributed, open-source distributed application coordination service, and ClickHouse is a columnar database management system for online analytical processing.

[0099] A container group can be a group of containers within a business cluster instance responsible for deploying a specific business component. Each container group can contain at least one container. Specifically, a container group (pod) can be the basic scheduling unit in Kubernetes, and a container group pod can contain multiple business processes.

[0100] Containers are executable units of software in which application code, libraries, and dependencies are packaged together in a common way. Containers leverage operating system virtualization to allow multiple applications to share the operating system by isolating processes and controlling the amount of CPU (central processing unit), memory, and disk space that these processes can access.

[0101] 102. For each container group, set the corresponding source persistent volume declaration and source persistent volume object, and store the container group based on the source persistent volume object. The source persistent volume declaration is used to declare the storage attribute information required by the container group, and the source persistent volume object points to the data storage area of ​​the container group.

[0102] Specifically, a source persistent volume declaration can be a request for storage resources. It represents an underlying storage object abstracted for use by a Pod, declaring the required storage capacity (e.g., 100GB), whether it is exclusively used or shared by the Node, and whether it is a file system or block device. This can be denoted as a PVC (Persistent Volume Claim). In essence, a PVC is a resource request issued by a user to the Kubernetes system.

[0103] The storage attribute information required by the container group declared in the source persistent volume declaration may include storage capacity, file system type, etc., which are not limited in this embodiment.

[0104] The source persistent volume object is an abstraction of storage resources; it represents the underlying hard disk storage abstraction and is associated with the actual hard disk. The source persistent volume object can be denoted as PV (PersistentVolume), which represents the persistent volume content.

[0105] It's important to note that the persistent volume here refers to a cluster resource, specifically an abstraction of the actual physical storage system in Kubernetes. A persistent volume can be understood as a file system or block device that can be mounted inside a container, corresponding to two working modes: Filesystem and Block.

[0106] Specifically, when a container group's Pod needs to use storage resources, it needs to reference a PVC (Physical Volume) in the Volume definition and mount the PVC to a specific path within the container. After mounting the PVC, the Pod can use the storage resources. The same PVC can be mounted and used by multiple Pods simultaneously. In this case, the application should handle the issue of multiple processes accessing the same storage.

[0107] In this embodiment, the PVC corresponding to the container group can be set first, then the set of PVs (i.e., persistent volume objects) that are currently available can be obtained, and then the PV that matches the configuration information of the PVC can be selected from the PV set. That is, multiple PVs are initially screened according to the configuration information of the PVC, which can filter out PVs that do not meet the PVC conditions and avoid the situation where the PV and PVC binding fails, thereby providing the PVC with an accurate PV binding object, and then the PVC is bound to a selected PV.

[0108] The configuration information of a PVC may include, but is not limited to, name, binding status, storage volume name, storage space, access mode, and storage type.

[0109] Optionally, in this embodiment, the step "for each container group, set the source persistent volume declaration and source persistent volume object corresponding to the container group, and store the container group based on the source persistent volume object" may include:

[0110] For each container group, set a source persistent volume declaration corresponding to the container group. The source persistent volume declaration includes the storage capacity and file system type required by the container group.

[0111] Get the collection of persistent volume objects that are currently available;

[0112] Select a source persistent volume object from the persistent volume object set that matches the storage capacity and the file system type, and establish a binding relationship between the selected source persistent volume object and the source persistent volume declaration;

[0113] Based on the source persistent volume declaration and the binding relationship, the data of the container group is stored in the data storage area pointed to by the source persistent volume object.

[0114] The available state specifically refers to a state that has not yet been bound to a PVC. The persistent volume object collection contains at least one persistent volume object that is currently in an available state.

[0115] Establishing a binding relationship between the source persistent volume object and the source persistent volume declaration can specifically involve writing the object attribute identifier of the source persistent volume object into the configuration information of the source persistent volume declaration. Based on this binding relationship and the source persistent volume declaration, the source persistent volume object corresponding to the source persistent volume declaration can be determined, thereby storing the container group's data in the data storage area pointed to by the source persistent volume object.

[0116] In one embodiment, Kubernetes provides two resource types—Persistent Volume Objects (PVs) and Persistent Volume Claims (PVCs)—to meet the data persistence requirements of containers. Each PV can correspond to a storage space, such as a storage volume on a server. Containers are a type of resource in Kubernetes. A container resource specifies the PVC it ​​needs to use in its configuration. The specified PVC, in turn, specifies storage resource configuration information such as the required storage size and storage mode in its configuration. Finally, Kubernetes matches PVs within the current Kubernetes system based on this storage resource configuration information. If a PV matches the requirements declared in the PVC's storage resource configuration information, then the PV can be bound to the PVC.

[0117] Specifically, databases are a typical application of cloud-native stateful services, which have high requirements for efficient data access and persistent storage. Persistent data storage is generally achieved through PVs (Persistent Volumes). By specifying the corresponding PVC (Persistent Volume Claim) in the Pod, the underlying CSI plugin is called to realize the dynamic plugging, unplugging, formatting, and mounting of cloud disks. In this way, the Container in the Pod can use the corresponding mounted disk directory.

[0118] CSI (Container Storage Interface) is a Kubernetes (K8S) standard for configuring container storage. This standard defines interfaces for creating persistent volumes, deleting persistent volumes, and taking snapshots. Any storage system that implements the CSI specification can serve as a backend storage for K8S. Storage snapshot functionality can be implemented in K8S through the CSI Snapshotter controller.

[0119] Among them, reference Figure 1dEach container group (Pod) will set up a PVC to declare the required storage attributes, such as storage capacity and volume mode. For example, it can declare a required storage capacity of 20 Gi and a volume mode of filesystem. After setting up the PVC, the underlying CSI plugin can implement the specific PV persistent storage. The PV's attributes can include storage capacity (e.g., 20 Gi), storage type (e.g., cbs-ssd), and reclamation policy.

[0120] The PV is associated with a real hard disk (specifically, a cloud disk) system. The disk's attribute information can include region, availability zone, disk capacity (e.g., 20Gi), type (e.g., solid-state drive SSD), etc. The use of the hard disk will be billed according to cloud service standards, such as annual or monthly subscriptions, or pay-as-you-go billing.

[0121] The recycling strategy can be a retention strategy, which means that the corresponding PV will be retained when the PVC is deleted. Storage type (SC, StorageClass) can be used to classify different specifications, hard drive performance, etc., into specific types, allowing businesses to choose according to their needs and flexibly control costs.

[0122] It's important to note that storage resources (PVs, PVCs) are independently managed resources compared to container groups (Pods) and can be deleted individually. When deleting a resource, the system checks if the storage resource is currently in use. If it is, the deletion will be postponed until it is no longer in use. This ensures that resources are not directly deleted while still in use, preventing data loss.

[0123] Specifically, after using storage resources, users can delete a PVC. The PV bound to that PVC will be marked as "released," but it cannot be immediately bound to other PVCs. This is because data written through the previous PVC may still remain on the storage device. Only after this data is cleared can the PV be used again. Administrators can set resource reclamation policies for PVs.

[0124] In some embodiments, the resource reclamation strategy for a PV can be set to a Retain strategy. A Retain strategy means that after a PVC is deleted, the PV bound to it is not deleted, but only marked as released. Therefore, the data in the PV still exists and cannot be used by a new PVC until it is cleared. It requires cleanup by an administrator before it can be used again. The cleanup steps can be as follows:

[0125] (1) Delete the PV resource object. At this time, the data in the back-end storage assets of some external storage providers associated with the PV still exists.

[0126] (2) Manually clean up the data in the PV backend storage assets;

[0127] (3) Manually delete the backend storage asset. If you wish to reuse the storage asset, you can create a new PV associated with it.

[0128] In this embodiment, the container group Pod accesses the PV through the PVC. The Pod and the PVC must be in the same namespace. The PVC will bind to the appropriate PV in the cluster and mount the PV to the Pod.

[0129] 103. When the business cluster instance meets the backup triggering condition, for each container group, create the backup persistent volume declaration and backup persistent volume object corresponding to the container group based on the source persistent volume declaration and source persistent volume object corresponding to the container group.

[0130] The backup trigger condition, also known as the condition for triggering a snapshot of the business cluster instance, can be set according to actual conditions, and this embodiment does not impose any restrictions on it. For example, the backup trigger condition could be that the business cluster instance is deleted, or that the current time meets the backup trigger time condition of the business cluster instance, etc.

[0131] A snapshot, also known as a snapshot, is a common service for storage volumes. It can be used to record the state of the data content of a storage volume at a certain point in the past. It can restore the data content to the state at a specified point in time after the storage volume is damaged or data is written incorrectly, which is of great significance for the protection of data content.

[0132] Specifically, the user's database has a stateful service that can take full snapshots periodically according to business needs, or automatically take full snapshots in the event of accidental deletion, so that data and normal operation of the business cluster instance can be quickly restored later.

[0133] In this embodiment, the backup persistent volume declaration, also known as the persistent volume snapshot declaration, represents the abstract resource object of the persistent volume snapshot. It can be denoted as VSS, which stands for VolumeSnapshot.

[0134] The backup persistent volume object, also known as the persistent volume snapshot content, is an abstract resource object representing the persistent volume snapshot content. It is associated with the actual backend snapshot storage resource, such as COS / NFS. The backup persistent volume object can be abbreviated as VSC, short for VolumeSnapshotContent.

[0135] Among them, COS (Cloud Object Storage) is a cloud object storage service, a distributed, massive-scale storage system for unstructured objects. NFS (Network File System) is a network file system, a distributed, massive-scale storage system.

[0136] Optionally, in this embodiment, the step "when the service cluster instance meets the backup triggering condition, for each container group, create a backup persistent volume declaration and a backup persistent volume object corresponding to the container group based on the source persistent volume declaration and the source persistent volume object corresponding to the container group" may include:

[0137] When it is detected that the business cluster instance has been deleted and is in backup startup state, for each container group, a backup persistent volume declaration and a backup persistent volume object corresponding to the container group are created based on the source persistent volume declaration and source persistent volume object corresponding to the container group.

[0138] The backup trigger condition can be set to the business cluster instance being deleted and in a backup-initiated state. Specifically, the backup-initiated state can mean that the snapshot switch of the business cluster instance is enabled.

[0139] Specifically, in the ClusterPreset of each business product, the snapshot on / off switch can be controlled by setting the disableSnapshot parameter to true / false. If no switch value is set, it is enabled by default.

[0140] After a user's business cluster instance is destroyed and the snapshot switch is enabled, the backup device for the business cluster instance provided in this application will automatically create a snapshot for backup, specifically including the backup of disk persistent volume data and sub-resource metadata, etc.

[0141] ClusterPreset is a template for a business cluster instance. Specifically, it represents a pre-configured specification template for a business cluster instance. For example, the pre-configured specification template may include the image, CPU / memory, and parameter configuration of the corresponding component.

[0142] After in-depth analysis of the usage scenarios in production practice, it was found that the need to generate snapshots for storage data volumes often has the characteristics of timed and periodic. For example, a snapshot usually needs to be generated once every day at 2:00 AM, or once every weekend at 2:00 AM. Therefore, this application can also propose another technical solution for automatic snapshot generation, that is, application administrators can automatically manage the snapshot generation process of a specified storage data volume by pre-setting the snapshot time.

[0143] Optionally, in this embodiment, the step "when the service cluster instance meets the backup triggering condition, for each container group, create a backup persistent volume declaration and a backup persistent volume object corresponding to the container group based on the source persistent volume declaration and the source persistent volume object corresponding to the container group" may include:

[0144] When the current time meets the backup trigger time condition of the business cluster instance, for each container group, create the corresponding backup persistent volume declaration and backup persistent volume object based on the source persistent volume declaration and source persistent volume object of the container group.

[0145] The backup trigger time condition can be set according to the actual situation, and this embodiment does not impose any restrictions on it. For example, the backup trigger time condition can be set to take a snapshot at 02:00 every day.

[0146] Specifically, users can set up scheduled snapshot policies, such as backups every hour or every day at 02:00 AM. After setting up a scheduled snapshot policy, the backup device of the business cluster instance will perform periodic snapshot backups according to the time policy specified by the user.

[0147] 104. Based on the source persistent volume object, obtain the data to be backed up for the container group.

[0148] The source persistent volume object points to the data storage area of ​​its corresponding container group. Therefore, the data storage address of the corresponding container group can be determined based on the source persistent volume object, and the data to be backed up in the container group can be obtained based on the data storage address.

[0149] Optionally, in this embodiment, the service cluster instance includes at least one service component, and the service component includes at least one container group;

[0150] The step "Obtain the data to be backed up for the container group based on the source persistent volume object" may include:

[0151] Based on the instance address information in the source persistent volume object of the container group, the instance data storage area of ​​the business cluster instance to which the container group belongs is determined;

[0152] Based on the component address information in the source persistent volume object of the container group, the component data storage area of ​​the business component to which the container group belongs is determined from the instance data storage area;

[0153] Based on the container group address information in the source persistent volume object of the container group, determine the data storage area of ​​the container group from the component data storage area;

[0154] Retrieve the data to be backed up from the container group in the data storage area.

[0155] In this embodiment, for each container group, the instance data storage area of ​​the business cluster instance to which the container group belongs can be determined first, and then the component data storage area of ​​the business component to which the container group belongs can be further determined, thereby determining the data storage area of ​​the container group. In this way, the data storage area of ​​the container group can be quickly determined through layer-by-layer query.

[0156] 105. For each container group, based on the backup persistent volume declaration corresponding to the container group, back up the data to be backed up of the container group to the storage area pointed to by the backup persistent volume object, so as to realize the data backup of each container group in the business cluster instance.

[0157] Optionally, in this embodiment, the step "for each container group, back up the data to be backed up to the storage area pointed to by the backup persistent volume object according to the backup persistent volume declaration corresponding to the container group" may include:

[0158] For each container group, establish a binding relationship between the backup persistent volume declaration and the backup persistent volume object for that container group;

[0159] Based on the backup persistent volume declaration corresponding to the container group and the binding relationship, the data to be backed up in the container group is backed up to the storage area pointed to by the backup persistent volume object.

[0160] Specifically, based on the backup persistent volume declaration and binding relationship corresponding to the container group, the backup persistent volume object corresponding to the backup persistent volume declaration can be determined, thereby writing the data to be backed up in the container group to the storage area pointed to by the backup persistent volume object.

[0161] Optionally, in this embodiment, the step "establishing a binding relationship between the backup persistent volume declaration and the backup persistent volume object for each container group" may include:

[0162] For each container group, obtain the object attribute identifier of the backup persistent volume object of the container group;

[0163] The object attribute identifier is written into the configuration information of the backup persistent volume declaration of the container group, so as to establish a binding relationship between the backup persistent volume declaration and the backup persistent volume object of the container group.

[0164] Specifically, the object attribute identifier is a unique identifier assigned to the backup persistent volume object by the backup system of the business cluster instance. The object attribute identifier is used to uniquely identify the backup persistent volume object.

[0165] Specifically, writing the object attribute identifier of the backup persistent volume object into the configuration information of the backup persistent volume declaration can be done by updating the binding object information in the configuration information of the backup persistent volume declaration to the object attribute identifier of the backup persistent volume object.

[0166] In one specific embodiment, when a service periodically initiates a snapshot or when a service cluster instance is destroyed and an automatic snapshot is initiated, for each container group, a VSS / VSC can be created from the PVC / PV respectively by calling the relevant interface. This allows the underlying storage to create a snapshot from the disk cloud disk. The PVC and PV, as well as the VSS and VSC, have an ID (Identity Document) binding relationship with each other. (Refer to...) Figure 1e .

[0167] In some embodiments, multiple snapshot requests can be initiated at different times for the same business cluster instance, generating a 1:N number of snapshots, each of which can be used to restore a different target instance.

[0168] The disk identifier (Disk-id) of a snapshot indicates the source attribute of the snapshot, meaning that the snapshot was backed up from a disk cloud disk. Figure 1e In this context, a snapshot can be understood as a storage space, specifically representing the storage area pointed to by the backup persistent volume object to which the data to be backed up from the container group is located.

[0169] Specifically, in this embodiment, when the backup triggering condition is met, for each container group of the business cluster instance, a VSS and VSC corresponding to the container group can be created according to the PVC and PV corresponding to the container group. Then, based on the PV, the data to be backed up in the container group in the cloud disk is determined. Based on the VSS, the data to be backed up in the container group is backed up to the storage area pointed to by the VSC, so as to realize the migration of data in the cloud disk to the storage area pointed to by the VSC in the snapshot.

[0170] Optionally, in this embodiment, the backup method for the service cluster instance may further include:

[0171] Analyze the resource reference relationships of the business cluster instance to determine the dependent resources of the business cluster instance;

[0172] The dependent resources are backed up.

[0173] Specifically, the dependent resources of a business cluster instance can be sub-resources existing within the business cluster instance.

[0174] Specifically, to meet the diverse management requirements of stateful services, business cluster instances may contain various sub-resources, such as Probe, SchedulerPolicy, and WorkloadConfig. These sub-resources are CRD resource objects extended through the Kubernetes APIService, and all are essential for the operation of the business cluster instance. Therefore, when performing snapshot backups of business cluster instances, in addition to backing up the disk data corresponding to the PVC / PV, it is also necessary to perform snapshot backups of all dependent sub-resources. Here, CRD stands for Custom Resources Definition, which refers to user-defined resources.

[0175] In one specific embodiment, backup of sub-resources can utilize Kubernetes backend storage, storing the metadata related to the sub-resources in etcd. Because Kubernetes APIService supports custom etcd backend storage, extended resources and sub-resource objects can be stored in their own etcd backend cluster by version (e.g., v1alpha / v1beta), ensuring high availability (HA) across availability zones (AZs).

[0176] etcd is an open-source distributed unified key-value store used for shared configuration, service discovery, and scheduling coordination in distributed systems or computer clusters.

[0177] like Figure 1f As shown, when backing up the entire business cluster instance, VSS / VSC can be created based on the PVC / PV of each container group. The disk data corresponding to the PV is then backed up based on the VSS / VSC. Furthermore, all sub-resource objects that the business cluster instance depends on can be snapshotted and backed up. These sub-resource objects, i.e., the resources that the business cluster instance depends on, specifically represent closely related attributes, methods, or operations of a resource in Kubernetes, and use separate access control policies.

[0178] As can be seen from the above, this embodiment can determine the business cluster instance to be backed up, the business cluster instance including at least one container group; for each container group, a source persistent volume declaration and a source persistent volume object are set for the container group, and the container group is stored based on the source persistent volume object. The source persistent volume declaration is used to declare the storage attribute information required by the container group, and the source persistent volume object points to the data storage area of ​​the container group; when the business cluster instance meets the backup triggering condition, for each container group, a backup persistent volume declaration and a backup persistent volume object are created according to the source persistent volume declaration and the source persistent volume object; based on the source persistent volume object, the data to be backed up for the container group is obtained; for each container group, according to the backup persistent volume declaration corresponding to the container group, the data to be backed up for the container group is backed up to the storage area pointed to by the backup persistent volume object, so as to realize the data backup of each container group in the business cluster instance. This application can perform backup processing on the entire business cluster instance, improve the backup efficiency of the business cluster instance, and facilitate the rapid backup of the business cluster instance.

[0179] This embodiment will be described from the perspective of the recovery device of the business cluster instance. Specifically, the recovery device of the business cluster instance can be integrated into a second electronic device, which can be a terminal or a server or other devices.

[0180] like Figure 2a As shown, the specific process for restoring this business cluster instance is as follows:

[0181] 201. When an instance recovery request for a business cluster instance is received, the backup data of each container group in the business cluster instance is obtained.

[0182] Specifically, a business cluster instance can be a cluster instance shipped by a stateful service (database), which can be referred to as a Cluster. It can be a cluster composed of multiple containers, which can be a cluster managed by a container orchestration engine (Kubernetes, or K8s for short). This container orchestration engine can be used to manage containerized applications on multiple hosts in the cloud platform.

[0183] Specifically, a business cluster instance can include at least one business component, and each business component can include at least one container group. A container group can be a group within the business cluster instance responsible for deploying a specific business component. Each container group can include at least one container. Specifically, a container group (pod) can be the basic scheduling unit in Kubernetes, and a single container group (pod) can contain multiple business processes.

[0184] After a snapshot of a business cluster instance is successfully created, the target instance can be restored at any time as needed within the snapshot's validity period. The restored instance will maintain the same data and state as before. Furthermore, multiple target instances can be restored from the same snapshot as needed, and these different target instances can reside in different namespaces.

[0185] In one specific embodiment, snapshots can be set via the snapshot expiration parameter `snapshot-expiration-seconds` (accurate to the second). When the snapshot switch is enabled, if no expiration time is set, snapshot data is saved for 7 days by default. During this period, users can quickly restore the target business cluster instance at any time via snapshots.

[0186] 202. For each container group, based on the backup data of the container group, create a target backup persistent volume declaration and a target backup persistent volume object corresponding to the container group. The target backup persistent volume declaration is used to declare the storage attribute information required by the container group, and the target backup persistent volume object points to the storage area of ​​the backup data of the container group.

[0187] The target backup persistent volume declaration, also known as the persistent volume snapshot declaration, represents an abstract resource object of a persistent volume snapshot, which can be denoted as VSS'. The storage attribute information required by the container group declared in the target backup persistent volume declaration may include storage capacity, file system type, etc., which are not limited in this embodiment.

[0188] The target backup persistent volume object, i.e., the persistent volume snapshot content, represents an abstract resource object of the persistent volume snapshot content and is associated with the actual backend snapshot storage resource, such as COS / NFS. The target backup persistent volume object can be denoted as VSC'. The storage area pointed to by the target backup persistent volume object stores the backup data of the container group, i.e., the snapshot data. In this embodiment, this backup data can be abstracted into VSS' and VSC' resource objects.

[0189] 203. Based on the target backup persistent volume declaration and the target backup persistent volume object, create the target persistent volume declaration and target persistent volume object corresponding to the container group.

[0190] Specifically, a target persistent volume declaration can be a request for storage resources. It represents an underlying storage object abstracted for use by a Pod, declaring the required storage capacity (e.g., 100GB), whether it is exclusively used or shared by the Node, and whether it is a file system or block device. It can be denoted as a PVC (Persistent Volume Claim). In essence, a PVC is a resource request issued by a user to the Kubernetes system.

[0191] The target persistent volume object is an abstraction of storage resources; it represents the underlying hard disk storage abstraction and is associated with the actual hard disk. The source persistent volume object can be denoted as PV' (PersistentVolume), which is the persistent volume content.

[0192] Optionally, in this embodiment, the backup data of the container group is located in the first storage area, and the instance recovery request indicates that the service cluster instance be recovered in the second storage area;

[0193] The step "For each container group, based on the backup data of the container group, create a target backup persistent volume declaration and a target backup persistent volume object corresponding to the container group" may include:

[0194] For each container group, based on the backup data of the container group, create an initial backup persistent volume object and a target backup persistent volume declaration in the second storage area;

[0195] Based on the target backup persistent volume declaration, the binding declaration information in the initial backup persistent volume object is updated to obtain the target backup persistent volume object.

[0196] Specifically, the first storage area and the second storage area can be storage areas under different Namespaces (NS). NS stands for Namespace. Specifically, Kubernetes uses namespaces to group related resources within the same namespace to achieve resource isolation and access control.

[0197] Specifically, backup and recovery of business cluster instances may occur within the same service node (NS) or in different NSs. When backup and recovery are not in the same NS, the binding declaration information in the initial backup persistent volume object created based on the backup data needs to be updated. Specifically, the binding declaration information can be corrected to the target backup persistent volume declaration to obtain the updated target backup persistent volume object.

[0198] The binding declaration information in the initial backup persistent volume object can be the VolumeSnapshotRef parameter field, which is used to reference the corresponding VolumeSnapshot.

[0199] 204. Based on the target persistent volume declaration and target persistent volume object corresponding to the container group, run the container group to restore the operation of each container group in the business cluster instance.

[0200] Optionally, in this embodiment, the step "running the container group according to the target persistent volume declaration and target persistent volume object corresponding to the container group to restore the operation of each container group in the business cluster instance" may include:

[0201] Bind the target persistent volume declaration and target persistent volume object corresponding to the container group;

[0202] When the target persistent volume declaration and the target persistent volume object are bound to each other, the container group is run to resume operation of each container group in the business cluster instance.

[0203] Optionally, in this embodiment, the step of "binding the target persistent volume declaration and the target persistent volume object corresponding to the container group" may include:

[0204] Obtain the object attribute identifier of the target persistent volume object of the container group;

[0205] The object attribute identifier is written into the configuration information of the target persistent volume declaration corresponding to the container group, so that the target persistent volume declaration and the target persistent volume object are bound together.

[0206] Specifically, the object attribute identifier is a unique identifier assigned to the target persistent volume object by the recovery system of the business cluster instance. The object attribute identifier is used to uniquely identify the target persistent volume object.

[0207] Specifically, writing the object attribute identifier of the target persistent volume object into the configuration information of the target persistent volume declaration can be done by updating the binding object information in the configuration information of the target persistent volume declaration to the object attribute identifier of the target persistent volume object.

[0208] In one specific embodiment, such as Figure 2b As shown, the business data recovery process begins with a snapshot (specifically, the backup data corresponding to business cluster instance 1). For each container group of the target business cluster instance to be recovered, VSS' and VSC' resource objects are created based on the backup data of the container group, and the VSS' and VSC' resource objects are bound together, with their ReadyToUse state set to true. Then, PVC' and PV' are created using VSS' and VSC' as data sources. After the PVC' and PV' are bound together and their state is Bound, they can be used by the Pods of the target business cluster instance. The backup data is migrated from the snapshot to the disk, and then the Pod will start running, ultimately enabling the target business cluster instance to run normally. The target business cluster instance that is restored and running can be referred to as business cluster instance 2. Business cluster instance 2 maintains the same data and state as the previous business cluster instance 1.

[0209] Specifically, backup and recovery of business cluster instances may occur within the same Service Node (NS) or in different NSs. The backup and recovery process within the same NS is as follows: Figure 2b As shown. The backup and recovery method for business cluster instances provided in this application can also enable cross-NS recovery of business cluster instances.

[0210] Backup and restore for different Service Controllers (NS) require special logic processing. (See reference) Figure 2c The backup data (snapshot data) corresponding to the container group is located in the ns1 storage area. The instance recovery request indicates that recovery should be performed in the ns2 storage area. Specifically, for each container group of the target business cluster instance to be recovered, a VSC' is created based on the container group's backup data. Then, a VSS' is created under the target NS (specifically, the ns2 storage area). Next, the VolumeSnapshotRef in the VSC' is changed to the VSS' under the target NS. Afterwards, the Kubernetes internal VSS controller tunes the VSS' and VSC' to be mutually bound and sets the ReadyToUse state to true. Then, PVC' and PV' are created using the VSS' and VSC' as data sources. Once they are mutually bound and the state is Bound, they can be used by the Pods of the target business cluster instance. The Pods will then run, ultimately enabling the target business cluster instance to operate normally.

[0211] Specifically, changes to VolumeSnapshotRef can include:

[0212] vsc.Spec.VolumeSnapshotRef.Name=vss.GetName()

[0213] vsc.Spec.VolumeSnapshotRef.Namespace=vss.GetNamespace()

[0214] vsc.Spec.VolumeSnapshotRef.UID=vss.GetUID()

[0215] Optionally, in this embodiment, the step "running the container group according to the target persistent volume declaration and target persistent volume object corresponding to the container group to restore the operation of each container group in the business cluster instance" may include:

[0216] Obtain backup data corresponding to the dependent resources of the business cluster instance;

[0217] Based on the backup data corresponding to the dependent resources, the target persistent volume declaration and the target persistent volume object corresponding to the container group, the container group is run to restore the operation of each container group in the business cluster instance.

[0218] Specifically, the dependent resources of a business cluster instance can be sub-resources existing within the business cluster instance.

[0219] To meet the diverse management requirements of stateful services, business cluster instances may contain various sub-resources, such as Probe, SchedulerPolicy, and WorkloadConfig. These sub-resources are CRD resource objects extended through the Kubernetes APIService, and they are all essential for the operation of the business cluster instance. Therefore, when performing snapshot backups of business cluster instances, in addition to backing up the disk data corresponding to the PVC / PV, it is also necessary to perform snapshot backups of all dependent sub-resources. Here, CRD stands for Custom Resources Definition, which refers to user-defined resources.

[0220] Specifically, stateful service instances depend on many sub-resources. If these sub-resources also depend on underlying persistent volume resources, the sub-resources can be packaged into a whole and uploaded to COS or NFS. Then, the references to this packaged and uploaded sub-resources can be saved for backup. This can reduce the complexity of the overall backup and recovery logic of the business cluster instance and improve efficiency.

[0221] Specifically, such as Figure 2d The diagram shows the overall backup and recovery process for the business cluster instance. The process is described below:

[0222] First, by calling the business delivery interface, a source business cluster instance (referred to as business cluster instance 1, src-cluster1) is created. After business cluster instance 1 has been initialized, data has been persisted and written, and is running normally, a snapshot backup request can be initiated through the interface.

[0223] At this point, the backend dynamically creates a CSS (Cluster Instance Snapshot) resource object based on the snapshot backup request, and then hands it over to the corresponding Snapshot-controller for reconcile, ultimately creating backup data for VSS, VSC, Snapshot (snapshot data), and sub-resources. This step indicates that the snapshot backup process is successful. If the source business cluster instance needs to be deleted at this point, the GC-controller (Garbage Collector Controller) can then safely and truly delete the source business cluster instance.

[0224] Once the backup data is prepared, the business can initiate a request to restore the target business cluster instance at any time as needed. The backend will start from the snapshot data, create VSS' and VSC' resource objects for the target instance, bind the VSS' and VSC' resource objects together, and set their ReadyToUse status to true. Then, PVC' and PV' are created using VSS' and VSC' as data sources. After the PVC' and PV' are bound together and their status is Bound, they can be used by the Pods of the target business cluster instance. The backup data is migrated from the snapshot to the cloud disk, and then the Pods will start running, and the business components will run normally, ultimately enabling the target business cluster instance to run normally. The restored and running target business cluster instance can be referred to as business cluster instance 2. Business cluster instance 2 maintains the same data and status as the previous business cluster instance 1.

[0225] Among them, CSS (ClusterSnapshot) is a snapshot of a cluster instance. It is a custom CRD (Custom Resources Definition) object that represents an abstract entity object of a snapshot of a business cluster instance, which includes backup-related metadata.

[0226] This application enables rapid backup and recovery of database cluster instances and their dependent sub-resources at the overall database instance level. It not only allows for on-demand snapshot creation for business operations but also provides immediate service in the event of accidental deletion of a business instance, safeguarding the security and stability of business data. Furthermore, if a user accidentally deletes an instance, a snapshot can be automatically created for backup, including persistent volume data and sub-resource metadata, which can be used for rapid recovery of the business instance.

[0227] In addition, the generated snapshots can support a variety of backend storage, such as COS object storage, NFS, cloud snapshots, etc., and their cost is much lower than that of ordinary cloud disks, thus bringing significant cost reduction and efficiency improvement to the business.

[0228] In some embodiments, if an interface or process exception occurs during snapshot backup, the Snapshot controller will retry using Exponential Backoff. If snapshot resources are insufficient or the account is in arrears, retries may fail indefinitely. When resources are sufficient or the interface recovers, the Backoff counter can be reset appropriately to quickly restore the backup process to normal.

[0229] Creating a disk snapshot is a relatively time-consuming process. In this embodiment, in addition to creating snapshots based on blocks, snapshots can also be created using XFS Reflink, which can further improve efficiency.

[0230] This application provides a rapid backup and recovery system for stateful services in Kubernetes clusters. It enables rapid backup and recovery of the entire instance and its sub-resources of a stateful database service, allowing business instances to quickly recover and operate normally. Furthermore, it supports backup and recovery of business instances across different service instances (NSs), automatically performing a full instance backup (including dependent sub-resources) in case of accidental deletion by a user, thus safeguarding the security and stability of the business.

[0231] As can be seen from the above, this embodiment can obtain the backup data of each container group in the business cluster instance when an instance recovery request for the business cluster instance is received; for each container group, based on the backup data of the container group, a target backup persistent volume declaration and a target backup persistent volume object are created for the container group. The target backup persistent volume declaration is used to declare the storage attribute information required by the container group, and the target backup persistent volume object points to the storage area of ​​the backup data of the container group; based on the target backup persistent volume declaration and the target backup persistent volume object, a target persistent volume declaration and a target persistent volume object are created for the container group; based on the target persistent volume declaration and the target persistent volume object for the container group, the container group is run to restore the operation of each container group in the business cluster instance. This application can perform recovery processing on the entire business cluster instance, improve the recovery efficiency of the business cluster instance, and facilitate the rapid recovery of the business cluster instance.

[0232] To better implement the above methods, this application also provides a backup and recovery system for a business cluster instance. This backup and recovery system includes a backup device 31 and a recovery device 32 for the business cluster instance. Figure 3a As shown, the backup device 31 for the business cluster instance may include a determining unit 3101, a storage unit 3102, a first creation unit 3103, a first acquisition unit 3104, and a backup unit 3105; as Figure 3b As shown, the recovery device 32 for the business cluster instance may include a second acquisition unit 3201, a second creation unit 3202, a third creation unit 3203, and a running unit 3204, as follows:

[0233] A. Backup device for business cluster instances 31

[0234] (1) Determine unit 3101;

[0235] A determination unit is used to determine the business cluster instance to be backed up, wherein the business cluster instance includes at least one container group.

[0236] (2) Storage unit 3102;

[0237] A storage unit is used to set a source persistent volume declaration and a source persistent volume object for each container group, and to store the container group based on the source persistent volume object. The source persistent volume declaration is used to declare the storage attribute information required by the container group, and the source persistent volume object points to the data storage area of ​​the container group.

[0238] Optionally, in some embodiments of this application, the storage unit may include a setting subunit, a set acquisition subunit, an establishment subunit, and a storage subunit, as follows:

[0239] The setting subunit is used to set the source persistent volume declaration corresponding to each container group, wherein the source persistent volume declaration includes the storage capacity and file system type required by the container group;

[0240] The collection retrieves a sub-unit, used to retrieve a collection of persistent volume objects that are currently in an available state;

[0241] A subunit is established to select a source persistent volume object that matches the storage capacity and the file system type from the persistent volume object set, and to establish a binding relationship between the selected source persistent volume object and the source persistent volume declaration;

[0242] The storage subunit is used to store the data of the container group to the data storage area pointed to by the source persistent volume object according to the source persistent volume declaration and the binding relationship.

[0243] (3) First creation unit 3103;

[0244] The first creation unit is used to create a backup persistent volume declaration and a backup persistent volume object corresponding to the container group for each container group when the business cluster instance meets the backup triggering conditions, based on the source persistent volume declaration and the source persistent volume object corresponding to the container group.

[0245] Optionally, in some embodiments of this application, the first creation unit may be specifically used to create a backup persistent volume declaration and a backup persistent volume object corresponding to each container group when it is detected that the business cluster instance has been deleted and is in a backup startup state.

[0246] Optionally, in some embodiments of this application, the first creation unit may be specifically used to create a backup persistent volume declaration and a backup persistent volume object corresponding to the container group for each container group when the current time meets the backup trigger time condition of the business cluster instance, based on the source persistent volume declaration and the source persistent volume object corresponding to the container group.

[0247] (4) First acquisition unit 3104;

[0248] The first acquisition unit is used to acquire the data to be backed up from the container group based on the source persistent volume object.

[0249] Optionally, in some embodiments of this application, the service cluster instance includes at least one service component, and the service component includes at least one container group;

[0250] The first acquisition unit may include a first determining subunit, a second determining subunit, a third determining subunit, and a data acquisition subunit, as follows:

[0251] The first determining subunit is used to determine the instance data storage area of ​​the business cluster instance to which the container group belongs, based on the instance address information in the source persistent volume object of the container group;

[0252] The second determining subunit is used to determine the component data storage area of ​​the business component to which the container group belongs from the instance data storage area based on the component address information in the source persistent volume object of the container group;

[0253] The third determining subunit is used to determine the data storage area of ​​the container group from the component data storage area based on the container group address information in the source persistent volume object of the container group;

[0254] The data acquisition subunit is used to acquire the data to be backed up from the data storage area of ​​the container group.

[0255] (5) Backup unit 3105;

[0256] The backup unit is used to back up the data to be backed up for each container group to the storage area pointed to by the backup persistent volume object, based on the backup persistent volume declaration corresponding to the container group, so as to realize the data backup of each container group in the business cluster instance.

[0257] Optionally, in some embodiments of this application, the backup unit may include a first binding subunit and a backup subunit, as follows:

[0258] The first binding subunit is used to establish a binding relationship between the backup persistent volume declaration and the backup persistent volume object of each container group;

[0259] The backup subunit is used to back up the data to be backed up in the container group to the storage area pointed to by the backup persistent volume object, based on the backup persistent volume declaration corresponding to the container group and the binding relationship.

[0260] Optionally, in some embodiments of this application, the first binding subunit may be specifically used to obtain the object attribute identifier of the backup persistent volume object of the container group for each container group; and write the object attribute identifier into the configuration information of the backup persistent volume declaration of the container group, so as to establish a binding relationship between the backup persistent volume declaration and the backup persistent volume object of the container group.

[0261] Optionally, in some embodiments of this application, the backup device for the service cluster instance may further include a resource-dependent backup unit, as follows:

[0262] The dependent resource backup unit is used to analyze the resource reference associations of the business cluster instance, determine the dependent resources of the business cluster instance, and perform backup processing on the dependent resources.

[0263] B. Recovery device for business cluster instances 32

[0264] (6) Second acquisition unit 3201;

[0265] The second acquisition unit is used to acquire backup data of each container group in the business cluster instance when it receives an instance recovery request for the business cluster instance.

[0266] (7) Second creation unit 3202;

[0267] The second creation unit is used to create a target backup persistent volume declaration and a target backup persistent volume object for each container group based on the backup data of the container group. The target backup persistent volume declaration is used to declare the storage attribute information required by the container group, and the target backup persistent volume object points to the storage area of ​​the backup data of the container group.

[0268] Optionally, in some embodiments of this application, the backup data of the container group is located in a first storage area, and the instance recovery request indicates that the business cluster instance be recovered in a second storage area;

[0269] The second creation unit may include a creation subunit and an update subunit, as follows:

[0270] The creation subunit is used to create, for each container group, an initial backup persistent volume object and a target backup persistent volume declaration in the second storage area, based on the backup data of the container group.

[0271] The update subunit is used to update the binding declaration information in the initial backup persistent volume object based on the target backup persistent volume declaration, so as to obtain the target backup persistent volume object.

[0272] (8) Third creation unit 3203;

[0273] The third creation unit is used to create the target persistent volume declaration and target persistent volume object corresponding to the container group based on the target backup persistent volume declaration and the target backup persistent volume object.

[0274] (9) Operation unit 3204;

[0275] The running unit is used to run the container group according to the target persistent volume declaration and target persistent volume object corresponding to the container group, so as to restore the operation of each container group in the business cluster instance.

[0276] Optionally, in some embodiments of this application, the running unit may include a second binding subunit and a running subunit, as follows:

[0277] The second binding subunit is used to bind the target persistent volume declaration and the target persistent volume object corresponding to the container group;

[0278] The running subunit is used to run the container group when the target persistent volume declaration and the target persistent volume object are bound to each other, so as to resume the operation of each container group in the business cluster instance.

[0279] Optionally, in some embodiments of this application, the second binding subunit may be specifically used to obtain the object attribute identifier of the target persistent volume object of the container group; and write the object attribute identifier into the configuration information of the target persistent volume declaration corresponding to the container group, so as to establish a binding relationship between the target persistent volume declaration and the target persistent volume object.

[0280] Optionally, in some embodiments of this application, the running unit may include a resource acquisition subunit and an instance running subunit, as follows:

[0281] The dependent resource acquisition subunit is used to acquire backup data corresponding to the dependent resources of the business cluster instance;

[0282] The instance running subunit is used to run the container group based on the backup data corresponding to the dependent resources, the target persistent volume declaration and the target persistent volume object corresponding to the container group, so as to restore the operation of each container group in the business cluster instance.

[0283] As can be seen from the above, in this embodiment, the determining unit 3101 determines the business cluster instance to be backed up, the business cluster instance including at least one container group; for each container group, the storage unit 3102 sets the source persistent volume declaration and source persistent volume object corresponding to the container group, and stores the container group based on the source persistent volume object, the source persistent volume declaration is used to declare the storage attribute information required by the container group, and the source persistent volume object points to the data storage area of ​​the container group; when the business cluster instance meets the backup triggering condition, for each container group, the first creation unit 3103 creates the backup persistent volume declaration and backup persistent volume object corresponding to the container group according to the source persistent volume declaration and source persistent volume object corresponding to the container group; the first acquisition unit 3104 acquires the data to be backed up of the container group based on the source persistent volume object; for each container group, the backup unit 3105 backs up the data to be backed up of the container group to the storage area pointed to by the backup persistent volume object according to the backup persistent volume declaration corresponding to the container group, so as to realize the data backup of each container group in the business cluster instance;

[0284] Alternatively, when an instance recovery request for a business cluster instance is received, the second acquisition unit 3201 acquires the backup data of each container group in the business cluster instance; for each container group, the second creation unit 3202 creates a target backup persistent volume declaration and a target backup persistent volume object corresponding to the container group based on the backup data of the container group. The target backup persistent volume declaration is used to declare the storage attribute information required by the container group, and the target backup persistent volume object points to the storage area of ​​the backup data of the container group; the third creation unit 3203 creates a target persistent volume declaration and a target persistent volume object corresponding to the container group based on the target backup persistent volume declaration and the target backup persistent volume object; the running unit 3204 runs the container group based on the target persistent volume declaration and the target persistent volume object corresponding to the container group to restore the operation of each container group in the business cluster instance.

[0285] This application can perform backup and recovery of the entire business cluster instance, improving the backup and recovery efficiency of the business cluster instance and facilitating the rapid backup and recovery of the business cluster instance.

[0286] This application also provides an electronic device, such as... Figure 4 The diagram shows a structural schematic of an electronic device involved in an embodiment of this application. This electronic device can be a terminal or a server, specifically:

[0287] The electronic device may include components such as a processor 401 with one or more processing cores, a memory 402 with one or more computer-readable storage media, a power supply 403, and an input unit 404. Those skilled in the art will understand that... Figure 4 The electronic device structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein:

[0288] The processor 401 is the control center of the electronic device, connecting various parts of the device via various interfaces and lines. It executes software programs and / or modules stored in the memory 402, and calls data stored in the memory 402, to perform various functions and process data. Optionally, the processor 401 may include one or more processing cores; preferably, the processor 401 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 401.

[0289] The memory 402 can be used to store software programs and modules. The processor 401 executes various functional applications and data processing by running the software programs and modules stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 402 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 with access to the memory 402.

[0290] The electronic device also includes a power supply 403 that supplies power to the various components. Preferably, the power supply 403 can be logically connected to the processor 401 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 403 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0291] The electronic device may also include an input unit 404, which can be used to receive input digital or character information, and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.

[0292] Although not shown, the electronic device may also include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 401 in the electronic device loads the executable files corresponding to the processes of one or more applications into the memory 402 according to the following instructions, and the processor 401 runs the applications stored in the memory 402 to realize various functions, as follows:

[0293] The process involves identifying a business cluster instance to be backed up, where each instance includes at least one container group. For each container group, a source persistent volume declaration and a source persistent volume object are set, and the container group is stored based on the source persistent volume object. The source persistent volume declaration declares the storage attribute information required by the container group, and the source persistent volume object points to the data storage area of ​​the container group. When the business cluster instance meets the backup triggering conditions, for each container group, a backup persistent volume declaration and a backup persistent volume object are created based on the source persistent volume declaration and source persistent volume object. The data to be backed up for the container group is obtained based on the source persistent volume object. For each container group, the data to be backed up is backed up to the storage area pointed to by the backup persistent volume object based on the backup persistent volume declaration, thereby achieving data backup for each container group in the business cluster instance.

[0294] Alternatively, upon receiving an instance recovery request for a business cluster instance, the backup data of each container group in the business cluster instance is obtained; for each container group, based on the backup data of the container group, a target backup persistent volume declaration and a target backup persistent volume object are created for the container group. The target backup persistent volume declaration is used to declare the storage attribute information required by the container group, and the target backup persistent volume object points to the storage area of ​​the backup data of the container group; based on the target backup persistent volume declaration and the target backup persistent volume object, a target persistent volume declaration and a target persistent volume object are created for the container group; based on the target persistent volume declaration and the target persistent volume object for the container group, the container group is run to restore the operation of each container group in the business cluster instance.

[0295] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.

[0296] As can be seen from the above, this embodiment can determine the business cluster instance to be backed up, the business cluster instance including at least one container group; for each container group, a source persistent volume declaration and a source persistent volume object are set for the container group, and the container group is stored based on the source persistent volume object. The source persistent volume declaration is used to declare the storage attribute information required by the container group, and the source persistent volume object points to the data storage area of ​​the container group; when the business cluster instance meets the backup triggering condition, for each container group, a backup persistent volume declaration and a backup persistent volume object are created according to the source persistent volume declaration and the source persistent volume object; based on the source persistent volume object, the data to be backed up of the container group is obtained; for each container group, according to the backup persistent volume declaration corresponding to the container group, the data to be backed up of the container group is backed up to the storage area pointed to by the backup persistent volume object, so as to realize the data backup of each container group in the business cluster instance;

[0297] Alternatively, upon receiving an instance recovery request for a business cluster instance, the backup data of each container group in the business cluster instance is obtained; for each container group, based on the backup data of the container group, a target backup persistent volume declaration and a target backup persistent volume object are created for the container group. The target backup persistent volume declaration is used to declare the storage attribute information required by the container group, and the target backup persistent volume object points to the storage area of ​​the backup data of the container group; based on the target backup persistent volume declaration and the target backup persistent volume object, a target persistent volume declaration and a target persistent volume object are created for the container group; based on the target persistent volume declaration and the target persistent volume object for the container group, the container group is run to restore the operation of each container group in the business cluster instance.

[0298] This application can perform backup and recovery of the entire business cluster instance, improving the backup and recovery efficiency of the business cluster instance and facilitating the rapid backup and recovery of the business cluster instance.

[0299] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.

[0300] Therefore, embodiments of this application provide a computer-readable storage medium storing a plurality of instructions that can be loaded by a processor to execute steps in any of the backup and recovery methods for a service cluster instance provided in embodiments of this application. For example, the instructions can execute the following steps:

[0301] The process involves identifying a business cluster instance to be backed up, where each instance includes at least one container group. For each container group, a source persistent volume declaration and a source persistent volume object are set, and the container group is stored based on the source persistent volume object. The source persistent volume declaration declares the storage attribute information required by the container group, and the source persistent volume object points to the data storage area of ​​the container group. When the business cluster instance meets the backup triggering conditions, for each container group, a backup persistent volume declaration and a backup persistent volume object are created based on the source persistent volume declaration and source persistent volume object. The data to be backed up for the container group is obtained based on the source persistent volume object. For each container group, the data to be backed up is backed up to the storage area pointed to by the backup persistent volume object based on the backup persistent volume declaration, thereby achieving data backup for each container group in the business cluster instance.

[0302] Alternatively, upon receiving an instance recovery request for a business cluster instance, the backup data of each container group in the business cluster instance is obtained; for each container group, based on the backup data of the container group, a target backup persistent volume declaration and a target backup persistent volume object are created for the container group. The target backup persistent volume declaration is used to declare the storage attribute information required by the container group, and the target backup persistent volume object points to the storage area of ​​the backup data of the container group; based on the target backup persistent volume declaration and the target backup persistent volume object, a target persistent volume declaration and a target persistent volume object are created for the container group; based on the target persistent volume declaration and the target persistent volume object for the container group, the container group is run to restore the operation of each container group in the business cluster instance.

[0303] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.

[0304] The computer-readable storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0305] Since the instructions stored in the computer-readable storage medium can execute the steps in the backup and recovery method of any service cluster instance provided in the embodiments of this application, the beneficial effects that the backup and recovery method of any service cluster instance provided in the embodiments of this application can achieve can be realized. For details, please refer to the previous embodiments, which will not be repeated here.

[0306] According to one aspect of this application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in various alternative implementations of the backup and recovery aspects of the aforementioned business cluster instance.

[0307] The foregoing has provided a detailed description of a backup and recovery method for a business cluster instance and related equipment provided in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A method for backing up a business cluster instance, characterized in that, include: Identify the business cluster instance to be backed up, wherein the business cluster instance includes at least one container group; For each container group, a source persistent volume declaration and a source persistent volume object are set for the container group, and the container group is stored based on the source persistent volume object. The source persistent volume declaration is used to declare the storage attribute information required by the container group, and the source persistent volume object points to the data storage area of ​​the container group. When the business cluster instance meets the backup triggering conditions, for each container group, based on the source persistent volume declaration and source persistent volume object corresponding to the container group, a backup persistent volume declaration and a backup persistent volume object are created for the container group. The backup persistent volume declaration is the persistent volume snapshot declaration, which represents the abstract resource object of the persistent volume snapshot. The backup persistent volume object is the persistent volume snapshot content, which represents the abstract resource object of the persistent volume snapshot content and is associated with the actual backend snapshot storage resource. Based on the source persistent volume object, obtain the data to be backed up for the container group; For each container group, based on the backup persistent volume declaration corresponding to the container group, the data to be backed up for the container group is backed up to the storage area pointed to by the backup persistent volume object, so as to realize the data backup of each container group in the business cluster instance.

2. The method according to claim 1, characterized in that, For each container group, based on the backup persistent volume declaration corresponding to the container group, the step of backing up the data to be backed up to the storage area pointed to by the backup persistent volume object includes: For each container group, establish a binding relationship between the backup persistent volume declaration and the backup persistent volume object for that container group; Based on the backup persistent volume declaration corresponding to the container group and the binding relationship, the data to be backed up in the container group is backed up to the storage area pointed to by the backup persistent volume object.

3. The method according to claim 2, characterized in that, The process of establishing a binding relationship between the backup persistent volume declaration and the backup persistent volume object for each container group includes: For each container group, obtain the object attribute identifier of the backup persistent volume object of the container group; The object attribute identifier is written into the configuration information of the backup persistent volume declaration of the container group, so as to establish a binding relationship between the backup persistent volume declaration and the backup persistent volume object of the container group.

4. The method according to claim 1, characterized in that, The step of setting a source persistent volume declaration and a source persistent volume object for each container group, and storing the container group based on the source persistent volume object, includes: For each container group, set a source persistent volume declaration corresponding to the container group. The source persistent volume declaration includes the storage capacity and file system type required by the container group. Get the collection of persistent volume objects that are currently available; Select a source persistent volume object from the persistent volume object set that matches the storage capacity and the file system type, and establish a binding relationship between the selected source persistent volume object and the source persistent volume declaration; Based on the source persistent volume declaration and the binding relationship, the data of the container group is stored in the data storage area pointed to by the source persistent volume object.

5. The method according to claim 1, characterized in that, The business cluster instance includes at least one business component, and the business component includes at least one container group; The step of obtaining the data to be backed up for the container group based on the source persistent volume object includes: Based on the instance address information in the source persistent volume object of the container group, the instance data storage area of ​​the business cluster instance to which the container group belongs is determined; Based on the component address information in the source persistent volume object of the container group, the component data storage area of ​​the business component to which the container group belongs is determined from the instance data storage area; Based on the container group address information in the source persistent volume object of the container group, determine the data storage area of ​​the container group from the component data storage area; Retrieve the data to be backed up from the container group in the data storage area.

6. The method according to claim 1, characterized in that, The method further includes: Analyze the resource reference relationships of the business cluster instance to determine the dependent resources of the business cluster instance; The dependent resources are backed up.

7. The method according to claim 1, characterized in that, When the service cluster instance meets the backup triggering condition, for each container group, based on the source persistent volume declaration and source persistent volume object corresponding to the container group, a backup persistent volume declaration and a backup persistent volume object are created, including: When it is detected that the business cluster instance has been deleted and is in backup startup state, for each container group, a backup persistent volume declaration and a backup persistent volume object corresponding to the container group are created based on the source persistent volume declaration and source persistent volume object corresponding to the container group.

8. The method according to claim 1, characterized in that, When the service cluster instance meets the backup triggering condition, for each container group, based on the source persistent volume declaration and source persistent volume object corresponding to the container group, a backup persistent volume declaration and a backup persistent volume object are created, including: When the current time meets the backup trigger time condition of the business cluster instance, for each container group, create the corresponding backup persistent volume declaration and backup persistent volume object based on the source persistent volume declaration and source persistent volume object of the container group.

9. A method for recovering a business cluster instance, characterized in that, include: When an instance recovery request for a business cluster instance is received, the backup data of each container group in the business cluster instance is obtained. For each container group, based on the backup data of the container group, a target backup persistent volume declaration and a target backup persistent volume object are created for the container group. The target backup persistent volume declaration is used to declare the storage attribute information required by the container group, and the target backup persistent volume object points to the storage area of ​​the backup data of the container group. Based on the target backup persistent volume declaration and the target backup persistent volume object, create the target persistent volume declaration and target persistent volume object corresponding to the container group; the target persistent volume declaration is a request for storage resources; the target persistent volume object is an abstraction of storage resources, representing the storage abstraction of the underlying hard disk, and is associated with the actual hard disk; Based on the target persistent volume declaration and target persistent volume object corresponding to the container group, run the container group to resume operation of each container group in the business cluster instance.

10. The method according to claim 9, characterized in that, The step of running the container group according to the target persistent volume declaration and target persistent volume object corresponding to the container group to restore the operation of each container group in the business cluster instance includes: Bind the target persistent volume declaration and target persistent volume object corresponding to the container group; When the target persistent volume declaration and the target persistent volume object are bound to each other, the container group is run to resume operation of each container group in the business cluster instance.

11. The method according to claim 10, characterized in that, The step of binding the target persistent volume declaration and the target persistent volume object corresponding to the container group includes: Obtain the object attribute identifier of the target persistent volume object of the container group; The object attribute identifier is written into the configuration information of the target persistent volume declaration corresponding to the container group, so that the target persistent volume declaration and the target persistent volume object are bound together.

12. The method according to claim 9, characterized in that, The backup data of the container group is located in the first storage area, and the instance recovery request indicates that the business cluster instance be recovered in the second storage area. For each container group, based on the backup data of the container group, the creation of a target backup persistent volume declaration and a target backup persistent volume object corresponding to the container group includes: For each container group, based on the backup data of the container group, create an initial backup persistent volume object and a target backup persistent volume declaration in the second storage area; Based on the target backup persistent volume declaration, the binding declaration information in the initial backup persistent volume object is updated to obtain the target backup persistent volume object.

13. The method according to claim 9, characterized in that, The step of running the container group according to the target persistent volume declaration and target persistent volume object corresponding to the container group to restore the operation of each container group in the business cluster instance includes: Obtain backup data corresponding to the dependent resources of the business cluster instance; Based on the backup data corresponding to the dependent resources, the target persistent volume declaration and the target persistent volume object corresponding to the container group, the container group is run to restore the operation of each container group in the business cluster instance.

14. A backup device for a business cluster instance, characterized in that, include: A determining unit is used to determine the business cluster instance to be backed up, wherein the business cluster instance includes at least one container group; A storage unit is used to set a source persistent volume declaration and a source persistent volume object for each container group, and to store the container group based on the source persistent volume object. The source persistent volume declaration is used to declare the storage attribute information required by the container group, and the source persistent volume object points to the data storage area of ​​the container group. The first creation unit is used to create a backup persistent volume declaration and a backup persistent volume object corresponding to each container group when the business cluster instance meets the backup triggering conditions. The backup persistent volume declaration is a persistent volume snapshot declaration, which represents an abstract resource object of a persistent volume snapshot. The backup persistent volume object is a persistent volume snapshot content, which represents an abstract resource object of persistent volume snapshot content and is associated with the actual backend snapshot storage resource. The first acquisition unit is used to acquire the data to be backed up of the container group based on the source persistent volume object; The backup unit is used to back up the data to be backed up for each container group to the storage area pointed to by the backup persistent volume object, based on the backup persistent volume declaration corresponding to the container group, so as to realize the data backup of each container group in the business cluster instance.

15. The backup device for a business cluster instance according to claim 14, characterized in that, The backup unit includes a first binding subunit and a backup subunit. The first binding subunit is used to establish a binding relationship between the backup persistent volume declaration and the backup persistent volume object of each container group; The backup subunit is used to back up the data to be backed up in the container group to the storage area pointed to by the backup persistent volume object, based on the backup persistent volume declaration corresponding to the container group and the binding relationship.

16. The backup device for a business cluster instance according to claim 15, characterized in that, The first binding subunit is specifically used to obtain the object attribute identifier of the backup persistent volume object of the container group for each container group; and write the object attribute identifier into the configuration information of the backup persistent volume declaration of the container group, so as to establish a binding relationship between the backup persistent volume declaration and the backup persistent volume object of the container group.

17. The backup device for a business cluster instance according to claim 14, characterized in that, The storage unit includes a setting subunit, a set acquisition subunit, a creation subunit, and a storage subunit. The setting subunit is used to set the source persistent volume declaration corresponding to each container group, wherein the source persistent volume declaration includes the storage capacity and file system type required by the container group; The collection retrieves a sub-unit, used to retrieve a collection of persistent volume objects that are currently in an available state; A subunit is established to select a source persistent volume object that matches the storage capacity and the file system type from the persistent volume object set, and to establish a binding relationship between the selected source persistent volume object and the source persistent volume declaration; The storage subunit is used to store the data of the container group to the data storage area pointed to by the source persistent volume object according to the source persistent volume declaration and the binding relationship.

18. The backup device for a business cluster instance according to claim 14, characterized in that, The business cluster instance includes at least one business component, and the business component includes at least one container group; The first acquisition unit includes a first determining subunit, a second determining subunit, a third determining subunit, and a data acquisition subunit; The first determining subunit is used to determine the instance data storage area of ​​the business cluster instance to which the container group belongs, based on the instance address information in the source persistent volume object of the container group; The second determining subunit is used to determine the component data storage area of ​​the business component to which the container group belongs from the instance data storage area based on the component address information in the source persistent volume object of the container group; The third determining subunit is used to determine the data storage area of ​​the container group from the component data storage area based on the container group address information in the source persistent volume object of the container group; The data acquisition subunit is used to acquire the data to be backed up from the data storage area of ​​the container group.

19. The backup device for a business cluster instance according to claim 14, characterized in that, The backup device for the business cluster instance also includes a dependent resource backup unit. The dependent resource backup unit is used to analyze the resource reference associations of the business cluster instance and determine the dependent resources of the business cluster instance. The dependent resources are backed up.

20. The backup device for a business cluster instance according to claim 14, characterized in that, The first creation unit is specifically used to create a backup persistent volume declaration and a backup persistent volume object corresponding to each container group when it is detected that the business cluster instance has been deleted and is in a backup startup state.

21. The backup device for a business cluster instance according to claim 14, characterized in that, The first creation unit is specifically used to create a backup persistent volume declaration and a backup persistent volume object corresponding to the container group for each container group when the current time meets the backup trigger time condition of the business cluster instance.

22. A recovery device for a business cluster instance, characterized in that, include: The second acquisition unit is used to acquire backup data of each container group in the business cluster instance when it receives an instance recovery request for the business cluster instance. The second creation unit is used to create a target backup persistent volume declaration and a target backup persistent volume object for each container group based on the backup data of the container group. The target backup persistent volume declaration is used to declare the storage attribute information required by the container group, and the target backup persistent volume object points to the storage area of ​​the backup data of the container group. The third creation unit is used to create a target persistent volume declaration and a target persistent volume object corresponding to the container group based on the target backup persistent volume declaration and the target backup persistent volume object; the target persistent volume declaration is a request for storage resources; the target persistent volume object is an abstraction of storage resources, representing the storage abstraction of the underlying hard disk and associating with the actual hard disk; The running unit is used to run the container group according to the target persistent volume declaration and target persistent volume object corresponding to the container group, so as to restore the operation of each container group in the business cluster instance.

23. The recovery device for a service cluster instance according to claim 22, characterized in that, The operating unit includes a second binding subunit and an operating subunit. The second binding subunit is used to bind the target persistent volume declaration and the target persistent volume object corresponding to the container group; The running subunit is used to run the container group when the target persistent volume declaration and the target persistent volume object are bound to each other, so as to resume the operation of each container group in the business cluster instance.

24. The recovery device for a service cluster instance according to claim 23, characterized in that, The second binding subunit is specifically used to obtain the object attribute identifier of the target persistent volume object of the container group; and write the object attribute identifier into the configuration information of the target persistent volume declaration corresponding to the container group, so as to establish a binding relationship between the target persistent volume declaration and the target persistent volume object.

25. The recovery device for a service cluster instance according to claim 22, characterized in that, The backup data of the container group is located in the first storage area, and the instance recovery request indicates that the business cluster instance be recovered in the second storage area. The second creation unit includes a creation sub-unit and an update sub-unit. The creation subunit is used to create, for each container group, an initial backup persistent volume object and a target backup persistent volume declaration in the second storage area, based on the backup data of the container group. The update subunit is used to update the binding declaration information in the initial backup persistent volume object based on the target backup persistent volume declaration, so as to obtain the target backup persistent volume object.

26. The recovery device for a service cluster instance according to claim 22, characterized in that, The operation unit includes a resource acquisition subunit and an instance execution subunit. The dependent resource acquisition subunit is used to acquire backup data corresponding to the dependent resources of the business cluster instance; The instance running subunit is used to run the container group based on the backup data corresponding to the dependent resources, the target persistent volume declaration and the target persistent volume object corresponding to the container group, so as to restore the operation of each container group in the business cluster instance.

27. An electronic device, characterized in that, It includes a memory and a processor; the memory stores an application program, and the processor is used to run the application program in the memory to perform the operations in the backup method of the business cluster instance according to any one of claims 1 to 8 or the recovery method of the business cluster instance according to any one of claims 9 to 13.

28. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a plurality of instructions adapted for loading by a processor to perform steps in the backup method of the service cluster instance according to any one of claims 1 to 8 or the recovery method of the service cluster instance according to any one of claims 9 to 13.

29. A computer program product comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by a processor, they implement the steps of the backup method for a business cluster instance as described in any one of claims 1 to 8 or the recovery method for a business cluster instance as described in any one of claims 9 to 13.

Citation Information

Patent Citations

  • Method and system for quickly recovering data based on Kubernetes cluster

    CN111338854A

  • Automatic backup method based on LVM snapshot in cloud native environment

    CN113391952A