Disaster recovery backup method and device for container application data, medium and equipment

Verifying and managing container application data in a distributed key-value storage system through a custom resource controller, providing full, on-demand and timed backup methods, solving the problem that traditional backup solutions cannot adapt to cloud-native containerized scenarios, and achieving flexible Data backup and recovery.

CN119248565APending Publication Date: 2025-01-03SHANDONG LANGCHAO YUNTOU INFORMATION TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410712521.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-04
Publication Date
2025-01-03

AI Technical Summary

Technical Problem

Traditional data backup solutions cannot adapt to containerized, elastic and pooled deployment scenarios in the cloud native era, and lack flexibility and adaptability.

Method used

Verify and manage container application data in a distributed key-value storage system through a custom resource controller, provide full, on-demand and timed backup methods, and store backup objects in the cloud object storage system, supporting users to configure backup requirements.

Benefits of technology

It realizes flexible data backup and recovery in containerized scenarios, adapts to elastic and pooled deployment needs, and improves the flexibility and applicability of backup and recovery.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119248565A_ABST
    Figure CN119248565A_ABST
Patent Text Reader

Abstract

The invention provides a disaster recovery backup method and device for container application data, a medium and equipment, and the method comprises the steps: verifying a first custom resource when capturing that the first custom resource is newly added in a distributed key value storage system; after the verification is passed, determining a backup mode corresponding to the first user-defined resource; wherein the backup mode comprises a full-amount backup mode, an on-demand backup mode and a timing backup mode; determining a backup opportunity and a backup object according to the backup mode; wherein the backup object is a K8s cluster resource which needs to be backed up; and executing the first custom resource according to the backup opportunity and the backup object so as to query the backup object from the K8s interface server when the backup opportunity arrives, and backing up the queried backup object to a cloud object storage system. The embodiment of the invention is more flexible, and is favorable for adapting to deployment scenes such as flexibility and pooling after containerization.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of cloud native technology, and in particular to a disaster recovery backup method, device, medium, and equipment for container application data. Background Art

[0002] There are two main traditional data backup solutions: one is to use the server that stores data to implement snapshot-based backup; the other is to deploy a dedicated backup agent on each target server, specify a backup data directory, and regularly copy the data in the directory to an external storage system. The backup mechanisms of these two methods are relatively rigid and cannot adapt to deployment scenarios such as elasticity and pooling after containerization in the cloud-native era. Summary of the invention

[0003] In view of at least one of the above technical problems, an embodiment of the present invention provides a disaster recovery backup method and apparatus, medium, and equipment for container application data.

[0004] According to the first aspect, the disaster recovery backup method for container application data provided by the embodiment of the present invention is executed by a custom resource controller, and the method includes:

[0005] When a newly added first custom resource is captured in the distributed key-value storage system, the first custom resource is verified; wherein the client generates the first creation request corresponding to the first custom resource according to the user's backup requirements, and sends the first creation request to the K8s interface server, so that the K8s interface server creates the corresponding first custom resource according to the first creation request, and stores the first custom resource in the distributed key-value storage system, and the first custom resource is a backup operation;

[0006] After the verification is passed, the backup mode corresponding to the first custom resource is determined; wherein the backup mode includes a full backup mode, an on-demand backup mode, and a scheduled backup mode;

[0007] According to the backup method, determine the backup timing and backup object; wherein the backup object is the K8s cluster resource that needs to be backed up;

[0008] According to the backup timing and the backup object, the first custom resource is executed to query the K8s interface server for the backup object when the backup timing arrives, and back up the queried backup object to the cloud object storage system.

[0009] In one embodiment, the on-demand backup method includes a method for backing up objects of a preset type, a method for backing up objects of a preset namespace, or a method for backing up objects with preset tags; and / or, the user backup requirement is transmitted to the client via command line input or an interface call.

[0010] In one embodiment, the method provided by the embodiment of the present invention further includes:

[0011] Receive a backup command for the persistent volume;

[0012] Creating a disk snapshot of the persistent volume according to the backup command;

[0013] The disk snapshot is stored in the cloud object storage system.

[0014] In one embodiment, the method provided by the embodiment of the present invention further includes:

[0015] When a newly added second custom resource is captured in the distributed key-value storage system, the second custom resource is verified; wherein the client generates the second creation request corresponding to the second custom resource according to the user recovery requirement, and sends the second creation request to the K8s interface server, so that the K8s interface server creates the corresponding second custom resource according to the second creation request, and stores the second custom resource in the distributed key-value storage system, and the first custom resource is a recovery operation;

[0016] After the verification is passed, the recovery mode corresponding to the second custom resource is determined; wherein the backup mode includes a full recovery mode, an on-demand recovery mode, and a scheduled recovery mode;

[0017] Determine the recovery time and recovery object according to the recovery method, and determine the target K8s cluster; wherein the recovery object is the K8s cluster resource that needs to be recovered;

[0018] According to the recovery timing, the recovery object and the target K8s cluster, the second custom resource is executed to copy the recovery object in the cloud object storage system to the target K8s cluster when the recovery timing arrives.

[0019] In one embodiment, before executing the second custom resource, the method further includes:

[0020] Determine the API version of the recovery object;

[0021] Verify whether the API version is compatible with the target K8s cluster;

[0022] If so, executing the second custom resource.

[0023] In one embodiment, executing the second custom resource includes:

[0024] Changing the cloud object storage system to a read-only mode; wherein the default configuration of the cloud object storage system is a read-write mode;

[0025] In the read-only mode, executing the second custom resource;

[0026] After the execution is completed, the cloud object storage system is restored to the read-write mode.

[0027] In one embodiment, executing the second custom resource includes:

[0028] Determine the recovery mode of the target K8s cluster; wherein the recovery mode includes a non-destructive recovery mode and a recovery mode based on an update strategy;

[0029] If the recovery mode is the non-destructive recovery mode and a recovery object already exists in the target K8s cluster, the recovery operation of the recovery object is skipped;

[0030] If the recovery mode is the update policy-based recovery mode, and a recovery object already exists in the target K8s cluster, the recovery object in the cloud object storage system is used to overwrite the recovery object already existing in the target K8s cluster.

[0031] According to the second aspect, a disaster recovery backup device for container application data provided by an embodiment of the present invention is deployed on a custom resource controller, and the device includes:

[0032] A first capture module is used to verify the first custom resource when a new first custom resource is captured in the distributed key-value storage system; wherein the client generates the first creation request corresponding to the first custom resource according to the user's backup requirements, and sends the first creation request to the K8s interface server, so that the K8s interface server creates the corresponding first custom resource according to the first creation request, and stores the first custom resource in the distributed key-value storage system, and the first custom resource is a backup operation;

[0033] A first determination module, configured to determine a backup mode corresponding to the first custom resource after verification; wherein the backup mode includes a full backup mode, an on-demand backup mode, and a scheduled backup mode;

[0034] The second determination module is used to determine the backup timing and backup object according to the backup method; wherein the backup object is the K8s cluster resource that needs to be backed up;

[0035] The backup operation module is used to execute the first custom resource according to the backup timing and the backup object, so as to query the backup object from the K8s interface server when the backup timing arrives, and back up the queried backup object to the cloud object storage system.

[0036] According to a third aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, enables the computer to execute the method provided in the first aspect.

[0037] According to a fourth aspect, an embodiment of the present invention provides a computing device, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method provided in the first aspect is implemented.

[0038] In the disaster recovery backup method, device, medium, and equipment for container application data provided by the embodiment of the present invention, the client generates the first creation request corresponding to the first custom resource according to the user's backup requirements, and sends the first creation request to the K8s interface server, and the K8s interface server creates the corresponding first custom resource according to the first creation request, and stores the first custom resource in the distributed key-value storage system. When the custom resource controller captures the newly added first custom resource in the distributed key-value storage system, the first custom resource is verified, and after the verification is passed, the backup method corresponding to the first custom resource is determined, and then the backup time and backup object are determined according to the backup method, and then the first custom resource is executed according to the backup time and the backup object, so as to query the K8s interface server for the backup object when the backup time arrives, and back up the queried backup object to the cloud object storage system. It can be seen that the embodiment of the present invention can perform backup processing according to the user's backup requirements, that is, the user can configure the backup method, and then determine the backup time and backup object. Compared with the backup method in the prior art, the embodiment of the present invention is more flexible and conducive to adapting to the deployment scenarios such as elasticity and pooling after containerization. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 It is a flowchart of a method for disaster recovery backup of container application data in one embodiment of the present invention;

[0040] Figure 2 The present invention is a structural block diagram of a disaster recovery backup device for container application data in one embodiment of the present invention. DETAILED DESCRIPTION

[0041] In a first aspect, an embodiment of the present invention provides a method for disaster recovery backup of container application data, which is executed by a custom resource controller and includes the following steps S110 to S140:

[0042] S110, when a newly added first custom resource is captured in the distributed key-value storage system, verify the first custom resource; wherein the client generates the first creation request corresponding to the first custom resource according to the user's backup requirements, and sends the first creation request to the K8s interface server, so that the K8s interface server creates the corresponding first custom resource according to the first creation request, and stores the first custom resource in the distributed key-value storage system, and the first custom resource is a backup operation;

[0043] That is to say, the user proposes a backup requirement on the client, and the client generates a first creation request corresponding to the first custom resource according to the backup requirement proposed by the user, and then sends the first creation request to the K8s interface server. The K8s interface server creates the first custom resource upon receiving the first creation request, and then sends the first custom resource to the distributed key-value storage system. The custom resource controller monitors the distributed key-value storage system. When the custom resource controller finds that the first custom resource is newly added to the distributed key-value storage system, the custom resource controller verifies the first custom resource. The so-called verification can verify whether there are any errors in the first custom resource, etc.

[0044] Among them, the K8s interface server is the Kubernetes API server.

[0045] The custom resource controller monitors whether a new first custom resource is added to the distributed key-value storage system based on the kuberneteswatch mechanism.

[0046] The first custom resource is a backup operation, that is, the backup operation is defined as the first custom resource.

[0047] S120. After the verification is passed, determine the backup mode corresponding to the first custom resource; wherein the backup mode includes a full backup mode, an on-demand backup mode, and a scheduled backup mode;

[0048] Among them, the full backup method refers to the method of performing a full backup of the kubernetes cluster resources.

[0049] Among them, the on-demand backup method refers to a method of selecting a part of the data from the kubernetes cluster resources for backup as needed.

[0050] Among them, the scheduled backup method refers to the method of performing full backup or on-demand backup of Kubernetes cluster resources at regular intervals.

[0051] In one embodiment, the on-demand backup method may include a method for backing up objects of a preset type, a method for backing up objects of a preset namespace, or a method for backing up objects with preset tags; and / or, the user backup requirement is transmitted to the client via command line input or an interface call.

[0052] The on-demand backup method can match the resources to be backed up by specifying relevant parameters. The selector parameter can be used to match resource tags, and the include-namespaces parameter can be used to specify the namespace where the resources to be backed up are located.

[0053] Among them, the scheduled backup method implements regular data backup. Users can create backup requirements at any time, and then perform backups at specified intervals according to the plan. The time interval is specified by the Cron expression.

[0054] It can be seen that you can select specific types of objects for backup, objects in a specific namespace, and objects with specific labels. The so-called objects refer to Kubernetes cluster resources.

[0055] The user can input his / her backup requirements in the command line or pass his / her backup requirements to the client by calling the interface.

[0056] S130. Determine the backup timing and backup object according to the backup method; wherein the backup object is the K8s cluster resource that needs to be backed up;

[0057] The backup timing refers to the time point when the backup operation is performed. If it is not a scheduled backup mode, the backup timing is immediate. If it is a scheduled backup mode, the backup timing is a time point determined by the time interval.

[0058] If the backup method is full, the backup object is the full data of the K8s cluster resources. If the backup method is on-demand, the backup object is the data in the K8s cluster resources that meets the user's needs.

[0059] S140. Execute the first custom resource according to the backup timing and the backup object, so as to query the K8s interface server for the backup object when the backup timing arrives, and back up the queried backup object to the cloud object storage system.

[0060] That is to say, the first custom resource is executed, so that when the backup time comes, the K8s interface server is queried for the backup object, and then the queried backup object is backed up to the cloud object storage system.

[0061] It can be seen that data backup can be achieved through the above steps S110 to S140.

[0062] In one embodiment, the method provided by the embodiment of the present invention may further include:

[0063] Receive a backup command for the persistent volume;

[0064] Creating a disk snapshot of the persistent volume according to the backup command;

[0065] The disk snapshot is stored in the cloud object storage system.

[0066] That is to say, the user can enter the backup command in the command line. After the custom resource controller receives the backup command, it will create a disk snapshot of the persistent volume and then store the disk snapshot in the cloud object storage system, thereby backing up the persistent volume.

[0067] Of course, users can adjust snapshots by specifying parameters. For example, the option snapshot volumes = true can be used to enable the snapshot backup function, or the option snapshot volumes = false can be used to disable the snapshot.

[0068] The storage location of the backup object in the distributed key-value storage system can be defined by using the parameters BackupStorageLocation and VolumeSnapshotLocation.

[0069] The cloud object storage system may be an S3-compatible storage system, Azure Blob, Google Cloud storage, or Aliyun OSS, etc.

[0070] Among them, Etcd is a highly available distributed key-value storage system, mainly used for sharing configuration information and service discovery. It can ensure strong consistency of data and support monitoring and updating of data.

[0071] In one embodiment, the method provided by the embodiment of the present invention may further include S210 to S240:

[0072] S210, when a newly added second custom resource is captured in the distributed key-value storage system, verifying the second custom resource; wherein the client generates the second creation request corresponding to the second custom resource according to the user recovery requirement, and sends the second creation request to the K8s interface server, so that the K8s interface server creates the corresponding second custom resource according to the second creation request, and stores the second custom resource in the distributed key-value storage system, and the first custom resource is a recovery operation;

[0073] S220. After the verification is passed, determine the recovery mode corresponding to the second custom resource; wherein the backup mode includes a full recovery mode, an on-demand recovery mode, and a scheduled recovery mode;

[0074] S230. Determine the recovery timing and recovery object according to the recovery method, and determine the target K8s cluster; wherein the recovery object is the K8s cluster resource that needs to be recovered;

[0075] S240. Execute the second custom resource according to the recovery timing, the recovery object and the target K8s cluster, so as to copy the recovery object in the cloud object storage system to the target K8s cluster when the recovery timing arrives.

[0076] Among them, the so-called recovery can also be called restoration.

[0077] That is to say, when the user enters his recovery requirements on the client, the client will generate a second creation request based on the recovery requirements, send the second creation request to the K8s interface server, and the K8s interface server will create a second custom resource based on the second creation request, and then store the second custom resource in the distributed key-value storage system. When the custom resource controller monitors the addition of the second custom resource in the distributed key-value storage system, it verifies the second custom resource to verify whether there is an error in the second custom resource, etc. After the verification is passed, the recovery method of the second custom resource is determined, whether it is full recovery or on-demand recovery, whether it is scheduled recovery, etc., and then the recovery time and recovery object are determined. Among them, if it is not a scheduled recovery, the recovery time is immediate. If it is a scheduled recovery method, the time point of recovery needs to be determined according to the time interval. According to whether it is a full recovery or an on-demand recovery, determine which data needs to be recovered, that is, determine the recovery object. In addition, the second custom resource also includes a target K8s cluster, that is, to which K8s cluster the recovery object is copied. After determining the recovery time, recovery object and target K8s cluster, execute the second custom resource, so that when the recovery time arrives, the recovery object in the cloud object storage system is copied to the target K8s cluster to achieve data recovery.

[0078] In one embodiment, before executing the second custom resource, the method further includes:

[0079] Determine the API version of the recovery object;

[0080] Verify whether the API version is compatible with the target K8s cluster;

[0081] If so, executing the second custom resource.

[0082] That is to say, the API version of the restored object in the cloud object storage system must be determined first. If the API version is compatible with the target K8s cluster, the second custom resource is executed. After the restoration, it is ensured that the restored object can be run on the target K8s cluster. If the API version is not compatible with the target K8s cluster, the restoration operation cannot be performed. Therefore, even if the restoration operation is performed, the restored object cannot be run on the target K8s cluster.

[0083] In one embodiment, the executing the second custom resource may include A1-A3:

[0084] A1. Change the cloud object storage system to read-only mode; wherein the default configuration of the cloud object storage system is read-write mode;

[0085] A2. Execute the second custom resource in the read-only mode;

[0086] A3. After the execution is completed, the cloud object storage system is restored to the read-write mode.

[0087] It is understandable that by default, the cloud object storage system is in read-write mode, but during recovery, the cloud object storage system is changed to read-only mode, which prohibits the creation or deletion of backup data in the cloud object storage system, helping to ensure that no backup data is inadvertently created or deleted in the restore scenario.

[0088] In one embodiment, the executing the second custom resource may include B1-B3:

[0089] B1. Determine the recovery mode of the target K8s cluster; wherein the recovery mode includes a non-destructive recovery mode and a recovery mode based on an update strategy;

[0090] B2. If the recovery mode is the non-destructive recovery mode and a recovery object already exists in the target K8s cluster, skip the recovery operation of the recovery object;

[0091] B3. If the recovery mode is the update strategy-based recovery mode and a recovery object already exists in the target K8s cluster, the recovery object in the cloud object storage system is used to overwrite the recovery object already existing in the target K8s cluster.

[0092] That is to say, there are two recovery modes in the recovery process, one is non-destructive recovery mode, and the other is recovery mode based on update strategy. In non-destructive recovery mode, if a recovery object already exists in the target K8s cluster, then the recovery operation of this recovery object is skipped, and the recovery mode of the next recovery object is determined. If the recovery mode based on update strategy is adopted, then if a recovery object already exists in the target K8s cluster, then the corresponding recovery object in the target K8s cluster will be overwritten.

[0093] In one embodiment, the persistent volume can be restored by integrating an open source backup tool named restic. The open source backup tool restic can be used to restore almost any type of persistent volume, and is applicable to any volume type that does not have a native snapshot concept or requires a volume snapshot plug-in of the storage platform, such as NFS, emptyDir, and local. Restic is not bound to a specific storage platform.

[0094] It can be seen that the data objects and persistent volumes in K8s can be restored through the recovery operation.

[0095] Among them, the on-demand recovery method can match the resources that need to be backed up by specifying relevant parameters. Among them, the resource label can be matched through the selector parameter, and the namespace namespace to be restored can be specified through the include-namespaces parameter. It also supports remapping of multiple namespaces. For example, in a restore, objects in namespaces "a, b, c" can be recreated under namespaces "d, e, f".

[0096] The default name after recovery is <BACKUP name>-<TIMESTAMP>, where the format of <TIMETAMP> is YYYMMDDhhmmss. Of course, you can also specify a custom name.

[0097] It is understandable that the embodiment of the present invention can achieve data recovery of a kubernetes cluster when data loss occurs in the kubernetes cluster. It can also achieve data migration of a kubernetes cluster to other kubernetes clusters, and can indeed achieve cluster data migration of a production environment to a cluster of a development environment or a test environment.

[0098] In an embodiment of the present invention, each operation is defined as a custom resource. For example, on-demand backup, scheduled backup or recovery is defined as a custom resource. The custom resource is executed by a custom resource controller to implement backup and recovery in the Kubernetes controller mode.

[0099] It can be seen that the embodiments of the present invention mainly involve two core components, namely the server and the client. The server runs in the Kubernetes cluster, the client is a command line tool running locally, and the custom resource controller is deployed on the server. Based on the Kubernetes resource backup capability, data backup and recovery of the Kubernetes cluster can be easily achieved, where the recovery can be to restore the resources of a Kubernetes cluster to another Kubernetes cluster, or to restore from the production environment to the test environment or application environment. Compared with the data storage engine etcd that backs up the entire Kubernetes cluster, the embodiments of the present invention can realize backup or recovery in a more detailed manner, and can realize the backup or recovery of data objects with different labels, different namespaces or different categories as required.

[0100] The method provided by the embodiment of the present invention supports data backup and recovery under multiple CPU architectures and multiple scenarios, and can greatly facilitate the disaster recovery and backup of data in the public cloud, private cloud, and hybrid cloud of cloud vendors. The specific effects are as follows: (1) A hot-swappable method is implemented through custom resources to manage backup and recovery operations, which has strong scalability, supports fault tolerance, and is flexible and convenient to use. (2) The method provided by the embodiment of the present invention is very suitable for disaster recovery backup or recovery, and for capturing application status before performing system operations on the cluster. (3) The client supports both command line and API call methods to input backup or recovery requirements, and has strong applicability. (4) The overall backup of cluster data is realized, and backup can also be performed on demand, with flexible backup methods. (5) The restic backup tool can be integrated to realize the backup and recovery of almost any type of Kubernetes persistent volume.

[0101] In summary, the client generates the first creation request corresponding to the first custom resource according to the user's backup requirements, and sends the first creation request to the K8s interface server. The K8s interface server creates the corresponding first custom resource according to the first creation request, and stores the first custom resource in the distributed key-value storage system. When the custom resource controller captures the newly added first custom resource in the distributed key-value storage system, it verifies the first custom resource. After the verification is passed, it determines the backup method corresponding to the first custom resource, and then determines the backup time and backup object according to the backup method, and then executes the first custom resource according to the backup time and the backup object, so as to query the backup object from the K8s interface server when the backup time arrives, and back up the queried backup object to the cloud object storage system. It can be seen that the embodiment of the present invention can perform backup processing according to the user's backup requirements, that is, the user can configure the backup method, and then determine the backup time and backup object. Compared with the backup method in the prior art, the embodiment of the present invention is more flexible and is conducive to adapting to the deployment scenarios such as elasticity and pooling after containerization.

[0102] In a second aspect, an embodiment of the present invention provides a disaster recovery backup device for container application data, wherein the device is deployed on a custom resource controller, see Figure 2 , the device 100 comprises:

[0103] The first capture module 110 is used to verify the first custom resource when the first custom resource is newly added in the distributed key-value storage system; wherein the client generates the first creation request corresponding to the first custom resource according to the user's backup requirements, and sends the first creation request to the K8s interface server, so that the K8s interface server creates the corresponding first custom resource according to the first creation request, and stores the first custom resource in the distributed key-value storage system, and the first custom resource is a backup operation;

[0104] A first determination module 120 is used to determine the backup mode corresponding to the first custom resource after the verification is passed; wherein the backup mode includes a full backup mode, an on-demand backup mode, and a scheduled backup mode;

[0105] The second determination module 130 is used to determine the backup timing and backup object according to the backup method; wherein the backup object is the K8s cluster resource that needs to be backed up;

[0106] The backup operation module 140 is used to execute the first custom resource according to the backup timing and the backup object, so as to query the backup object from the K8s interface server when the backup timing arrives, and back up the queried backup object to the cloud object storage system.

[0107] In one embodiment, the on-demand backup method includes a method for backing up objects of a preset type, a method for backing up objects of a preset namespace, or a method for backing up objects with preset tags; and / or, the user backup requirement is transmitted to the client via command line input or an interface call.

[0108] In one embodiment, the apparatus provided by the embodiment of the present invention may further include:

[0109] A first receiving module, configured to receive a backup command for a persistent volume;

[0110] A first creation module, used to create a disk snapshot of the persistent volume according to the backup command;

[0111] The first storage module is used to store the disk snapshot in the cloud object storage system.

[0112] In one embodiment, the apparatus provided by the embodiment of the present invention may further include:

[0113] A second capture module is used to verify the second custom resource when a new second custom resource is captured in the distributed key-value storage system; wherein the client generates the second creation request corresponding to the second custom resource according to the user's recovery requirements, and sends the second creation request to the K8s interface server, so that the K8s interface server creates the corresponding second custom resource according to the second creation request, and stores the second custom resource in the distributed key-value storage system, and the first custom resource is a recovery operation;

[0114] A third determination module is used to determine the recovery mode corresponding to the second custom resource after the verification is passed; wherein the backup mode includes a full recovery mode, an on-demand recovery mode and a scheduled recovery mode;

[0115] The fourth determination module is used to determine the recovery time and recovery object according to the recovery method, and determine the target K8s cluster; wherein the recovery object is the K8s cluster resource that needs to be restored;

[0116] The recovery processing module is used to execute the second custom resource according to the recovery timing, the recovery object and the target K8s cluster, so as to copy the recovery object in the cloud object storage system to the target K8s cluster when the recovery timing arrives.

[0117] In one embodiment, the recovery processing module is specifically used to: determine the API version of the recovery object; verify whether the API version is compatible with the target K8s cluster; if so, execute the second custom resource.

[0118] In one embodiment, the recovery processing module is specifically used to: change the cloud object storage system to read-only mode; wherein the default configuration of the cloud object storage system is read-write mode; in the read-only mode, execute the second custom resource; after execution, restore the cloud object storage system to the read-write mode.

[0119] In one embodiment, the recovery processing module is specifically used to: determine the recovery mode of the target K8s cluster; wherein the recovery mode includes a non-destructive recovery mode and an update policy-based recovery mode; if the recovery mode is the non-destructive recovery mode, and a recovery object already exists in the target K8s cluster, then the recovery operation of the recovery object is skipped; if the recovery mode is the update policy-based recovery mode, and a recovery object already exists in the target K8s cluster, then the recovery object in the cloud object storage system is used to overwrite the recovery object already existing in the target K8s cluster.

[0120] It is understandable that the explanation, specific implementation, beneficial effects, examples, etc. of the relevant contents in the device provided in the embodiment of the present invention can be found in the corresponding parts of the method provided in the first aspect, and will not be repeated here.

[0121] In a third aspect, an embodiment of the present invention provides a computer-readable medium, on which computer instructions are stored. When the computer instructions are executed by a processor, the processor executes the method provided in the first aspect.

[0122] Specifically, a system or device equipped with a storage medium can be provided, on which software program code that implements the functions of any of the above-mentioned embodiments is stored, and a computer (or CPU or MPU) of the system or device can be enabled to read and execute the program code stored in the storage medium.

[0123] In this case, the program code itself read from the storage medium can realize the function of any one of the above-mentioned embodiments, and thus the program code and the storage medium storing the program code constitute a part of the present invention.

[0124] The storage medium embodiments for providing the program code include a floppy disk, a hard disk, a magneto-optical disk, an optical disk (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD+RW), a magnetic tape, a non-volatile memory card, and a ROM. Alternatively, the program code can be downloaded from a server computer by a communication network.

[0125] In addition, it should be clear that the functions of any of the above embodiments can be implemented not only by executing the program code read by the computer, but also by enabling an operating system operating on the computer to complete part or all of the actual operations based on instructions from the program code.

[0126] In addition, it can be understood that the program code read from the storage medium is written to a memory provided in an expansion board inserted into the computer or to a memory provided in an expansion module connected to the computer, and then based on the instructions of the program code, a CPU installed on the expansion board or expansion module is enabled to perform part or all of the actual operations, thereby realizing the functions of any of the above-mentioned embodiments.

[0127] It is understandable that the explanation, specific implementation methods, beneficial effects, examples, etc. of the relevant contents in the computer-readable medium provided in the embodiment of the present invention can be found in the corresponding parts of the method provided in the first aspect, and will not be repeated here.

[0128] In a fourth aspect, an embodiment of the present specification provides a computing device, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, it implements the method in any embodiment of the specification.

[0129] It is understandable that the explanation, specific implementation, beneficial effects, examples, etc. of the relevant contents in the computing device provided in the embodiment of the present invention can be found in the corresponding parts of the method provided in the first aspect, and will not be repeated here.

[0130] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0131] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the present invention can be implemented by hardware, software, widgets, or any combination thereof. When implemented by software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium.

[0132] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solution of the present invention should be included in the scope of protection of the present invention.

Claims

1. A method for disaster recovery backup of container application data, characterized in that: Executed by a custom resource controller, the method includes: When a newly added first custom resource is captured in the distributed key-value storage system, the first custom resource is verified; wherein the client generates the first creation request corresponding to the first custom resource according to the user's backup requirements, and sends the first creation request to the K8s interface server, so that the K8s interface server creates the corresponding first custom resource according to the first creation request, and stores the first custom resource in the distributed key-value storage system, and the first custom resource is a backup operation; After the verification is passed, the backup mode corresponding to the first custom resource is determined; wherein the backup mode includes a full backup mode, an on-demand backup mode, and a scheduled backup mode; According to the backup method, determine the backup timing and backup object; wherein the backup object is the K8s cluster resource that needs to be backed up; According to the backup timing and the backup object, the first custom resource is executed to query the K8s interface server for the backup object when the backup timing arrives, and back up the queried backup object to the cloud object storage system.

2. The method according to claim 1, characterized in that The on-demand backup method includes a method of backing up objects of a preset type, a method of backing up objects of a preset namespace, or a method of backing up objects with preset tags; And / or, the user backup requirement is transmitted to the client by way of command line input or by way of calling an interface.

3. The method according to claim 1, characterized in that Also includes: Receive a backup command for the persistent volume; Creating a disk snapshot of the persistent volume according to the backup command; The disk snapshot is stored in the cloud object storage system.

4. The method according to claim 1, characterized in that Also includes: When a newly added second custom resource is captured in the distributed key-value storage system, the second custom resource is verified; wherein the client generates the second creation request corresponding to the second custom resource according to the user recovery requirement, and sends the second creation request to the K8s interface server, so that the K8s interface server creates the corresponding second custom resource according to the second creation request, and stores the second custom resource in the distributed key-value storage system, and the first custom resource is a recovery operation; After the verification is passed, the recovery mode corresponding to the second custom resource is determined; wherein the backup mode includes a full recovery mode, an on-demand recovery mode, and a scheduled recovery mode; Determine the recovery time and recovery object according to the recovery method, and determine the target K8s cluster; wherein the recovery object is the K8s cluster resource that needs to be recovered; According to the recovery timing, the recovery object and the target K8s cluster, the second custom resource is executed to copy the recovery object in the cloud object storage system to the target K8s cluster when the recovery timing arrives.

5. The method according to claim 4, characterized in that Before executing the second custom resource, the method further includes: Determine the API version of the recovery object; Verify whether the API version is compatible with the target K8s cluster; If so, executing the second custom resource.

6. The method according to claim 4, characterized in that The executing the second custom resource includes: Changing the cloud object storage system to a read-only mode; wherein the default configuration of the cloud object storage system is a read-write mode; In the read-only mode, executing the second custom resource; After the execution is completed, the cloud object storage system is restored to the read-write mode.

7. The method according to claim 4, characterized in that The executing the second custom resource includes: Determine the recovery mode of the target K8s cluster; wherein the recovery mode includes a non-destructive recovery mode and a recovery mode based on an update strategy; If the recovery mode is the non-destructive recovery mode and a recovery object already exists in the target K8s cluster, the recovery operation of the recovery object is skipped; If the recovery mode is the update policy-based recovery mode, and a recovery object already exists in the target K8s cluster, the recovery object in the cloud object storage system is used to overwrite the recovery object already existing in the target K8s cluster.

8. A disaster recovery backup device for container application data, characterized in that: The device is deployed on a custom resource controller, and includes: A first capture module is used to verify the first custom resource when a new first custom resource is captured in the distributed key-value storage system; wherein the client generates the first creation request corresponding to the first custom resource according to the user's backup requirements, and sends the first creation request to the K8s interface server, so that the K8s interface server creates the corresponding first custom resource according to the first creation request, and stores the first custom resource in the distributed key-value storage system, and the first custom resource is a backup operation; A first determination module, configured to determine a backup mode corresponding to the first custom resource after verification; wherein the backup mode includes a full backup mode, an on-demand backup mode, and a scheduled backup mode; The second determination module is used to determine the backup timing and backup object according to the backup method; wherein the backup object is the K8s cluster resource that needs to be backed up; The backup operation module is used to execute the first custom resource according to the backup timing and the backup object, so as to query the backup object from the K8s interface server when the backup timing arrives, and back up the queried backup object to the cloud object storage system.

9. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed in a computer, the computer is caused to execute the method according to any one of claims 1 to 7.

10. A computing device, characterized in that: The method comprises a memory and a processor, wherein the memory stores executable codes, and when the processor executes the executable codes, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • Remote main and standby cluster disaster recovery control method, device and system based on cloud platform

    CN119854305A