CN115098301B - Snapshot generation method and system for stateful application in cloud primary scene - Google Patents

Snapshot generation method and system for stateful application in cloud primary scene Download PDF

Info

Publication number
CN115098301B
CN115098301B CN202210821925.7A CN202210821925A CN115098301B CN 115098301 B CN115098301 B CN 115098301B CN 202210821925 A CN202210821925 A CN 202210821925A CN 115098301 B CN115098301 B CN 115098301B
Authority
CN
China
Prior art keywords
snapshot
resource file
stateful application
instruction
generation
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210821925.7A
Other languages
Chinese (zh)
Other versions
CN115098301A (en
Inventor
戴秋萍
孙亮
牛乐川
郭峰
颜开
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Daoke Network Technology Co ltd
Original Assignee
Shanghai Daoke Network Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Daoke Network Technology Co ltd filed Critical Shanghai Daoke Network Technology Co ltd
Priority to CN202210821925.7A priority Critical patent/CN115098301B/en
Publication of CN115098301A publication Critical patent/CN115098301A/en
Application granted granted Critical
Publication of CN115098301B publication Critical patent/CN115098301B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45595Network integration; Enabling network access in virtual machine instances
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention discloses a snapshot generation method and a snapshot generation system for stateful application in a cloud primary scene, wherein the snapshot generation method is operated on a snapshot controller and comprises the following steps: after receiving an instruction for generating a snapshot of the stateful application, respectively issuing a first snapshot generating instruction and a second snapshot generating instruction to a container storage interface driver and a resource file snapshot generator; the method comprises the steps of generating a data snapshot of a stateful application at a specified time point, and synchronously generating a resource file snapshot of the stateful application at the specified time point; and after receiving the information of successful generation of the data snapshot and the information of successful generation of the resource file snapshot, determining that the snapshot generation of the stateful application is successful. Therefore, the method and the device realize synchronous generation of the data snapshot and the resource file snapshot of the stateful application at the execution time point, and restore the synchronously generated data snapshot and resource file snapshot when the resource file and the data of the stateful application are damaged, so that the consistency of the restored resource file and data can be ensured.

Description

Snapshot generation method and system for stateful application in cloud primary scene
Technical Field
The invention relates to the technical field of cloud primordia, in particular to a snapshot generation method and a snapshot generation system for stateful application in a cloud primordia scene.
Background
Snapshot is a common function of a storage data volume, and is used for recording data and information stored in the storage data volume at a certain time point, and restoring the storage data volume to a state at the time point when the storage data volume is damaged or has a write-in error, so as to protect the data and information stored in the storage data volume. The Kubernetes system currently only provides a mechanism for generating snapshots of storage data volumes in a back-end storage system. That is, the Kubernetes system is only able to generate snapshots for data generated during the running process of the stateful application, but is unable to generate snapshots for the resource files corresponding to the stateful application.
If the resource file corresponding to the state application and the data generated by operation are damaged, an application manager calls a snapshot restoration method provided by a container storage interface driver in the Kubernetes system to restore the data in the storage data volume corresponding to the state application, and then only manually restore the resource file and bind the resource file with the storage data volume again, but the consistency of the restored resource file and the data cannot be guaranteed, namely the restored resource file and the restored data cannot be guaranteed to be matched, so that the restored state application cannot operate normally.
Disclosure of Invention
The embodiment of the application provides a snapshot generation method and a snapshot generation system for stateful applications in a cloud primary scene, and the method and the system simultaneously generate snapshots for resource files corresponding to the stateful applications and storage data volumes for storing data generated by operation, and the technical scheme is as follows:
in a first aspect, a method for generating a snapshot of a stateful application in a cloud native scene, where the method is run on a snapshot controller, the method includes:
responding to a received instruction for generating a snapshot of the stateful application, and respectively issuing a first snapshot generation instruction and a second snapshot generation instruction to a container storage interface driver and a resource file snapshot generator; the method comprises the steps that an instruction for generating a snapshot of a stateful application comprises identification information of the stateful application, a first snapshot generation instruction is used for instructing a container storage interface to drive to generate a data snapshot of the stateful application at a specified time point, and a second snapshot generation instruction is used for instructing a resource file snapshot generator to synchronously generate a resource file snapshot of the stateful application at the specified time point;
and determining that snapshot generation of the stateful application is successful in response to receiving the information of successful data snapshot generation and the information of successful resource file snapshot generation.
After receiving the instruction to generate the snapshot for the stateful application, the method further includes:
acquiring a resource file corresponding to the stateful application through a unified access interface of the container cloud platform according to the identification information of the stateful application; the resource file includes a storage data volume declaration file in which identification information of a storage data volume corresponding to the stateful application and an access address of the storage data volume are recorded.
The first snapshot generation instruction comprises an access address of a storage data volume, so that the container storage interface drives to generate a data snapshot for the storage data volume corresponding to the stateful application in the back-end storage system according to the access address of the storage data volume;
the second snapshot generation instruction contains identification information of the resource file corresponding to the stateful application, so that the resource file snapshot generator generates a resource file snapshot for the full data information in the resource file corresponding to the stateful application according to the identification information of the resource file.
The information of successful generation of the data snapshot is information fed back to the snapshot controller by the container storage interface after the container storage interface drives a storage data volume corresponding to stateful application in the back-end storage system to generate the data snapshot and stores the generated data snapshot into a data snapshot storage area in the back-end storage system;
The information that the resource file snapshot is successfully generated is information fed back to the snapshot controller by the resource file snapshot generator after the resource file snapshot generator generates the resource file snapshot for the full data information in the resource file corresponding to the stateful application and stores the generated resource file snapshot into the resource file snapshot storage area in the back-end storage system.
In a second aspect, a snapshot restoration method for a stateful application in a cloud native scene, where the method is run on a snapshot controller, includes:
responding to receiving an instruction for restoring the snapshot of the stateful application, and respectively transmitting a first snapshot restoring instruction and a second snapshot restoring instruction to a container storage interface driver and a resource file snapshot generator; the method comprises the steps that a snapshot restoring instruction of a stateful application comprises identification information of the stateful application and a snapshot generation time point, the first snapshot restoring instruction is used for indicating a container storage interface to drive to restore a storage data volume corresponding to the stateful application by using a data snapshot corresponding to the snapshot generation time point, and the second snapshot restoring instruction is used for indicating a resource file snapshot generator to restore a resource file corresponding to the stateful application by using a resource file snapshot corresponding to the snapshot generation time point;
In response to receiving the information of successful restoration of the storage data volume and the information of successful restoration of the resource file, detecting whether the restored stateful application operates normally or not;
and responding to the normal operation of the stateful application, and determining that the storage data volume and the resource file corresponding to the stateful application are successfully restored.
The first snapshot restore instruction is configured to instruct the container storage interface driver to restore a storage data volume corresponding to the stateful application by using a data snapshot corresponding to a snapshot generation time point, and specifically is:
the first snapshot restoring instruction is used for indicating a container storage interface to drive a data snapshot storage area in a back-end storage system to find a data snapshot corresponding to a snapshot generation time point, and restoring a storage data volume corresponding to a stateful application by using the data snapshot;
in a corresponding manner to the fact that,
the second snapshot restoring instruction is configured to instruct the resource file snapshot generator to restore a resource file corresponding to the stateful application by using a resource file snapshot corresponding to a snapshot generation time point, where the method specifically includes:
the second snapshot restoring instruction is used for indicating the resource file snapshot generator to find the resource file snapshot corresponding to the snapshot generating time point in the resource file snapshot storage area in the back-end storage system;
The resource file snapshot generator determines full data information of the resource file corresponding to the stateful application at the snapshot generation time point according to the resource file snapshot, and restores the resource file corresponding to the stateful application by using the full data information.
In a third aspect, a snapshot generation system for a stateful application in a cloud native scene includes:
the snapshot controller is used for responding to the received instruction for generating the snapshot of the stateful application, respectively issuing a first snapshot generation instruction and a second snapshot generation instruction to the container storage interface driver and the resource file snapshot generator, and determining that the snapshot of the stateful application is successfully generated according to the received information of successful generation of the data snapshot and the information of successful generation of the resource file snapshot; the instruction for generating the snapshot to the stateful application comprises the identification information of the stateful application;
the container interface storage driver is used for responding to the received first snapshot generation instruction, generating a data snapshot of the stateful application at a designated time point, storing the generated data snapshot into a data snapshot storage area in the back-end storage system, and feeding back data snapshot generation success information to the snapshot controller;
And the resource file snapshot generator is used for responding to the received second snapshot generation instruction, synchronously generating the resource file snapshot of the stateful application at the appointed time point, storing the generated resource file snapshot into a resource file snapshot storage area in the back-end storage system, and feeding back the successful information of the resource file snapshot generation to the snapshot controller.
In a fourth aspect, a snapshot restore system for stateful applications in a cloud native scenario, comprising:
the snapshot controller is used for responding to the received instruction for restoring the snapshot of the stateful application, respectively issuing a first snapshot restoring instruction and a second snapshot restoring instruction to the container storage interface driver and the resource file snapshot generator, responding to the received information of successful restoration of the storage data volume and the information of successful restoration of the resource file, and detecting whether the restored stateful application operates normally or not; according to the normal running of the stateful application, determining that the storage data volume and the resource file corresponding to the stateful application are successfully restored; the instruction for restoring the snapshot to the stateful application comprises the identification information of the stateful application and the snapshot generation time point;
the container storage interface driver is used for responding to the received first snapshot restoration instruction, restoring the storage data volume corresponding to the stateful application by using the data snapshot corresponding to the snapshot generation time point, and feeding back the information of successful data restoration to the snapshot controller;
And the resource file snapshot generator is used for responding to the received second snapshot restoring instruction, restoring the resource file corresponding to the stateful application by using the resource file snapshot corresponding to the snapshot generating time point, and feeding back the successful restoring information of the resource file snapshot to the snapshot controller.
In a fifth aspect, a computer readable storage medium has stored thereon a computer program for executing a snapshot generation or restoration method of a stateful application in any of the above cloud-native scenarios.
In a sixth aspect, an electronic device includes: the system comprises a memory, a processor and a program stored in the memory and capable of running on the processor, wherein the processor realizes the snapshot generation or restoration method of the stateful application in any cloud primary scene when executing the program.
The beneficial effects that the scheme that this application embodiment provided brought are:
the embodiment of the application provides a snapshot generation method and a snapshot generation system for stateful applications in a cloud primary scene. A snapshot controller and a resource file snapshot generator can be introduced into a container cloud platform such as a Kubernetes system, wherein the snapshot controller is mainly used for acquiring resource files (including general resource files and PV/PVC files) corresponding to stateful applications, and respectively issuing a first snapshot generation instruction and a second snapshot generation instruction to a container storage interface driver and the resource file snapshot generator. And after receiving the first snapshot generation instruction, the container storage interface driver generates a data snapshot for the storage data volume corresponding to the stateful application at a specified time point. And after receiving the second snapshot generation instruction, the resource file snapshot generator synchronously generates a resource file snapshot for the resource file corresponding to the stateful application at a designated time point. When the resource file and the data of the stateful application are damaged, the stateful application can be restored by using the synchronously generated data snapshot and the resource file snapshot, the consistency of the restored resource file and the restored data can be ensured, and the restored stateful application can normally run.
Drawings
In order to more clearly illustrate a snapshot generating method and a snapshot generating system of a stateful application in a cloud native scene in the embodiments of the present application, the following will briefly describe the drawings required to be used in the description of the embodiments.
FIG. 1 is a schematic diagram of a prior art snapshot generation structure;
fig. 2 is a flowchart of a snapshot generating method of a stateful application in a cloud native scene according to an embodiment of the present application;
fig. 3 is a complete flowchart of a method for generating a stateful application snapshot in a cloud native scene according to an embodiment of the present application;
fig. 4 is a flowchart of a snapshot restoration method of a stateful application in a cloud native scene according to an embodiment of the present application;
fig. 5 is a complete flowchart of a snapshot restoration method of a stateful application in a cloud native scene provided in an embodiment of the present application;
fig. 6 is a schematic diagram of a snapshot generating system of a stateful application in a cloud native scene according to an embodiment of the present application;
FIG. 7 is an exemplary diagram of a snapshot generation system for a stateful application in a cloud native scenario provided in an embodiment of the present application;
fig. 8 is a schematic diagram of a snapshot restoration system of a stateful application in a cloud native scenario provided in an embodiment of the present application;
FIG. 9 is an exemplary diagram of a snapshot restore system for a stateful application in a cloud native scenario provided in an embodiment of the present application;
Fig. 10 is a schematic structural diagram of an electronic device according to an embodiment of the present application;
fig. 11 is a schematic hardware diagram of an electronic device according to an embodiment of the present application.
Wherein, the reference numerals are as follows:
a processor 1001, a computer program 1002, a processor 1101, a communication interface 1102, a computer readable medium 1103 and a communication bus 1104.
Detailed Description
In order to make the technical means, the inventive features, the achievement of the purpose and the effect of the implementation of the invention easy to understand, the technical solutions in the embodiments of the invention will be clearly and completely described in conjunction with the specific drawings, and it is obvious that the described embodiments are some embodiments of the invention, not all embodiments.
All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
It should be understood that the structures, proportions, sizes, etc. shown in the drawings are for illustration purposes only and should not be construed as limiting the invention to the extent that it can be practiced, since modifications, changes in the proportions, or otherwise, used in the practice of the invention, are not intended to be critical to the essential characteristics of the invention, but are intended to fall within the spirit and scope of the invention. Also, the terms such as "upper," "lower," "left," "right," "middle," and "a" and the like recited in the present specification are merely for descriptive purposes and are not intended to limit the scope of the invention, but are intended to provide relative positional changes or modifications without materially altering the technical context in which the invention may be practiced.
In order to more clearly describe the snapshot generating method and system for stateful application in the cloud native scene provided by the embodiment of the present invention, technical terms in the embodiment of the present application need to be described in detail first, and specifically are as follows:
kubernetes system: kubernetes is a container orchestration engine that is a Google open source that supports automated deployment, large scale scalability, application containerization management. The Kubernetes system is capable of managing a container group in multiple nodes into the same cluster, and the cluster in which the Kubernetes system is installed is called a Kubernetes cluster.
ETCD assembly: and a distributed key value database with consistency and high availability is used for storing the state of the whole Kubernetes cluster.
API-Server component: for providing a unique portal for Kubernetes cluster resource instructions and for providing mechanisms for authentication, authorization, access control, API registration and discovery, etc.
The container storage interface (Container Storage Interface) drives: in short, CSI drivers, interfacing with Kubernetes systems, an administrator can implement, in the Kubernetes system, the instruction of data information in a back-end storage system through a Container Storage Interface (CSI) driver.
Stateful application: stateful applications refer to applications that require data to be persisted.
In order to more clearly explain the snapshot generation method and system of the stateful application in the cloud native scene provided by the embodiment of the application, the problem to be solved by the application needs to be described.
In the cloud native scenario, applications can be classified into stateful applications and stateless applications. When a stateful application is deployed, besides the application description file (such as a deviyment) corresponding to the stateful application needs to be deployed in a Kubernetes cluster, a configuration file (such as a ConfigMap) and other general resource files (namely a Yaml file), and the stateful application needs to be bound with a storage data volume in a back-end storage system through a special resource file, namely a Persistent Volume (PV)/persistent volume declaration (PVC) file, so that data generated in the running process of the stateful application is stored in the storage data volume in the back-end storage system in a persistent manner. To prevent corruption or loss of storage data volumes in a back-end storage system, it is common practice to generate data snapshots of the storage data volumes, for example, by an administrator via a Container Storage Interface (CSI) drive.
Specifically, fig. 1 is a schematic diagram of a related art snapshot generation structure. As shown in fig. 1, the Kubernetes system provides a standard interface specification for container storage (CSI, container Storage Interface, capable of exposing the back-end storage system to applications in the Kubernetes system) for a storage vendor to develop a corresponding Container Storage Interface (CSI) drive to interface with the Kubernetes system. An application manager can generate a snapshot of a storage data volume in the back-end storage system by only calling a Container Storage Interface (CSI) driver provided by the back-end storage system in the Kubernetes system. Specifically, a Snapshot generating method provided by a Container Storage Interface (CSI) driver is called by generating a new Volume Snapshot resource file (including a PV/PVC file corresponding to a storage data Volume for generating a Snapshot), the data Snapshot is generated for the storage data Volume in the back-end storage system, and the generated data Snapshot is stored in a designated position in the back-end storage system. When a certain storage data volume in the back-end storage system is damaged or has write-in errors, an administrator can find all data snapshots of the storage data volume in the back-end storage system only by calling a snapshot restoring method provided by a Container Storage Interface (CSI) driver in the Kubernetes system, and restore the state of the storage data volume to a time point of any snapshot generation.
However, in the related art, the Kubernetes system can only generate a snapshot for data generated in the running process of the stateful application, but cannot generate a snapshot for a resource file corresponding to the stateful application. If the condition that the resource file corresponding to the state application and the data generated by operation are damaged exists, an administrator calls a snapshot restoration method provided by a Container Storage Interface (CSI) driver in a Kubernetes system to restore the data in a storage data volume corresponding to the state application, and then only manually restore the resource file and bind the resource file with the storage data volume again, but the consistency of the restored resource file and the restored data cannot be guaranteed, namely the restored resource file and the restored data cannot be matched.
Specifically, restoring the data in the storage data volume is to restore the state of the storage data volume to the point in time when the data snapshot is generated, and it is difficult for an administrator to determine the state information of the resource file at the point in time, only continuous attempts can be made to match the state of the resource file with the state of the storage data volume, so that the operation cost is high, and restoration failure of the application is easily caused, so that the application cannot normally run.
After the applicant carries out deep analysis on the use scene of the production practice, in order to ensure that the restored resource file and the restored data have consistency when the resource file corresponding to the stateful application and the data generated by operation are damaged, the applicant tries to generate a snapshot on the data generated by operation of the stateful application and simultaneously generates the snapshot on the resource file corresponding to the stateful application.
Based on the above, the application introduces a snapshot controller and a resource file snapshot generator in the Kubernetes system, wherein the snapshot controller is mainly used for acquiring resource files (including general resource files and PV/PVC files) corresponding to the stateful application, and issuing an instruction for generating a snapshot to the stateful application to a Container Storage Interface (CSI) driver and the resource file snapshot generator. And generating a data snapshot for a storage data volume corresponding to the stateful application in the back-end storage system by using a preset snapshot generation method through a Container Storage Interface (CSI), and generating a resource file snapshot for a resource file corresponding to the stateful application through a resource file snapshot generator.
Fig. 2 is a flowchart of a snapshot generation method of a stateful application in a cloud native scene according to an embodiment of the present application.
A snapshot generation method of a stateful application in a cloud native scenario as shown in fig. 2 is run on a snapshot controller, the method comprising the steps of:
in step S101, in response to a received instruction for generating a snapshot for a stateful application, a first snapshot generation instruction and a second snapshot generation instruction are issued to a Container Storage Interface (CSI) driver and a resource file snapshot generator, respectively.
The method comprises the steps that an instruction for generating a snapshot of a stateful application comprises identification information of the stateful application, a first snapshot generation instruction is used for instructing a Container Storage Interface (CSI) to drive to generate a data snapshot of the stateful application at a specified time point, and a second snapshot generation instruction is used for instructing a resource file snapshot generator to synchronously generate a resource file snapshot of the stateful application at the specified time point.
It may be understood that the identification information of the stateful application generally refers to the name of the stateful application, or may be the number of the stateful application, and the stateful application may be uniquely determined by the name or the number of the stateful application, so as to determine the resource file corresponding to the stateful application.
It can be appreciated that, in order to ensure that the data snapshot and the resource file snapshot can be generated synchronously, two implementation manners may be provided in the embodiments of the present application: the method comprises the steps that firstly, a snapshot controller receives an instruction for generating a snapshot of a stateful application, and immediately and simultaneously sends a first snapshot generation instruction and a second snapshot generation instruction to a Container Storage Interface (CSI) driver and a resource file snapshot generator respectively, and the Container Storage Interface (CSI) driver and the resource file snapshot generator immediately execute the corresponding snapshot generation instruction after receiving the corresponding snapshot generation instruction. Because the snapshot controller sends corresponding snapshot generating instructions to the Container Storage Interface (CSI) driver and the resource file snapshot generator at the same time, the Container Storage Interface (CSI) driver and the resource file snapshot generator immediately execute the corresponding snapshot generating instructions after receiving the corresponding snapshot generating instructions, and therefore the data snapshot and the resource file snapshot are generated at the same time (namely, the appointed time) when the snapshot controller receives the instruction of generating the snapshot to the stateful application. And secondly, the snapshot controller receives an instruction for generating a snapshot for the stateful application (the instruction comprises a designated time point which does not come yet), and immediately sends a first snapshot generation instruction and a second snapshot generation instruction (the two instructions which are respectively sent also comprise the designated time point which does not come yet) to a Container Storage Interface (CSI) driver and a resource file snapshot generator respectively, and the Container Storage Interface (CSI) driver and the resource file snapshot generator immediately execute the corresponding snapshot generation instruction when the designated time point arrives after receiving the corresponding snapshot generation instruction, so that the data snapshot and the resource file snapshot are simultaneously generated at the designated time point. For example, the instruction to generate a snapshot for a stateful application includes 12 noon, and then upon arrival at 12 noon, the Container Storage Interface (CSI) driver and resource file snapshot generator will generate a data snapshot and a resource file snapshot for the stateful application simultaneously. Further, the number of times the snapshot is generated at 12 pm may also be set in the instruction, once by default, multiple times by parameter setting, or permanently, i.e., the Container Storage Interface (CSI) driver and the resource file snapshot generator will generate the data snapshot and the resource file snapshot for the stateful application at the same time every 12 pm.
Step S102, in response to receiving the information of successful generation of the data snapshot and the information of successful generation of the resource file snapshot, the snapshot generation success of the stateful application is determined.
It can be understood that after the data snapshot is successfully generated, the Container Storage Interface (CSI) driver feeds back success information to the snapshot controller, and the resource file snapshot generator feeds back success information to the snapshot controller after the resource file snapshot is generated, only when the two are both fed back the snapshot generation success information, the whole snapshot generation instruction is represented to be completed, otherwise, the snapshot controller needs to send out an instruction for generating the snapshot to the stateful application again to the Container Storage Interface (CSI) driver and the resource file snapshot generator until the two feedback the snapshot generation success.
In a possible implementation, after the snapshot controller receives the instruction to generate the snapshot for the stateful application in step S101, the method further includes:
and acquiring a resource file corresponding to the stateful application through a unified access interface of the container cloud platform according to the identification information of the stateful application.
The resource file comprises a storage data volume declaration file, and the storage data volume declaration file is recorded with identification information of a storage data volume corresponding to the stateful application and an access address of the storage data volume.
It may be understood that the identification information of the stateful application generally refers to the name or number of the stateful application, and the snapshot controller may access, according to the name or number of the stateful application, a database of the container cloud platform (such as an ETCD component of the Kubernetes cluster) through a unified access interface of the container cloud platform (such as an API-Server component of the Kubernetes cluster) to obtain a specific resource file, which specifically includes a general resource file (i.e., a Yaml file) such as an application description file (such as a discovery), a configuration file (such as a ConfigMap), and a storage data volume declaration file (PV/PVC file).
And analyzing the content of the storage data volume declaration file to obtain the identification information and the access address of the storage data volume corresponding to the stateful application in the back-end storage system.
In one possible implementation, the first snapshot generation instruction includes an access address of the storage data volume, so that a Container Storage Interface (CSI) driver generates a data snapshot for the storage data volume corresponding to the stateful application in the back-end storage system according to the access address of the storage data volume; the second snapshot generation instruction contains identification information of the resource file corresponding to the stateful application, so that the resource file snapshot generator generates a resource file snapshot for the full data information in the resource file corresponding to the stateful application according to the identification information of the resource file.
The identification information of the resource file is usually the name of the resource file, or may be the number of the resource file, or may be the access path of the resource file, and the resource file snapshot generator may find the resource file through the name, the number or the access path of the resource file, so as to generate a resource file snapshot for the full data information in the resource file.
It should be understood that the full data information of the resource file refers to all resource files of the stateful application at the same time corresponding to the snapshot generation time, for example, all resource files include not only the storage data volume declaration file described above, but also general resource files (i.e., yaml files) such as a stateful application corresponding application description file (deviyment), a configuration file (ConfigMap), and the like.
It should be noted that, there are various ways in which the Container Storage Interface (CSI) driver generates a data snapshot for a storage data volume in the back-end storage system, which may be performing a full snapshot for the storage data volume, that is, performing a snapshot record for all data stored in the storage data volume at a time, or performing an incremental snapshot for the storage data volume, that is, performing a snapshot record for only data modified after the last snapshot generated in the storage data volume at a time.
It should be specifically noted that, the information that the snapshot controller receives that the snapshot is successfully generated and the information that the snapshot is successfully generated in the step S102 is information fed back to the snapshot controller after the Container Storage Interface (CSI) driver and the resource file snapshot generator respectively successfully complete all corresponding snapshot generating operations.
Specifically, the information that the data snapshot is successfully generated is information fed back to the snapshot controller by the Container Storage Interface (CSI) after the Container Storage Interface (CSI) drives to generate the data snapshot on the storage data volume corresponding to the stateful application in the back-end storage system and stores the generated data snapshot in the data snapshot storage area in the back-end storage system.
Similarly, the information that the resource file snapshot is successfully generated is the information fed back to the snapshot controller by the resource file snapshot generator after the resource file snapshot generator generates the resource file snapshot for the full data information in the resource file corresponding to the stateful application and stores the generated resource file snapshot into the resource file snapshot storage area in the back-end storage system.
FIG. 3 is a complete flowchart of stateful application snapshot generation provided herein. As shown in fig. 3, the method comprises the following steps:
In step S301, the snapshot controller receives a stateful application snapshot generation instruction input by an administrator.
In step S302, the snapshot controller accesses the ETCD assembly to obtain a PV/PVC file corresponding to the back-end storage data volume.
In step S303, the snapshot controller generates a first snapshot generation instruction and a second snapshot generation instruction, and then synchronously executes step S304A and step S304B.
In step S304A, the snapshot controller sends a first snapshot generation instruction to a Container Storage Interface (CSI) driver.
In step S304B, the snapshot controller sends a second snapshot generation instruction to the resource file snapshot generator.
In step S305A, the Container Storage Interface (CSI) driver receives the first snapshot generating instruction and generates a data snapshot.
In step S305B, the resource file snapshot generator receives the second snapshot generating instruction and then generates a resource file snapshot. Wherein, step S305A and step S305B should be performed simultaneously, i.e. the resource file snapshot and the data snapshot are generated at the same point in time.
In step S306A, the Container Storage Interface (CSI) driver feeds back information that the data snapshot generation was successful to the snapshot controller.
In step S306B, the resource file snapshot generator feeds back information that the resource file snapshot was successfully generated to the snapshot controller.
In step S307, after receiving feedback information of successful data snapshot generation and successful resource file snapshot generation within a preset time, the snapshot controller confirms that the snapshot generation of the stateful application is successful. In step S307, if the snapshot controller receives only feedback information that one snapshot is successfully generated, or does not receive any feedback information that the snapshot is successfully generated, the snapshot controller returns to step S303 and issues an instruction to generate a snapshot for the stateful application to the CSI driver and resource file snapshot generator again until it is confirmed that the snapshot generation of the stateful application is successful.
According to the snapshot generation method provided by the embodiment of the application, the snapshot controller is introduced to globally control snapshot generation of stateful application, and the snapshot generation instruction can be issued uniformly, so that the data snapshot and the resource file snapshot are generated simultaneously, and consistency is ensured. When the resource file corresponding to the stateful application and the data generated by operation are damaged at the same time, the data snapshot and the resource file snapshot can be restored at the same time, and the restored resource file and the restored data are ensured to have consistency.
As shown in fig. 4, an embodiment of the present application provides a snapshot restoration method for a stateful application in a cloud native scene, where the method is run on a snapshot controller, and includes the following steps:
In step S401, in response to receiving an instruction to restore a snapshot to a stateful application, a first snapshot restore instruction and a second snapshot restore instruction are issued to a Container Storage Interface (CSI) driver and a resource file snapshot generator, respectively.
The method comprises the steps that an instruction for restoring the snapshot of the stateful application comprises identification information of the stateful application and a snapshot generation time point, a first snapshot restoring instruction is used for indicating a Container Storage Interface (CSI) to drive to restore a storage data volume corresponding to the stateful application by using a data snapshot corresponding to the snapshot generation time point, and a second snapshot restoring instruction is used for indicating a resource file snapshot generator to restore a resource file corresponding to the stateful application by using a resource file snapshot corresponding to the snapshot generation time point.
It can be appreciated that the identification information in the restore snapshot instruction includes the storage location and identification information of the stateful application snapshot in the back-end storage system. The first snapshot restoring instruction and the first snapshot restoring instruction generated by the snapshot controller comprise storage positions and identification information of the snapshots in the back-end storage system.
In step S402, in response to receiving the information of successful restoration of the storage data volume and the information of successful restoration of the resource file, it is detected whether the restored stateful application is operating normally.
Step S403, in response to the stateful application operating normally, it is determined that the storage data volume and the resource file corresponding to the stateful application are restored successfully.
Further, the first snapshot restore instruction is configured to instruct a Container Storage Interface (CSI) driver to restore a storage data volume corresponding to the stateful application by using a data snapshot corresponding to a snapshot generation time point, and specifically is:
the first snapshot restore instruction is configured to instruct a Container Storage Interface (CSI) driver to find a data snapshot corresponding to a snapshot generation time point in a data snapshot storage area in a back-end storage system, and restore a storage data volume corresponding to a stateful application by using the data snapshot.
Correspondingly, the second snapshot restoring instruction is configured to instruct the resource file snapshot generator to restore the resource file corresponding to the stateful application by using the resource file snapshot corresponding to the snapshot generating time point, where the method specifically includes:
the second snapshot restoring instruction is used for indicating the resource file snapshot generator to find the resource file snapshot corresponding to the snapshot generating time point in the resource file snapshot storage area in the back-end storage system; the resource file snapshot generator determines full data information of the resource file corresponding to the stateful application at the snapshot generation time point according to the resource file snapshot, and restores the resource file corresponding to the stateful application by using the full data information.
It should be understood that the stateful application corresponding resource file includes a special resource file, such as an application description file (e.g., a deviyment), a configuration file (e.g., a ConfigMap), and a storage data volume declaration file (PV/PVC file), where the PV/PVC file records, in the full data information of the snapshot generation time point, identification information of the storage data volume and an access address of the storage data volume corresponding to the snapshot generation time point by the stateful application.
After the restoration of the storage data volume and the resource file corresponding to the stateful application is completed, the Container Storage Interface (CSI) driver automatically re-binds the stateful application with the corresponding storage data volume according to the content recorded in the PV/PVC file.
As shown in fig. 5, when the resource file corresponding to the stateful application and the data generated by the running are damaged at the same time, only the application administrator needs to input the snapshot restoration instruction of the stateful application to the snapshot controller. The snapshot restore instruction includes identification information of the stateful application and a snapshot generation time point designated to be restored. The snapshot controller issues instructions to a Container Storage Interface (CSI) driver and a resource file snapshot generator to restore the state of the stateful application to a specified snapshot generation point in time. The specific steps of the reduction method are as follows:
In step S501, the snapshot controller receives a stateful application snapshot restore instruction input by an administrator. The instruction comprises identification information of the state application and snapshot generation time points.
In step S502, the snapshot controller generates a first snapshot restore instruction and a second snapshot restore instruction, and then synchronously executes step S503A and step S503B.
In step S503A, the snapshot controller sends a first snapshot restore instruction to a Container Storage Interface (CSI) driver.
In step S503B, the snapshot controller sends a second snapshot restore instruction to the resource file snapshot generator.
In step S504A, the Container Storage Interface (CSI) driver restores the corresponding storage data volume after receiving the first snapshot generating instruction. Specifically, a Container Storage Interface (CSI) driver queries a data snapshot corresponding to a specified snapshot generation time point from a data snapshot storage area in a back-end storage system, and restores a state of a storage data volume corresponding to a stateful application to the specified snapshot generation time point by using a preset snapshot restoration method and the data snapshot.
In step S504B, the resource file snapshot generator restores the corresponding resource file after receiving the second snapshot restoration instruction. Specifically, the resource file snapshot generator queries a resource file snapshot corresponding to a specified snapshot generation time point from a resource file snapshot storage area in the back-end storage system, and obtains full data information of the resource file corresponding to the specified snapshot generation time point through the resource file snapshot to generate the resource file corresponding to the snapshot generation time point.
In step S505A, the Container Storage Interface (CSI) driver feeds back information that the restore of the storage data volume was successful to the snapshot controller.
In step S505B, the resource file snapshot generator feeds back information that the restoration of the resource file is successful to the snapshot controller.
In step S506, the snapshot controller receives the information of successful restoration of the storage data volume and the information of successful restoration of the resource file within a preset time, and detects whether the restored stateful application operates normally.
Step S507, the snapshot controller detects that the stateful application operates normally, and confirms that the storage data volume and the resource file corresponding to the stateful application are successfully restored.
According to the snapshot restoration method provided by the embodiment of the application, because the data snapshot and the corresponding resource file snapshot are generated at the same time, the consistency of the restored resource file and the stored data can be ensured. The method can directly restore the stateful application by using the matched data snapshot and the resource file snapshot, can realize the automatic matching and binding of the resource file snapshot and the data snapshot, greatly reduces the workload of manual restoration and manual matching, and reduces the operation and maintenance operation cost.
In addition, when the application manager restores the stateful application, the application manager can select to restore the stateful application to any snapshot generation time point through the snapshot generation time point in the instruction.
As shown in fig. 6, the present application provides a snapshot generating system of a stateful application in a cloud native scene, including:
the snapshot controller is used for responding to the received instruction for generating the snapshot of the stateful application, respectively issuing a first snapshot generation instruction and a second snapshot generation instruction to the Container Storage Interface (CSI) driver and the resource file snapshot generator, and determining that the snapshot of the stateful application is successfully generated according to the received information of successful generation of the data snapshot and the information of successful generation of the resource file snapshot; the instruction for generating the snapshot for the stateful application comprises the identification information of the stateful application.
And the container interface storage drive is used for responding to the received first snapshot generation instruction, generating a data snapshot of the stateful application at a designated time point, storing the generated data snapshot into a data snapshot storage area in the back-end storage system, and feeding back the successful information of the data snapshot generation to the snapshot controller.
And the resource file snapshot generator is used for responding to the received second snapshot generation instruction, synchronously generating the resource file snapshot of the stateful application at the appointed time point, storing the generated resource file snapshot into a resource file snapshot storage area in the back-end storage system, and feeding back the successful information of the resource file snapshot generation to the snapshot controller.
Further, after the snapshot controller receives the instruction to generate the snapshot for the stateful application, the method further includes:
acquiring a resource file corresponding to the stateful application through a unified access interface of the container cloud platform according to the identification information of the stateful application; the resource file includes a storage data volume declaration file in which identification information of a storage data volume corresponding to the stateful application and an access address of the storage data volume are recorded.
Further, the first snapshot generation instruction includes an access address of the storage data volume, so that a Container Storage Interface (CSI) driver generates a data snapshot for the storage data volume corresponding to the stateful application in the back-end storage system according to the access address of the storage data volume.
The second snapshot generation instruction contains identification information of the resource file corresponding to the stateful application, so that the resource file snapshot generator generates a resource file snapshot for the full data information in the resource file corresponding to the stateful application according to the identification information of the resource file.
Further, a Container Storage Interface (CSI) driver generates a data snapshot on a storage data volume corresponding to a stateful application in a back-end storage system, and feeds back information of successful generation of the data snapshot to a snapshot controller after the generated data snapshot is stored in a data snapshot storage area in the back-end storage system.
Further, the resource file snapshot generator generates a resource file snapshot for the full data information in the resource file corresponding to the stateful application, and after the generated resource file snapshot is stored in a resource file snapshot storage area in the back-end storage system, information of successful generation of the resource file snapshot is fed back to the snapshot controller.
Specifically, taking a Kubernetes system as an example, as shown in fig. 7, three stateful applications of an application a, an application B and an application C are deployed in the Kubernetes system, and correspond to a resource file 1, a resource file 2 and a resource file 3 respectively, where the resource file 1 includes a PV/PVC1, the resource file 2 includes a PV/PVC2, the resource file 3 includes a PV/PVC3, the PV/PVC1 is used for binding the application a with the storage data volume 1, the PV/PVC2 is used for binding the application B with the storage data volume 2, and the PV/PVC3 is used for binding the application C with the storage data volume 3.
By introducing a snapshot controller and a resource file snapshot generator into the Kubernetes system, when an application administrator needs to generate a snapshot for a certain stateful application (such as application a) deployed in the Kubernetes system, the snapshot controller only needs to input identification information of the stateful application into the snapshot controller, and according to the identification information of the stateful application, the snapshot controller obtains a resource file (such as resource file 1) corresponding to the stateful application from the ETCD by accessing an API-Server component of the Kubernetes system, wherein the resource file comprises general resource files such as an application description file (deviyment), a configuration file (ConfigMap) and special resource files (such as PV/PVC 1). The contents of the storage field of the PV/PVC file record the storage data volume corresponding to the stateful application and the access address of the storage data volume.
The snapshot controller issues an instruction for generating a snapshot for the stateful application to a Container Storage Interface (CSI) driver and a resource file snapshot generator, specifically issues an instruction for generating a snapshot for a storage data volume corresponding to the stateful application (including an access address of the storage data volume) to the Container Storage Interface (CSI) driver, and issues an instruction for generating a snapshot for a resource file corresponding to the stateful application to the resource file snapshot generator.
And the Container Storage Interface (CSI) driver generates a data snapshot for the storage data volume corresponding to the stateful application in the back-end storage system by using a preset snapshot generation method according to the access address of the storage data volume, and stores the data snapshot in a data quick storage area in the back-end storage system.
The resource file snapshot generator performs snapshot copying on the full data information of the resource file corresponding to the stateful application, and stores the generated resource file snapshot into a resource file snapshot storage area in the back-end storage system.
And if the generation of the data snapshot is successful, feeding back information of the successful generation of the data snapshot to a snapshot controller by a Container Storage Interface (CSI) driver, and if the generation of the resource file snapshot is successful, feeding back information of the successful generation of the resource file snapshot to the snapshot controller by a resource file snapshot generator. It should be appreciated that using this scheme to generate snapshots for stateful applications may only be successful if both the data snapshot and the resource file snapshot are successfully generated, otherwise the snapshot controller needs to re-issue instructions to the Container Storage Interface (CSI) driver and the resource file snapshot generator to generate the snapshots for the stateful applications.
According to the snapshot generation system provided by the embodiment of the application, the snapshot controller and the resource file snapshot generator are introduced into the container cloud platform such as a Kubernetes system, wherein the snapshot controller is mainly used for acquiring resource files (including general resource files and PV/PVC files) corresponding to stateful applications, and respectively issuing a first snapshot generation instruction and a second snapshot generation instruction to the container storage interface driver and the resource file snapshot generator. And after receiving the first snapshot generation instruction, the container storage interface driver generates a data snapshot for the storage data volume corresponding to the stateful application at a specified time point. And after receiving the second snapshot generation instruction, the resource file snapshot generator synchronously generates a resource file snapshot for the resource file corresponding to the stateful application at a designated time point. When the resource file and the data of the stateful application are damaged, the stateful application can be restored by using the synchronously generated data snapshot and the resource file snapshot, the consistency of the restored resource file and the restored data can be ensured, and the restored stateful application can normally run.
As shown in fig. 8, an embodiment of the present application provides a snapshot restoration system for a stateful application in a cloud native scene, which is characterized by including:
The snapshot controller is used for responding to the received instruction for restoring the snapshot of the stateful application, respectively issuing a first snapshot restoring instruction and a second snapshot restoring instruction to the Container Storage Interface (CSI) driver and the resource file snapshot generator, responding to the received information of successful restoration of the storage data volume and the information of successful restoration of the resource file, and detecting whether the restored stateful application operates normally or not; according to the normal running of the stateful application, determining that the storage data volume and the resource file corresponding to the stateful application are successfully restored; the instruction for restoring the snapshot to the stateful application comprises the identification information of the stateful application and the snapshot generation time point;
a Container Storage Interface (CSI) driver, configured to respond to a received first snapshot restoration instruction, restore a storage data volume corresponding to a stateful application by using a data snapshot corresponding to a snapshot generation time point, and feed back information that restoration of the storage data volume is successful to a snapshot controller;
and the resource file snapshot generator is used for responding to the received second snapshot restoring instruction, restoring the resource file corresponding to the stateful application by using the resource file snapshot corresponding to the snapshot generating time point, and feeding back the successful restoring information of the resource file to the snapshot controller.
Container Storage Interface (CSI) driver, in particular for: according to the first snapshot restoring instruction, finding a data snapshot corresponding to a snapshot generating time point in a data snapshot storage area in the back-end storage system, and restoring a storage data volume corresponding to the stateful application by using the data snapshot;
in a corresponding manner to the fact that,
the resource file snapshot generator is specifically used for: according to the second snapshot restoring instruction, finding a resource file snapshot corresponding to a snapshot generating time point in a resource file snapshot storage area in the back-end storage system; and determining the full data information of the resource file corresponding to the stateful application at the snapshot generation time point according to the resource file snapshot, and restoring the resource file corresponding to the stateful application by using the full data information.
As shown in fig. 9, taking the Kubernetes system as an example, when the resource file 1 corresponding to the stateful application a and the data volume 1 generated by running are damaged at the same time, only the application administrator needs to input the snapshot restoration instruction of the stateful application to the snapshot controller. The snapshot restore instruction includes identification information of the stateful application and a snapshot generation time point designated to be restored. The snapshot controller receives a snapshot restore instruction, and issues an instruction for restoring the stateful application snapshot to a Container Storage Interface (CSI) driver and a resource file snapshot generator, specifically issues an instruction for restoring a storage data volume corresponding to the stateful application (including an access address of a data snapshot corresponding to the stateful application) to the Container Storage Interface (CSI) driver, and issues an instruction for restoring a resource file corresponding to the stateful application (including an access address of a resource file snapshot corresponding to the stateful application) to the resource file snapshot generator.
And the Container Storage Interface (CSI) drives restore the corresponding data volume 1 of the stateful application corresponding to the data snapshot 1 in the back-end storage system by using a preset data snapshot restoration method according to the access address of the data snapshot.
And the resource file snapshot generator restores the resource file snapshot 1 corresponding to the stateful application in the back-end storage system into the corresponding resource file 1 by using a preset data snapshot restoring method.
If the data snapshot is successfully restored, the Container Storage Interface (CSI) drives feed back the information of the restoration success of the storage data volume 1 to the snapshot controller, and if the resource file snapshot 1 is successfully restored, the resource file snapshot generator feeds back the information of the restoration success of the resource file 1 to the snapshot controller. It should be appreciated that using this scheme to generate snapshots for stateful applications only if both the data snapshot and the resource file snapshot are restored successfully, then the snapshot controller needs to re-issue instructions to the Container Storage Interface (CSI) driver and the resource file snapshot generator to restore the snapshots for the stateful applications. After the snapshot controller receives feedback signals of successful data snapshot and resource file snapshot restoration, the snapshot controller starts to detect the running state of the stateful application, and if the running is successful, the snapshot restoration operation is confirmed to be completed.
According to the snapshot restoration system provided by the embodiment of the application, because the data snapshot and the corresponding resource file snapshot are generated at the same time, the consistency of the restored resource file and the stored data can be ensured. The method can directly restore the stateful application by using the matched data snapshot and the resource file snapshot, can realize the automatic matching and binding of the resource file snapshot and the data snapshot, greatly reduces the workload of manual restoration and manual matching, and reduces the operation and maintenance operation cost.
In addition, when the application manager restores the stateful application, the application manager can select to restore the stateful application to any snapshot generation time point through the snapshot generation time point in the instruction.
Fig. 10 is a schematic structural diagram of an electronic device according to the present invention. An electronic device as shown in fig. 10, comprising: one or more processors 1001; and a computer readable medium, may be configured to store one or more programs 1002,
the one or more processors 1001, when executing the one or more programs 1002, implement the following steps: and responding to the received instruction for generating the snapshot of the stateful application, and respectively issuing a first snapshot generation instruction and a second snapshot generation instruction to a Container Storage Interface (CSI) driver and a resource file snapshot generator. The instruction for generating the snapshot for the stateful application comprises the identification information of the stateful application. The first snapshot generation instruction is used for instructing a Container Storage Interface (CSI) driver to generate a data snapshot of the stateful application at a specified time point, and the second snapshot generation instruction is used for instructing a resource file snapshot generator to synchronously generate a resource file snapshot of the stateful application at the specified time point. And determining that snapshot generation of the stateful application is successful in response to receiving the information of successful data snapshot generation and the information of successful resource file snapshot generation.
The one or more processors 1001, when executing the one or more programs 1002, may further implement the following steps:
the snapshot controller receives an instruction for restoring the snapshot of the stateful application and respectively transmits a first snapshot restoring instruction and a second snapshot restoring instruction to a Container Storage Interface (CSI) driver and a resource file snapshot generator; the method comprises the steps that a snapshot restoring instruction of a stateful application comprises identification information of the stateful application and a snapshot generation time point, the first snapshot restoring instruction is used for indicating a Container Storage Interface (CSI) to drive to restore a storage data volume corresponding to the stateful application by using a data snapshot corresponding to the snapshot generation time point, and the second snapshot restoring instruction is used for indicating a resource file snapshot generator to restore a resource file corresponding to the stateful application by using a resource file snapshot corresponding to the snapshot generation time point;
the snapshot controller receives the information of successful restoration of the storage data volume and the information of successful restoration of the resource file, and detects whether the restored stateful application operates normally or not; the snapshot controller detects that the stateful application operates normally, and determines that the storage data volume and the resource file corresponding to the stateful application are successfully restored.
Fig. 11 is a schematic hardware diagram of an electronic device according to the present invention. As shown in fig. 11, the hardware structure of the electronic device may include: a processor 1101, a communication interface 1102, a computer readable medium 1103 and a communication bus 1104.
Wherein the processor 1101, the communication interface 1102, and the computer-readable medium 1103 communicate with each other via a communication bus 1104.
Alternatively, the communication interface 1102 may be an interface of a communication module, such as an interface of a GSM module.
Among other things, the processor 1101 may be specifically configured to: and responding to the received instruction for generating the snapshot of the stateful application, and respectively issuing a first snapshot generation instruction and a second snapshot generation instruction to a Container Storage Interface (CSI) driver and a resource file snapshot generator. The instruction for generating the snapshot for the stateful application comprises the identification information of the stateful application. The first snapshot generation instruction is used for instructing a Container Storage Interface (CSI) driver to generate a data snapshot of the stateful application at a specified time point, and the second snapshot generation instruction is used for instructing a resource file snapshot generator to synchronously generate a resource file snapshot of the stateful application at the specified time point. And determining that snapshot generation of the stateful application is successful in response to receiving the information of successful data snapshot generation and the information of successful resource file snapshot generation.
The processor 1101 may be specifically configured to: the snapshot controller receives a snapshot restoring instruction for the stateful application and respectively transmits a first snapshot restoring instruction and a second snapshot restoring instruction to the CSI drive and resource file snapshot generator; the method comprises the steps that a snapshot restoring instruction of a stateful application comprises identification information of the stateful application and a snapshot generation time point, the first snapshot restoring instruction is used for indicating a CSI driver to restore a stored data volume corresponding to the stateful application by using a data snapshot corresponding to the snapshot generation time point, and the second snapshot restoring instruction is used for indicating a resource file snapshot generator to restore a resource file corresponding to the stateful application by using a resource file snapshot corresponding to the snapshot generation time point;
The snapshot controller receives the information of successful restoration of the storage data volume and the information of successful restoration of the resource file, and detects whether the restored stateful application operates normally or not; the snapshot controller detects that the stateful application operates normally, and determines that the storage data volume and the resource file corresponding to the stateful application are successfully restored.
The processor may be a general purpose processor including a central processing unit (central processing unit, CPU for short), a network processor (Network Processor, NP for short), etc., or may be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components. The disclosed methods, steps, and logic blocks in the embodiments of the present application may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The electronic device of the embodiments of the present application exist in a variety of forms including, but not limited to:
(1) A mobile communication device: such devices are characterized by mobile communication capabilities and are primarily aimed at providing voice, data communications. Such terminals include: smart phones (e.g., IPhone), multimedia phones, functional phones, and low-end phones, etc.
(2) Ultra mobile personal computer device: such devices are in the category of personal computers, having computing and processing functions, and generally also having mobile internet access characteristics. Such terminals include: PDA, MID, and UMPC devices, etc., such as Ipad.
(3) Portable entertainment device: such devices may display and play multimedia content. The device comprises: audio, video players (e.g., iPod), palm game consoles, electronic books, and smart toys and portable car navigation devices.
(4) And (3) a server: the configuration of the server includes a processor, a hard disk, a memory, a system bus, and the like, and the server is similar to a general computer architecture, but is required to provide highly reliable services, and thus has high requirements in terms of processing capacity, stability, reliability, security, scalability, manageability, and the like.
(5) Other electronic devices with data interaction function.
It should be noted that, according to implementation requirements, each component/step described in the embodiments of the present application may be split into more components/steps, or two or more components/steps or part of the instructions of the components/steps may be combined into new components/steps, so as to achieve the purposes of the embodiments of the present application.
The above-described methods according to embodiments of the present application may be implemented in hardware, firmware, or as software or computer code storable in a recording medium such as a CD ROM, RAM, floppy disk, hard disk, or magneto-optical disk, or as computer code originally stored in a remote recording medium or a non-transitory machine storage medium and to be stored in a local recording medium downloaded through a network, so that the methods described herein may be stored on such software processes on a recording medium using a general purpose computer, a special purpose processor, or programmable or dedicated hardware such as an ASIC or FPGA. It is appreciated that a computer, processor, microprocessor controller, or programmable hardware includes a memory component (e.g., RAM, ROM, flash memory, etc.) that can store or receive software or computer code that, when accessed and executed by the computer, processor, or hardware, implements the application synchronization methods described herein in a multi-cluster environment. Furthermore, when a general purpose computer accesses code for implementing the methods illustrated herein, execution of the code converts the general purpose computer into a special purpose computer for performing the methods illustrated herein.
Those of ordinary skill in the art will appreciate that the elements and method steps of the examples described in connection with the embodiments disclosed herein can be implemented as electronic hardware, or as a combination of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the embodiments of the present application.
It should be noted that, in the present specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment is mainly described in a different point from other embodiments.
In particular, for the apparatus and system embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, with reference to the description of the method embodiments in part. The above-described apparatus and system embodiments are merely illustrative, in which elements that are not explicitly described may or may not be physically separated, and elements that are not explicitly described may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
Those of ordinary skill in the art will understand and implement the present invention without undue burden.
The foregoing is merely a preferred embodiment of the present application and is not intended to limit the present application, and various modifications and variations may be made to the present application by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.

Claims (10)

1. A snapshot generation method of a stateful application in a cloud primary scene is characterized in that the method is operated on a snapshot controller and comprises the following steps:
responding to a received instruction for generating a snapshot of the stateful application, and respectively issuing a first snapshot generation instruction and a second snapshot generation instruction to a container storage interface driver and a resource file snapshot generator; the method comprises the steps that an instruction for generating a snapshot of a stateful application comprises identification information of the stateful application, a first snapshot generation instruction is used for instructing a container storage interface to drive to generate a data snapshot of the stateful application at a specified time point, and a second snapshot generation instruction is used for instructing a resource file snapshot generator to synchronously generate a resource file snapshot of the stateful application at the specified time point;
And determining that snapshot generation of the stateful application is successful in response to receiving the information of successful data snapshot generation and the information of successful resource file snapshot generation.
2. The snapshot generation method of claim 1, wherein after receiving an instruction to generate a snapshot of a stateful application, the method further comprises:
acquiring a resource file corresponding to the stateful application through a unified access interface of the container cloud platform according to the identification information of the stateful application; the resource file includes a storage data volume declaration file in which identification information of a storage data volume corresponding to the stateful application and an access address of the storage data volume are recorded.
3. The snapshot generating method as recited in claim 2, wherein,
the first snapshot generation instruction comprises an access address of a storage data volume, so that the container storage interface drives to generate a data snapshot for the storage data volume corresponding to the stateful application in the back-end storage system according to the access address of the storage data volume;
the second snapshot generation instruction contains identification information of the resource file corresponding to the stateful application, so that the resource file snapshot generator generates a resource file snapshot for the full data information in the resource file corresponding to the stateful application according to the identification information of the resource file.
4. A snapshot generating method as recited in claim 3, wherein,
the information of successful generation of the data snapshot is information fed back to the snapshot controller by the container storage interface after the container storage interface drives a storage data volume corresponding to stateful application in the back-end storage system to generate the data snapshot and stores the generated data snapshot into a data snapshot storage area in the back-end storage system;
the information that the resource file snapshot is successfully generated is information fed back to the snapshot controller by the resource file snapshot generator after the resource file snapshot generator generates the resource file snapshot for the full data information in the resource file corresponding to the stateful application and stores the generated resource file snapshot into the resource file snapshot storage area in the back-end storage system.
5. A snapshot restore method for a stateful application in a cloud primary scene, wherein the snapshot is generated by the snapshot generating method according to any one of claims 1 to 4, and the snapshot restore method is run on a snapshot controller, and comprises:
responding to receiving an instruction for restoring the snapshot of the stateful application, and respectively transmitting a first snapshot restoring instruction and a second snapshot restoring instruction to a container storage interface driver and a resource file snapshot generator; the method comprises the steps that a snapshot restoring instruction of a stateful application comprises identification information of the stateful application and a snapshot generation time point, the first snapshot restoring instruction is used for instructing a container storage interface drive to restore a storage data volume corresponding to the stateful application by using a data snapshot corresponding to the snapshot generation time point, and the second snapshot restoring instruction is used for instructing a resource file snapshot generator to restore a resource file corresponding to the stateful application by using a resource file snapshot corresponding to the snapshot generation time point;
In response to receiving the information of successful restoration of the storage data volume and the information of successful restoration of the resource file, detecting whether the restored stateful application operates normally or not;
and responding to the normal operation of the stateful application, and determining that the storage data volume and the resource file corresponding to the stateful application are successfully restored.
6. The snapshot reduction method of claim 5, wherein the snapshot is restored,
the first snapshot restore instruction is configured to instruct the container storage interface driver to restore a storage data volume corresponding to the stateful application by using a data snapshot corresponding to a snapshot generation time point, and specifically is:
the first snapshot restoring instruction is used for indicating a container storage interface to drive a data snapshot storage area in a back-end storage system to find a data snapshot corresponding to a snapshot generation time point, and restoring a storage data volume corresponding to a stateful application by using the data snapshot;
in a corresponding manner to the fact that,
the second snapshot restoring instruction is configured to instruct the resource file snapshot generator to restore a resource file corresponding to the stateful application by using a resource file snapshot corresponding to a snapshot generation time point, where the method specifically includes:
the second snapshot restoring instruction is used for indicating the resource file snapshot generator to find the resource file snapshot corresponding to the snapshot generating time point in the resource file snapshot storage area in the back-end storage system;
The resource file snapshot generator determines full data information of the resource file corresponding to the stateful application at the snapshot generation time point according to the resource file snapshot, and restores the resource file corresponding to the stateful application by using the full data information.
7. A snapshot generation system for a stateful application in a cloud native scene, comprising:
the snapshot controller is used for responding to the received instruction for generating the snapshot of the stateful application, respectively issuing a first snapshot generation instruction and a second snapshot generation instruction to the container storage interface driver and the resource file snapshot generator, and determining that the snapshot of the stateful application is successfully generated according to the received information of successful generation of the data snapshot and the information of successful generation of the resource file snapshot; the instruction for generating the snapshot to the stateful application comprises the identification information of the stateful application;
the container interface storage driver is used for responding to the received first snapshot generation instruction, generating a data snapshot of the stateful application at a designated time point, storing the generated data snapshot into a data snapshot storage area in the back-end storage system, and feeding back data snapshot generation success information to the snapshot controller;
And the resource file snapshot generator is used for responding to the received second snapshot generation instruction, synchronously generating the resource file snapshot of the stateful application at the appointed time point, storing the generated resource file snapshot into a resource file snapshot storage area in the back-end storage system, and feeding back successful information of resource file snapshot generation to the snapshot controller.
8. A snapshot restore system for a stateful application in a cloud-native scenario, wherein the snapshot is generated by the snapshot generation system of claim 7, the snapshot restore system comprising:
the snapshot controller is used for responding to the received instruction for restoring the snapshot of the stateful application, respectively issuing a first snapshot restoring instruction and a second snapshot restoring instruction to the container storage interface driver and the resource file snapshot generator, responding to the received information of successful restoration of the storage data volume and the information of successful restoration of the resource file, and detecting whether the restored stateful application operates normally or not; according to the normal running of the stateful application, determining that the storage data volume and the resource file corresponding to the stateful application are successfully restored; the instruction for restoring the snapshot to the stateful application comprises the identification information of the stateful application and the snapshot generation time point;
The container storage interface driver is used for responding to the received first snapshot restoring instruction, restoring the storage data volume corresponding to the stateful application by using the data snapshot corresponding to the snapshot generating time point, and feeding back the successful restoring information of the storage data volume to the snapshot controller;
and the resource file snapshot generator is used for responding to the received second snapshot restoring instruction, restoring the resource file corresponding to the stateful application by using the resource file snapshot corresponding to the snapshot generating time point, and feeding back the successful information of restoring the resource file to the snapshot controller.
9. A computer readable storage medium, on which a computer program is stored, characterized in that the program is adapted to perform the method according to any one of claims 1-6.
10. An electronic device, comprising: memory, a processor and a program stored in the memory and executable on the processor, the processor implementing the method according to any one of claims 1-6 when the program is executed by the processor.
CN202210821925.7A 2022-07-13 2022-07-13 Snapshot generation method and system for stateful application in cloud primary scene Active CN115098301B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210821925.7A CN115098301B (en) 2022-07-13 2022-07-13 Snapshot generation method and system for stateful application in cloud primary scene

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210821925.7A CN115098301B (en) 2022-07-13 2022-07-13 Snapshot generation method and system for stateful application in cloud primary scene

Publications (2)

Publication Number Publication Date
CN115098301A CN115098301A (en) 2022-09-23
CN115098301B true CN115098301B (en) 2023-06-27

Family

ID=83296447

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210821925.7A Active CN115098301B (en) 2022-07-13 2022-07-13 Snapshot generation method and system for stateful application in cloud primary scene

Country Status (1)

Country Link
CN (1) CN115098301B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116166471B (en) * 2023-01-04 2024-03-22 安超云软件有限公司 Snapshot rollback method, containerized cloud platform and computer readable medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1690974A (en) * 2004-04-28 2005-11-02 国际商业机器公司 System and method for resynchronization of time after minimized backup of system and system failure
US10353603B1 (en) * 2016-12-27 2019-07-16 EMC IP Holding Company LLC Storage container based replication services
CN111078368A (en) * 2019-12-26 2020-04-28 浪潮电子信息产业股份有限公司 Memory snapshot method and device of cloud computing platform virtual machine and readable storage medium

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10044795B2 (en) * 2014-07-11 2018-08-07 Vmware Inc. Methods and apparatus for rack deployments for virtual computing environments
US10534564B2 (en) * 2017-02-23 2020-01-14 Arrikto Inc. Mobility and management layer for multi-platform enterprise data storage
CN112099989A (en) * 2020-08-28 2020-12-18 中国—东盟信息港股份有限公司 Disaster recovery, migration and recovery method for Kubernetes cloud native application
CN113391952B (en) * 2021-06-07 2022-03-11 北京同创永益科技发展有限公司 Automatic backup method based on LVM snapshot in cloud native environment
CN114237498B (en) * 2021-12-02 2023-08-11 上海道客网络科技有限公司 Snapshot generation method and system for cloud primary storage data volume
CN114398208A (en) * 2022-01-17 2022-04-26 上海道客网络科技有限公司 Cross-cluster backup method, system, medium and equipment for stateless application
CN114546725A (en) * 2022-02-23 2022-05-27 上海道客网络科技有限公司 Cross-cluster backup method, system, medium and electronic device for stateful application

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1690974A (en) * 2004-04-28 2005-11-02 国际商业机器公司 System and method for resynchronization of time after minimized backup of system and system failure
US10353603B1 (en) * 2016-12-27 2019-07-16 EMC IP Holding Company LLC Storage container based replication services
CN111078368A (en) * 2019-12-26 2020-04-28 浪潮电子信息产业股份有限公司 Memory snapshot method and device of cloud computing platform virtual machine and readable storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Virtual Infrastructures on the Move: Containers and Virtual Network Migration;Euclides Cardoso等;《2018 XLIV Latin American Computer Conference (CLEI)》;第688-697页 *
容器热迁移的快速内存同步技术;游强志等;《计算机与现代化》;第17-22页 *

Also Published As

Publication number Publication date
CN115098301A (en) 2022-09-23

Similar Documents

Publication Publication Date Title
US11016878B2 (en) System and method for data collection and analysis of information relating to mobile applications
CN109716331B (en) Application deployment conforming to application data sharing and decision service platform mode
CN108427616B (en) Background program monitoring method and monitoring device
US9542302B2 (en) System and method for remote debugging of an application in an image forming apparatus over a network
US20150067167A1 (en) Hot pluggable extensions for access management system
US20120084355A1 (en) Method and apparatus for maintaining operability with a cloud computing environment
US7536599B2 (en) Methods and systems for validating a system environment
CN114237498B (en) Snapshot generation method and system for cloud primary storage data volume
US11461206B2 (en) Cloud simulation and validation system
WO2019084843A1 (en) Firmware upgrading method, electronic device, camera system, and unmanned aerial vehicle
US20170163787A1 (en) Method and electronic device for upgrading or downgrading system
CN115098301B (en) Snapshot generation method and system for stateful application in cloud primary scene
CN115328752B (en) Cluster simulation method and system for Kubernetes control plane test
CN111818145B (en) File transmission method, device, system, equipment and storage medium
CN111459524A (en) Software upgrading method, device and system
WO2021129331A1 (en) Control method and control device for enabling operations of application program in multiple systems
CN109495298B (en) Method and device for managing nodes in OpenStack system
CN114546725A (en) Cross-cluster backup method, system, medium and electronic device for stateful application
CN114968644A (en) System software dump method and device, electronic equipment and readable storage medium
CN114398208A (en) Cross-cluster backup method, system, medium and equipment for stateless application
US11570189B2 (en) Simultaneously testing whether a plurality of electronic devices connected via a communication network correctly handle exceptions
JP6898527B2 (en) Operating system repair via electronics
CN117215995B (en) Remote direct memory access method, distributed storage system and electronic equipment
EP4304154A1 (en) Information processing device, information processing method, program, and information processing system
CN115037723A (en) Full-link system autonomous delivery method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant