CN114328005A - Method and system for incremental backup of container data - Google Patents

Method and system for incremental backup of container data Download PDF

Info

Publication number
CN114328005A
CN114328005A CN202111052173.4A CN202111052173A CN114328005A CN 114328005 A CN114328005 A CN 114328005A CN 202111052173 A CN202111052173 A CN 202111052173A CN 114328005 A CN114328005 A CN 114328005A
Authority
CN
China
Prior art keywords
data
container
backup
snapshot
copy
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.)
Granted
Application number
CN202111052173.4A
Other languages
Chinese (zh)
Other versions
CN114328005B (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.)
Shenzhen Mulangyun Technology Co ltd
Original Assignee
Shenzhen Mulangyun 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 Shenzhen Mulangyun Technology Co ltd filed Critical Shenzhen Mulangyun Technology Co ltd
Priority to CN202111052173.4A priority Critical patent/CN114328005B/en
Publication of CN114328005A publication Critical patent/CN114328005A/en
Application granted granted Critical
Publication of CN114328005B publication Critical patent/CN114328005B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention provides a method and a system for incremental backup of container data. The method comprises the following steps: only creating a snapshot for the service data of the container or copying a volume shadow to obtain a copy of the service data; judging whether the snapshot is created for the first time or the volume shadow copy is carried out for the first time; under the condition that a snapshot is created for the first time or the shadow copy is carried out for the first time, exporting the obtained copy of the service data into a file, otherwise, comparing the obtained copy of the service data with the copy of the service data obtained last time to obtain difference data, and exporting the difference data into the file; based on the exported file, backing up the business data of the container. The problem that container layering storage leads to resumeing backup copy mirror image grow is solved in this application, has the beneficial effect of saving storage space.

Description

Method and system for incremental backup of container data
Technical Field
The disclosure relates to the field of cloud storage, in particular to a method and a system for incremental backup of container data.
Background
Container (container) is a lightweight virtualization technology to implement packaging, running, and resource isolation of operating systems and applications. The container generally runs on a host, an independent running environment is arranged inside the container, the container is isolated from the host where the container is located, the container has the advantages of being multi-tenant, light in weight, consistent, easy to migrate and the like, and the disposition of containerized application programs in public clouds and private clouds becomes a main trend. However, when a host fails or a user performs a misoperation, the container instance may terminate unexpectedly, even information is lost, and protection of the container data is an urgent problem to be solved.
The current container data protection technologies mainly include the following:
one is to have the backup and restore mechanism built inside the container. The data backup is realized to the local by mainly an enterprise IT administrator through a script. The mode lacks effective backup data historical version management, and scripts are difficult to maintain when the environment is changed; moreover, like the conventional local data backup and recovery method, the method does not have the data protection capability when a single point of failure occurs in the local device, and container data recovery through the failed device is difficult.
Secondly, a mirror image method is adopted to carry out container data backup and recovery. The method mainly packs the running containers into mirror images, then pushes the mirror images to a mirror image warehouse for storage as backup, and restores the backup of the containers by pulling the mirror images in the mirror image warehouse. Even if a docker commit command is used, the storage layer of the container can be stored to be used as a mirror image, namely, the storage layer of the container is superposed on the original mirror image to form a new mirror image, and the new mirror image is stored in a private warehouse to complete the backup of the container. In addition, a new container is created by using the stored new mirror image, so that the container can be recovered, and the phenomenon that information is lost when the container instance is terminated accidentally is avoided. The mirroring mode needs a storage space with the same size as the data of the source container, and mirroring recovery also involves copying and transmitting the whole data content, which consumes large communication bandwidth and computing resources and has slow recovery speed. If the container is used for the storage of the container in a layered mode, the data of each previous layer cannot be changed except the current layer if the container is used for making the mirror image through the docker commit, and if the container is subjected to backup and recovery operations for multiple times, the mirror image backed up by the container is larger and larger, and a large amount of space is consumed. Moreover, the scheme is against the principle of separation of calculation and data and is not a reasonable scheme.
Thirdly, backup and recovery of the container data are carried out by adopting a snapshot method. Inquiring all running processes in the container mainly through an information backup instruction, and storing process information of the processes into a process log file, wherein the process information comprises user information, a starting command and process starting parameters; and creating a snapshot for the process log file so as to restore the process information through the log file in the future. The snapshot reduces the time window of the consistent backup, and can avoid the loss caused by shutdown backup. However, when the data needs to be restored to any point, a plurality of snapshot data are generated, and the data redundancy is large, which consumes a large storage space.
In view of the above problems, no effective solution has been proposed.
Disclosure of Invention
The embodiment of the disclosure provides a method and a system for incremental backup of container data, which at least solve the technical problem that a backup mirror image is enlarged due to container hierarchical storage.
According to an aspect of the embodiments of the present disclosure, there is provided a method for incremental backup of container data, including: only creating a snapshot for the service data of the container or copying a volume shadow to obtain a copy of the service data; judging whether the snapshot is created for the first time or the volume shadow copy is carried out for the first time; under the condition that a snapshot is created for the first time or the shadow copy is carried out for the first time, exporting the obtained copy of the service data into a file, otherwise, comparing the obtained copy of the service data with the copy of the service data obtained last time to obtain difference data, and exporting the difference data into the file; based on the exported file, backing up the business data of the container.
According to another aspect of the embodiments of the present disclosure, there is also provided a method of data recovery, including: obtaining backup data obtained by backup according to the method; importing the backup data into the storage medium, and recovering the snapshot or the volume shadow copy; the storage medium is rolled back to a state corresponding to the snapshot or a state corresponding to the volume shadow copy; and mapping the data directory in the storage medium after the rollback into the container, and rerunning the container to recover the data in the container.
According to another aspect of the embodiments of the present disclosure, there is also provided a system for incremental backup of container data, including a backup client configured to: only creating a snapshot for the service data of the container or copying a volume shadow to obtain a copy of the service data; judging whether the snapshot is created for the first time or the volume shadow copy is carried out for the first time; under the condition that a snapshot is created for the first time or the shadow copy is carried out for the first time, exporting the obtained copy of the service data into a file, otherwise, comparing the obtained copy of the service data with the copy of the service data obtained last time to obtain difference data, and exporting the difference data into the file; a backup system configured to backup the business data of the container based on the exported file.
According to another aspect of the embodiment of the present disclosure, there is also provided a system for incremental backup of container data, which obtains backup data obtained by performing backup according to the above method; importing the backup data into the storage medium, and recovering the snapshot or the volume shadow copy; the storage medium is rolled back to a state corresponding to the snapshot or a state corresponding to the volume shadow copy; and mapping the data directory in the storage medium after the rollback into the container, and rerunning the container to recover the data in the container.
In an embodiment of the present disclosure, the method comprises: only creating a snapshot for the service data of the container or copying a volume shadow to obtain a copy of the service data; judging whether the snapshot is created for the first time or the volume shadow copy is carried out for the first time; under the condition that a snapshot is created for the first time or the shadow copy is carried out for the first time, exporting the obtained copy of the service data into a file, otherwise, comparing the obtained copy of the service data with the copy of the service data obtained last time to obtain difference data, and exporting the difference data into the file; and backing up the service data of the container based on the exported file, thereby solving the technical problem that the backup mirror image for recovery is enlarged due to the layered storage of the container.
Drawings
The accompanying drawings, which are included to provide a further understanding of the disclosure and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the disclosure and together with the description serve to explain the disclosure and not to limit the disclosure. In the drawings:
FIG. 1 is a flow chart of a method for incremental backup of container data according to a first embodiment of the present disclosure;
FIG. 2 is a flow chart of a method for incremental backup of container data according to a second embodiment of the present disclosure;
FIG. 3 is a flow chart of a method for incremental backup of container data according to a third embodiment of the present application;
FIG. 4 is a flow chart of a data recovery method according to a fourth embodiment of the present application;
FIG. 5 is a schematic diagram of a container data incremental backup system according to an embodiment of the present disclosure;
FIG. 6 is a schematic diagram of another incremental backup system for container data according to an embodiment of the present disclosure;
FIG. 7 is a schematic diagram of a further incremental backup and restore system for container data according to an embodiment of the present disclosure;
FIG. 8 is a flow chart of another method for incremental backup of container data according to an embodiment of the present disclosure.
DETAILED DESCRIPTION OF EMBODIMENT (S) OF INVENTION
In order to make the technical solutions of the present disclosure better understood by those skilled in the art, the technical solutions of the embodiments of the present disclosure will be clearly and completely described below with reference to the drawings in the embodiments of the present disclosure, and it is obvious that the described embodiments are only some embodiments of the present disclosure, not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments disclosed herein without making any creative effort, shall fall within the protection scope of the present disclosure.
It should be noted that the terms "first", "second", and the like in the description and claims of this disclosure and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the disclosure described herein are capable of operation in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Definition of terms
A container: containers are standard units of software that package code and all its dependencies, so applications can run quickly and reliably from one computing environment to another.
Mirroring: a stand-alone, executable software package that includes everything needed to run an application: code, system tools, system libraries, and configurations. In a popular way, the mirror image is a read-only template, and after the mirror image is operated, the mirror image is a container, and the container can generate operation data. The current state of the running container may also be packaged as a mirror.
Mirror image warehouse: the tool for storing and managing the mirror image can enable a user to upload the mirror image to the mirror image warehouse through a network and pull the mirror image from the mirror image warehouse through the network.
Host machine: generally, a computer refers to a physical hardware that includes a CPU, a memory, a hard disk, a network card, and other devices, an operating system runs on the hardware computer, and application software runs on the operating system. In the scenario where a container is used, the software runs in the container and the container runs in the operating system. The operating system and hardware computer on which the container runs are referred to as the container's host.
And (3) directory mapping: because the container is internally provided with an independent operating environment which is isolated from the host machine where the container is located, if the container needs to access the storage medium of the host machine, the directory of the host machine needs to be mapped with the directory in the container. If the host's directory is not mapped into a container, the container will use the internal directory as a data store and be isolated from the host.
Hierarchical storage: when the mirror image is constructed, the mirror image is constructed layer by layer, and the former layer is the foundation of the latter layer. No changes occur after each layer is built, and any changes on the latter layer only occur on its own layer. For example, an operation of deleting a file in a previous layer does not actually delete the file in the previous layer, but only marks the file deleted in the current layer. While this file is not visible when the final container is running, in reality it will always follow the mirror image. Each commit triggers the building of a layer on its original basis. The mirror image becomes larger and larger after a number of constructions.
Snapshot: with respect to a fully available copy of a given data set, the copy includes an image of the corresponding data at some point in time (the point in time at which the copy begins). The snapshot may be a copy of the data it represents or may be a replica of the data. The image data may be restored to the specified data set.
Snapshot rollback (rollback): the data in the storage medium is rolled back to the state at the time of snapshot creation.
And (3) snapshot export: refers to exporting the contents of a snapshot to a file in a particular format.
And (3) snapshot importing: refers to importing a snapshot exported file into a snapshot.
Full backup: all data of the current data set is backed up.
Incremental backup: only the difference between the current data set and the previously backed up data set is backed up.
SUMMARY
The prior method needs to pack the container into a mirror image and export the mirror image, the mirror image comprises the original mirror image and the data operated by the container, the amount of packed data is large, the speed is low, and more storage space is occupied. And the volume of the mirror image which is backed up after recovery is increased and larger storage space is occupied due to the architecture of container layered storage.
The method and the device for realizing the container service data backup realize the quick backup of the container by adopting a container service data snapshot and incremental backup mode.
And the backup object only backs up the container service data by adopting the separation of the container application data and the mirror image. Adopting a mode that a formatted storage medium is directly mounted on a host machine, mapping the storage space as the storage space of the container service data to a container system, and separating the service data from the operation environment; the mounted storage medium is required to support the snapshot technology, only the mounted storage medium is processed during backup, separation of container application data and mirror images is achieved, and data volume of a backup object is greatly reduced.
The backup is an incremental backup mode which adopts service data snapshots. Creating a snapshot for a storage medium of container service data and exporting the snapshot as a file; and then comparing the difference data between the snapshots to derive only the data of the difference part so as to realize the incremental backup of the container data. The backup needs less data amount to be packed, the speed is high, and smaller storage space is occupied.
In this way, snapshot export is created directly through the container service data storage medium, which increases backup speed compared to accessing container data via a file system.
Example 1
An embodiment of the present disclosure provides a container data incremental backup method, as shown in fig. 1, the method includes the following steps:
step S102, only creating a snapshot for the business data of the container or copying the volume shadow to obtain a copy of the business data.
Before copying a container, mounting a storage medium on a host corresponding to the container, and taking the storage medium as a storage space of service data of the container; storing operation data of the container in the container and storing service data of the container in the storage medium so that the service data is separated from the operation data; wherein the storage medium supports a snapshot technique or a volume shadow copy technique.
Then, creating a data directory on the host machine using the storage medium; mapping the created data directory into the container to serve as the data directory of the container, so that the business data can be stored in the created data directory when the container runs; the container is activated.
And then, only creating a snapshot for the business data of the container or copying a volume shadow to obtain a copy of the business data.
Step S104, determine whether to create the snapshot for the first time or to copy the shadow for the first time.
And step S106, under the condition that the snapshot is created for the first time or the shadow copy is carried out for the first time, exporting the copy of the obtained service data into a file, otherwise, comparing the copy of the obtained service data with the copy of the service data obtained last time, acquiring the difference data, and exporting the difference data into the file.
Step S108, based on the exported file, backing up the service data of the container.
Under the condition that the snapshot is not created for the first time or the volume shadow copy is carried out for the first time, combining the file with the file exported last time to generate full backup data, and writing the full backup data into the high-availability storage for backup; under the condition that a snapshot is created for the first time or the volume shadow copy is carried out for the first time, directly writing the exported file into the high-availability storage for backup; the high-availability storage is a high-availability data storage cluster constructed by a plurality of servers, and the high-availability data storage cluster can support data writing modes of iSCSI (Internet Small Computer System interface) block equipment, NFS (network File System) network File System, object storage and Samba shared directory.
In the related art, the container mirror image includes both the original mirror image and the data of the container operation, which results in a large amount of packed data and large storage space consumption. According to the method and the device, the operation data and the service data of the container are separated, so that the problem that the backup image is restored to be enlarged due to the layered storage of the container is solved, and the beneficial effect of saving the storage space is achieved.
In addition, in the related art, each backup of the container mirror can backup all data including data which is backed up before but is not modified, the backup data volume is large, and the backup time is long. And the storage space of the data is further reduced by the method of incremental backup.
Example 2
An embodiment of the present disclosure provides a flowchart of a method for data recovery, as shown in fig. 2, the method includes the following steps:
step S202, backup data is acquired.
Backup data obtained by performing backup according to the method in embodiment 1 is acquired.
Step S204, importing the backup data into the storage medium, and restoring the snapshot or the volume shadow copy.
Step S206, rolling back the storage medium to a state corresponding to the snapshot or a state corresponding to the volume shadow copy.
And step S208, mapping the data directory in the storage medium after the rollback to the container, and rerunning the container to recover the data in the container.
Example 3
Referring to fig. 3, fig. 3 is a flowchart of a container data incremental backup method according to a third embodiment of the present application. As will be described in detail with respect to the flow shown in fig. 3, the method for incremental backup of container data may specifically include the following steps:
using the storage medium at the host, and performing the following steps:
in step S301, a container is ready for operation.
Step S302, a data directory is created using a storage medium that supports snapshots.
A directory is created using the snapshot-capable storage medium for storing operational data of the container. The storage medium supporting the snapshot may include a software and hardware storage device supporting the snapshot and a file system.
Step S303, map the data directory to the container data directory, and start the container.
And mapping the created data directory into the container to be used as a container data directory. Storing data into the directory when the container runs
On the backup system and the backup client side, the following steps are performed:
step S304, a backup instruction is issued.
And the backup system issues a backup instruction and sends the backup instruction to the backup client.
Step S305, creating a storage medium snapshot is performed.
And the backup client maps the created data directory into the container to be used as a container data directory. The container runtime stores the run data into the directory.
The backup client creates a snapshot through the host storage medium. In the storage medium, all current data blocks are marked, and if the content of the future data blocks changes, the data blocks are copied and then the data are modified. This ensures that the data in the storage medium is restored to the point in time at which the snapshot was created.
Step S306, determine whether it is the first time to create a snapshot.
And judging whether the snapshot is created for the first time, if so, executing the step S307, otherwise, executing the step S308.
Step S307, exporting the snapshot data to a file and backing up.
Based on the determination result in step S306, that is, it is the first time the snapshot is created, the entire contents of the snapshot are exported to the backup file.
Step S308, exporting the difference data between the current snapshot and the last snapshot to a backup file.
And exporting the difference data between the current snapshot and the last snapshot to the backup file to achieve the purpose of incremental data backup.
Step S309, the file is sent to the backup system.
The backup file is sent to the backup system.
Step S310, incremental or full backup of files.
If the backup is the first backup, the backup file is saved, and the backup is completed; otherwise. And merging the difference data exported this time and the last backup data into full backup data, and then storing the full backup data to complete the backup.
In this embodiment, a backup client, a backup system, and a host are distinguished. In other embodiments, the backup client and the host may be integrated on one physical device, or the backup client, the backup system, and the host may be integrated on one physical device.
According to the embodiment of the application, a container data backup method combining snapshot full quantity and incremental backup is adopted, and incremental backup data and last backup data are combined to achieve full quantity backup, so that storage space is saved.
In addition, the embodiment only exports the data of the snapshot difference part twice as the incremental backup, so that the copied data amount is reduced, and the storage space and the consumption of computing resources are also reduced.
Example 4
Referring to fig. 4, fig. 4 is a flowchart of a container data incremental backup method according to a fourth embodiment of the present application. As will be described in detail with respect to the flow shown in fig. 4, the method for incremental backup of container data may specifically include the following steps:
step S401: and issuing a recovery instruction.
And the backup system issues a recovery instruction.
Step S402: and acquiring a recovery file.
And the backup client acquires the restored backup file.
Step S403: and importing the backup data file into the storage medium snapshot.
And importing the backup file into the host computer storage medium snapshot.
Step S404: and returning the data of the storage medium to the snapshot state.
And returning the host storage medium to a snapshot state, wherein all the data accessed in the storage medium is the data at the moment of creating the snapshot.
Step S405: the data directory is mapped to a container data directory and the container is started.
And mapping the data directory into a container data directory, and starting the container. All data accessed by the application in the container at this time is the data at the time the snapshot was created.
Step S406: the recovery is completed.
Example 5
The embodiment of the present application provides a container data incremental backup system, which includes a backup client 52, a backup system 54, and a container 56, see fig. 5.
Backup client 52 is configured to: only creating a snapshot for the service data of the container 56 or performing a volume shadow copy to obtain a copy of the service data; judging whether the snapshot is created for the first time or the volume shadow copy is carried out for the first time; and under the condition that the snapshot is created for the first time or the shadow copy is carried out for the first time, exporting the obtained copy of the service data into a file, otherwise, comparing the obtained copy of the service data with the copy of the service data obtained last time, acquiring the difference data, and exporting the difference data into the file.
The backup system 54 is configured to backup the business data of the container based on the exported file.
In an exemplary embodiment, the backup client 52 is further configured to store the operation data of the container 56 in the container 56, and store the business data of the container 56 in the storage medium, so that the business data is separated from the operation data; wherein the storage medium supports a snapshot technique or a volume shadow copy technique; wherein the storage medium is mounted on a host corresponding to the container and serves as a storage space for the service data of the container.
In an exemplary embodiment, the incremental backup system for container data further comprises a host, on which the backup client 52 runs and is configured to: creating a data catalog on the host using the storage media; mapping the created data directory into the container as a data directory of the container 56, so that the container 56 can store the business data into the created data directory when running; the container 56 is activated.
It should be noted that, in the present specification, the embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments may be referred to each other. For the device-like embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment. For any processing manner described in the method embodiment, all the processing manners may be implemented by corresponding processing modules in the apparatus embodiment, and details in the apparatus embodiment are not described again.
Example 6
The embodiment of the present application provides a container data incremental backup and recovery system, which includes a backup system 54 and a host 60, see fig. 6.
Backup system 54 includes a backup system web module 540, a backup system scheduling system module 542, and a backup system storage module 544. The backup system scheduling system module 542 includes a task policy management 5420 and a scheduling engine 5422; the backup system storage module 544 includes high availability storage 5442 and a storage gateway 5444.
The backup system web module 540 is used for providing an operation interface for IT operation and maintenance personnel, and the operation and maintenance personnel initiates a backup or recovery operation through the web.
The backup system scheduling system module 542 schedules task requests from the task policy management 5420 or the backup system web module 540 via the scheduling engine 5422 and issues tasks to the backup client 52.
The host 60 runs an operating system 602, the backup client 52 is installed on the operating system 602, and a container 6022 is further provided. Backup client 52 is used to receive tasks from scheduler engine 5422 and performs the following operations: creating a snapshot of the running data used by the corresponding container 6022; exporting the snapshot as a backup file; the backup file is sent to the backup system storage module 544 for processing.
The storage gateway 5444 of the backup system storage module 544 is configured to receive the backup file, merge the incremental data into full backup data, and write the full backup data into the high-availability storage 5442. The high availability storage 5442 builds a high availability data storage cluster through multiple servers for providing high availability storage that supports iSCSI block devices, NFS network file systems, object storage, and Samba shared directories.
Example 7
The embodiment of the present application provides another container data incremental backup and recovery system, which is shown in fig. 7 and includes a backup system 54 and a host 60.
Backup system 54 includes a backup schedule 702 and a distributed storage system 704, where distributed storage system 704 is comprised of a plurality of servers.
The host 60 runs an operating system, and the operating system is installed with the backup client 52 and the container application 706, and is mounted with a storage medium 708 supporting a snapshot.
The work flow of the container data incremental backup and recovery system is as follows:
the user creates a data catalog on host 60 using storage media 708 that supports snapshot techniques and maps the data catalog to container internal storage. The container starts one or more of the container applications 706 (i.e., application software in the container), the resulting data is written into the mapping directory, and the application data (i.e., business data) for the container is actually stored in the storage medium 708 that supports the snapshot technique.
When a user needs to perform backup, a snapshot may be created for the storage medium 708, where the snapshot data only includes the service data of the container, and then the snapshot is exported to a file; the user can export the data of a certain snapshot to play a role of full backup; or the difference data between two snapshots is selected to be exported to play the role of incremental backup.
And combining the derived difference data with the previous full data to obtain the second full data.
Backup client 52 sends the data to distributed storage system 704 for long-term backup storage.
In an exemplary embodiment, the backup data may also be restored. The exported backup data is imported to the storage medium 708 on the host 60, the snapshot is restored, and then the storage medium 708 is rolled back to the restored snapshot. Recovery of the data may be accomplished by mapping the data directory in the storage medium 708 after rollback to a container and re-running the container.
Example 8
Referring to fig. 8, fig. 8 is a flowchart illustrating another method for incremental backup of container data according to an embodiment of the present disclosure. As will be described in detail with respect to the flow shown in fig. 8, the method for incremental backup of container data may specifically include the following steps:
using the storage medium at the host, and performing the following steps:
step S801, a container operation preparation.
In step S802, a data directory is created using a storage medium that supports volume shadow copy.
A directory is created for storing operational data of the container using a storage medium supporting volume shadow replication. The storage medium supporting the volume shadow copy can comprise a software and hardware storage device supporting the volume shadow copy and a file system.
Step S803, map the data directory to the container data directory, and start the container.
And mapping the created data directory into the container to be used as a container data directory. Storing data into the directory when the container runs
On the backup system and the backup client side, the following steps are performed:
step S804, a backup instruction is issued.
And the backup system issues a backup instruction and sends the backup instruction to the backup client.
In step S805, creating a storage medium volume shadow copy is performed.
And the backup client maps the created data directory into the container to be used as a container data directory. The container runtime stores the run data into the directory.
The backup client creates a volume shadow copy through the host storage media. In the storage medium, all current data blocks are marked, and if the content of the future data blocks changes, the data blocks are copied and then the data are modified. This ensures that the data in the storage medium is restored to the point in time that the shadow copy was created.
In step S807, it is determined whether or not the first creation of the shadow copy is performed.
And judging whether the creation of the volume shadow copy is the first time, if so, executing the step S808, otherwise, executing the step S809.
In step S808, the volume shadow copy data is exported to a file and backed up.
Based on the determination result in step S807 that it is the first time that the volume shadow copy is created, the entire contents of the volume shadow copy are exported to the backup file.
In step S809, difference data between the current volume shadow copy and the last volume shadow copy is exported to the backup file.
And exporting the difference data between the volume shadow copy and the last volume shadow copy to the backup file to achieve the purpose of incremental backup of data.
Step S810, sending the file to the backup system.
The backup file is sent to the backup system.
The file is backed up in step S811.
If the backup is the first backup, the backup file is saved, and the backup is completed; otherwise. And merging the difference data exported this time and the last backup data into full backup data, and then storing the full backup data to complete the backup.
In this embodiment, a backup client, a backup system, and a host are distinguished. In other embodiments, the backup client and the host may be integrated on one physical device, or the backup client, the backup system, and the host may be integrated on one physical device.
According to the embodiment of the application, the container mapping file is copied and backed up after a copy time point is created on a specific volume through volume shadow copying, and then the difference file is stored after the difference comparison of the two copied files is carried out, so that the storage space is saved.
In addition, the embodiment only exports the data of the snapshot difference part twice as the incremental backup, so that the copied data amount is reduced, and the storage space and the consumption of computing resources are also reduced.
Example 9
Embodiments of the present disclosure also provide a storage medium. Optionally, in this embodiment, the storage medium may implement the method for incremental backup of container data or the data recovery method described in the foregoing embodiment.
Optionally, in this embodiment, the storage medium may be located in at least one network device of a plurality of network devices in a network of the inertial navigation system.
Optionally, in this embodiment, the storage medium may include, but is not limited to: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
Alternatively, in the present embodiment, the processor executes the method in embodiment 1 described above according to the program code stored in the storage medium.
The method and the system for incremental backup of container data and the method and the system for data recovery provided by the application can be applied to many scenes.
For example, company a uses a storage medium supporting snapshot technology for container storage, deploys an application using a container, and exports a backup from a snapshot of the storage medium by using data generated during the running of the application; a backup of the difference data between the two snapshots may be derived.
For another example, company a application may have an accident during the operation process to cause the loss of the operation data, and may restore the data to the storage medium after the differential backup data is merged with the previous backup data, and then map the medium to the container and restart the application.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules or units described in the embodiments of the present disclosure may be implemented by software or hardware. The modules or units described may also be provided in a processor, the names of which in some cases do not constitute a limitation of the module or unit itself.
The above-mentioned serial numbers of the embodiments of the present disclosure are merely for description and do not represent the merits of the embodiments.
The integrated unit in the above embodiments, if implemented in the form of a software functional unit and sold or used as a separate product, may be stored in the above computer-readable storage medium. Based on such understanding, the technical solution of the present disclosure may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing one or more computer devices (which may be personal computers, servers, network devices, etc.) to execute all or part of the steps of the method according to the embodiments of the present disclosure.
In the above embodiments of the present disclosure, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed client may be implemented in other manners. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one type of division of logical functions, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present disclosure may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The foregoing is only a preferred embodiment of the present disclosure, and it should be noted that, for those skilled in the art, several modifications and decorations can be made without departing from the principle of the present disclosure, and these modifications and decorations should also be regarded as the protection scope of the present disclosure.

Claims (10)

1. A method for incremental backup of container data, comprising:
only creating a snapshot for the service data of the container or copying a volume shadow to obtain a copy of the service data;
judging whether the snapshot is created for the first time or the volume shadow copy is carried out for the first time;
under the condition that a snapshot is created for the first time or the shadow copy is carried out for the first time, exporting the obtained copy of the service data into a file, otherwise, comparing the obtained copy of the service data with the copy of the service data obtained last time to obtain difference data, and exporting the difference data into the file;
based on the exported file, backing up the business data of the container.
2. The method of claim 1, wherein before snapshot creation or volume shadow copy is performed only on the container's business data, the method further comprises:
mounting a storage medium on a host corresponding to the container, and taking the storage medium as a storage space of the service data of the container;
storing operation data of the container in the container and storing service data of the container in the storage medium so that the service data is separated from the operation data;
wherein the storage medium supports a snapshot technique or a volume shadow copy technique.
3. The method of claim 2, wherein after mounting the storage medium to a host corresponding to the container, the method further comprises:
creating a data catalog on the host using the storage media;
mapping the created data directory into the container to serve as the data directory of the container, so that the business data can be stored in the created data directory when the container runs;
the container is activated.
4. The method of claim 1, wherein backing up the business data of the container based on the exported file comprises:
under the condition that the snapshot is not created for the first time or the volume shadow copy is carried out for the first time, combining the file with the file exported last time to generate full backup data, and writing the full backup data into the high-availability storage for backup;
under the condition that a snapshot is created for the first time or the volume shadow copy is carried out for the first time, directly writing the exported file into the high-availability storage for backup;
the high-availability storage is a high-availability data storage cluster constructed by a plurality of servers, and the high-availability data storage cluster can support the data writing mode of iSCSI block equipment, NFS network file system, object storage and Samba shared directory.
5. A method of data recovery, comprising:
obtaining backup data obtained by backup according to the method of any one of claims 1 to 4;
importing the backup data into the storage medium, and recovering the snapshot or the volume shadow copy;
the storage medium is rolled back to a state corresponding to the snapshot or a state corresponding to the volume shadow copy;
and mapping the data directory in the storage medium after the rollback into the container, and rerunning the container to recover the data in the container.
6. A system for incremental backup of container data, comprising:
a backup client configured to:
only creating a snapshot for the service data of the container or copying a volume shadow to obtain a copy of the service data;
judging whether the snapshot is created for the first time or the volume shadow copy is carried out for the first time;
under the condition that a snapshot is created for the first time or the shadow copy is carried out for the first time, exporting the obtained copy of the service data into a file, otherwise, comparing the obtained copy of the service data with the copy of the service data obtained last time to obtain difference data, and exporting the difference data into the file;
a backup system configured to backup the business data of the container based on the exported file.
7. The system of claim 6, wherein:
the backup client is further configured to store the operation data of the container in the container and store the service data of the container in the storage medium, so that the service data is separated from the operation data;
wherein the storage medium supports a snapshot technique or a volume shadow copy technique;
wherein the storage medium is mounted on a host corresponding to the container and serves as a storage space for the service data of the container.
8. The system of claim 7, wherein the backup client is further configured to:
creating a data catalog on the host using the storage media;
mapping the created data directory into the container to serve as the data directory of the container, so that the business data can be stored in the created data directory when the container runs;
the container is activated.
9. The system of claim 6, wherein the backup system comprises a storage gateway and a high available storage, wherein the storage gateway is configured to:
under the condition that the snapshot is not created for the first time or the volume shadow copy is carried out for the first time, merging the file with the file exported last time to generate full backup data, and writing the full backup data into the high-availability storage for backup;
under the condition that a snapshot is created for the first time or the volume shadow copy is carried out for the first time, directly writing the exported file into the high-availability storage for backup;
the high-availability storage is a high-availability data storage cluster constructed by a plurality of servers, and the high-availability data storage cluster can support the data writing mode of iSCSI block equipment, NFS network file system, object storage and Samba shared directory.
10. A system for data recovery, comprising a backup client, a container, and a storage medium, wherein the backup client is configured to:
obtaining backup data obtained by backup according to the method of any one of claims 1 to 4;
importing the backup data into the storage medium, and recovering the snapshot or the volume shadow copy;
the storage medium is rolled back to a state corresponding to the snapshot or a state corresponding to the volume shadow copy;
and mapping the data directory in the storage medium after the rollback into the container, and rerunning the container to recover the data in the container.
CN202111052173.4A 2021-09-08 2021-09-08 Method and system for incremental backup of container data Active CN114328005B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111052173.4A CN114328005B (en) 2021-09-08 2021-09-08 Method and system for incremental backup of container data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111052173.4A CN114328005B (en) 2021-09-08 2021-09-08 Method and system for incremental backup of container data

Publications (2)

Publication Number Publication Date
CN114328005A true CN114328005A (en) 2022-04-12
CN114328005B CN114328005B (en) 2022-08-26

Family

ID=81045333

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111052173.4A Active CN114328005B (en) 2021-09-08 2021-09-08 Method and system for incremental backup of container data

Country Status (1)

Country Link
CN (1) CN114328005B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115454723A (en) * 2022-09-28 2022-12-09 安超云软件有限公司 Data backup and recovery method and system based on storage snapshot
WO2023241466A1 (en) * 2022-06-17 2023-12-21 中兴通讯股份有限公司 Disaster recovery system control method, disaster recovery system, electronic apparatus and readable storage medium

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100114828A1 (en) * 2008-11-03 2010-05-06 Mats Persson Method, system and computer-readable media for backing up information contained in a database
US20100169590A1 (en) * 2008-12-31 2010-07-01 Clint Gordon-Carroll Providing backups using a portable storage device
CN103176867A (en) * 2013-04-02 2013-06-26 浪潮电子信息产业股份有限公司 Fast file differential backup method
CN106445738A (en) * 2016-09-13 2017-02-22 郑州云海信息技术有限公司 Database backup method and device
CN107621992A (en) * 2017-09-15 2018-01-23 深圳粒云科技有限公司 It is a kind of to separate and back up the software of windows computer user data
CN109558215A (en) * 2018-12-10 2019-04-02 深圳市木浪云数据有限公司 Backup method, restoration methods, device and the backup server cluster of virtual machine
CN111158958A (en) * 2019-12-31 2020-05-15 广州鼎甲计算机科技有限公司 Backup method, system, device and storage medium capable of quickly recovering data
CN111177122A (en) * 2019-12-29 2020-05-19 苏州浪潮智能科技有限公司 Database backup method, device, equipment and computer readable storage medium
CN111190702A (en) * 2020-01-14 2020-05-22 山东超越数控电子股份有限公司 Cross-node hot migration method for Docker
CN112487265A (en) * 2020-11-30 2021-03-12 北京大豪工缝智控科技有限公司 Data processing method and device, computer storage medium and electronic equipment

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100114828A1 (en) * 2008-11-03 2010-05-06 Mats Persson Method, system and computer-readable media for backing up information contained in a database
US20100169590A1 (en) * 2008-12-31 2010-07-01 Clint Gordon-Carroll Providing backups using a portable storage device
CN103176867A (en) * 2013-04-02 2013-06-26 浪潮电子信息产业股份有限公司 Fast file differential backup method
CN106445738A (en) * 2016-09-13 2017-02-22 郑州云海信息技术有限公司 Database backup method and device
CN107621992A (en) * 2017-09-15 2018-01-23 深圳粒云科技有限公司 It is a kind of to separate and back up the software of windows computer user data
CN109558215A (en) * 2018-12-10 2019-04-02 深圳市木浪云数据有限公司 Backup method, restoration methods, device and the backup server cluster of virtual machine
CN111177122A (en) * 2019-12-29 2020-05-19 苏州浪潮智能科技有限公司 Database backup method, device, equipment and computer readable storage medium
CN111158958A (en) * 2019-12-31 2020-05-15 广州鼎甲计算机科技有限公司 Backup method, system, device and storage medium capable of quickly recovering data
CN111190702A (en) * 2020-01-14 2020-05-22 山东超越数控电子股份有限公司 Cross-node hot migration method for Docker
CN112487265A (en) * 2020-11-30 2021-03-12 北京大豪工缝智控科技有限公司 Data processing method and device, computer storage medium and electronic equipment

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
SHYAMSUNDER INGLE 等: "Designing Secured Incremental Backup System for Cloud", 《INTERNATIONAL JOURNAL OF COMPUTER SCIENCE AND INFORMATION TECHNOLOGIES》 *
阿昌先生: "docker数据卷和docker数据卷容器以及数据卷的备份和还原", 《HTTPS://WWW.CNBLOGS.COM/TALKJD-04/P/10491115.HTML》 *
韩怿冰 等: "云存储环境下的用户数据安全机制研究", 《数据安全与云计算》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023241466A1 (en) * 2022-06-17 2023-12-21 中兴通讯股份有限公司 Disaster recovery system control method, disaster recovery system, electronic apparatus and readable storage medium
CN115454723A (en) * 2022-09-28 2022-12-09 安超云软件有限公司 Data backup and recovery method and system based on storage snapshot

Also Published As

Publication number Publication date
CN114328005B (en) 2022-08-26

Similar Documents

Publication Publication Date Title
US11294768B2 (en) Live browsing of backed up data residing on cloned disks
US11099956B1 (en) Snapshot-based disaster recovery orchestration of virtual machine failover and failback operations
US20210224166A1 (en) Database snapshot and backup management with recoverable chains
US11816005B2 (en) Systems and methods for change block tracking for backing up changed data
US20220245037A1 (en) Hypervisor-independent reference copies of virtual machine payload data based on block-level pseudo-mount
EP2494456B1 (en) Backup using metadata virtual hard drive and differential virtual hard drive
US20200401485A1 (en) Using a pseudo-disk driver for indexing contents and metadata of block-level backup copies, including block-level backup copies of virtual machine data files
US8688645B2 (en) Incremental restore of data between storage systems having dissimilar storage operating systems associated therewith
CN102594849B (en) Data backup and recovery method and device, virtual machine snapshot deleting and rollback method and device
CA2851200C (en) Synchronizing updates across cluster filesystems
US20190243683A1 (en) Distributed job scheduler with job stealing
US11074138B2 (en) Multi-streaming backup operations for mailboxes
US11256579B2 (en) Array integration for virtual machine backup
US7979649B1 (en) Method and apparatus for implementing a storage lifecycle policy of a snapshot image
US8578203B2 (en) Providing a backup service from a remote backup data center to a computer through a network
CN114328005B (en) Method and system for incremental backup of container data
KR20150021117A (en) Enhanced data management virtualization system
US10990440B2 (en) Real-time distributed job scheduler with job self-scheduling
CN115098299B (en) Backup method, disaster recovery method, device and equipment of virtual machine
CN112000282A (en) Storage double-live method, device and related components
CN112148532A (en) Batch recovery method and device for hard disk data, storage medium and electronic equipment

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