Data updating method and device for container file system and electronic equipment
By mounting a preset directory of the remote file system on the node device and updating the container file system state, the problem of container data loss during migration is solved, and cross-node persistence and free scheduling of container data are realized, improving the user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING BAIDU NETCOM SCI & TECH CO LTD
- Filing Date
- 2026-05-06
- Publication Date
- 2026-07-21
AI Technical Summary
In the Kubernetes architecture, non-persistent data in container file systems is easily lost during container migration and updates, and existing technologies struggle to achieve cross-node persistence of container data.
By mounting a preset directory of a remote file system on the node device and updating the container's file system state based on the image file, cross-node persistence of container data is achieved.
When migrating or restarting containers, the original running state can be reproduced, reducing the complexity of operation and maintenance, improving the user experience, and optimizing the free scheduling and state following of containers.
Smart Images

Figure CN122431798A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of data processing technology, and more particularly to the fields of file systems, data persistence, and data storage technology. More specifically, this disclosure provides a data update method, apparatus, electronic device, storage medium, and computer program product for a container file system. Background Technology
[0002] In the Kubernetes (k8s) architecture, the container file system of a container group (Pod) is usually temporary. When a Pod is recreated through migration, updates, or other means, the non-persistent data generated by its internal containers during runtime will be lost when the old containers are destroyed. Summary of the Invention
[0003] This disclosure provides a method, apparatus, electronic device, storage medium, and computer program product for updating data in a container file system.
[0004] According to the first aspect, a data update method for a container file system is provided, the method comprising: in response to receiving a creation instruction for instructing the creation of a target container group on a node device, obtaining a target storage declaration for the target container group, the target container group including at least one container; mounting a preset directory of a remote file system to the node device according to the target storage declaration; in response to the existence of an image file corresponding to the target container group in the preset directory, mounting the image file to the file system of each container in the target container group; and updating the file system state of each container based on the image file.
[0005] According to the second aspect, a data update method for a container file system is provided, the method comprising: in response to a target container group on a first node device meeting scheduling conditions, deleting the target container group on the first node device, wherein the target container group is created on the first node device based on a target storage declaration; sending a creation instruction for the target container group to a second node device, such that the second node device mounts a preset directory of a remote file system to the second node device based on the target storage declaration, and updates the file system state of at least one container in the target container group based on an image file under the preset directory.
[0006] According to a third aspect, a data update apparatus for a container file system is provided, the apparatus comprising: an acquisition module, configured to acquire a target storage declaration for the target container group, the target container group including at least one container, in response to receiving a creation instruction instructing the creation of a target container group on a node device; a first mount module, configured to mount a preset directory of a remote file system to the node device according to the target storage declaration; a second mount module, configured to mount an image file corresponding to the target container group to the file system of each container in the target container group in response to the existence of an image file corresponding to the target container group in the preset directory; and an update module, configured to update the file system state of each container based on the image file.
[0007] According to the fourth aspect, a data update apparatus for a container file system is provided, the apparatus comprising: a deletion module, configured to delete a target container group on a first node device in response to a target container group on a first node device meeting scheduling conditions, the target container group being created on the first node device based on a target storage declaration; and an instruction sending module, configured to send a creation instruction for the target container group to a second node device, so that the second node device mounts a preset directory of a remote file system to the second node device based on the target storage declaration, and updates the file system state of at least one container in the target container group based on an image file under the preset directory.
[0008] According to a fifth aspect, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform a method provided according to the present disclosure.
[0009] According to a sixth aspect, a non-transitory computer-readable storage medium is provided storing computer instructions for causing a computer to perform the methods provided in this disclosure.
[0010] According to a seventh aspect, a computer program product is provided, comprising a computer program stored on at least one of a readable storage medium and an electronic device, the computer program implementing the method provided in this disclosure when executed by a processor.
[0011] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0012] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:
[0013] Figure 1This is an exemplary system architecture diagram illustrating a data update method and apparatus for a container file system that can be applied according to an embodiment of the present disclosure;
[0014] Figure 2 This is a flowchart of a data update method according to an embodiment of the present disclosure;
[0015] Figure 3 This is a schematic diagram of the structure of a node device and a remote file system according to an embodiment of the present disclosure;
[0016] Figure 4 This is a flowchart of a data update method according to another embodiment of the present disclosure;
[0017] Figure 5 This is a flowchart of a data update method according to another embodiment of the present disclosure;
[0018] Figure 6 This is a block diagram of a data update apparatus according to an embodiment of the present disclosure;
[0019] Figure 7 This is a block diagram of a data updating apparatus according to another embodiment of the present disclosure; and
[0020] Figure 8 This is a block diagram of an electronic device for a data update method according to an embodiment of the present disclosure. Detailed Implementation
[0021] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0022] The collection, storage, use, processing, transmission, provision, and disclosure of any type of information, such as user personal information, in this technical solution comply with relevant laws and regulations and do not violate public order and good morals.
[0023] In the technical solution disclosed herein, the user's authorization or consent is obtained before acquiring or collecting the user's personal information.
[0024] Figure 1 This is a schematic diagram of an exemplary system architecture for applying a data update method and apparatus for a container file system according to an embodiment of this disclosure. It should be noted that... Figure 1The examples shown are merely examples of system architectures that can be applied to the embodiments of this disclosure, in order to help those skilled in the art understand the technical content of this disclosure, but do not mean that the embodiments of this disclosure cannot be used in other devices, systems, environments or scenarios.
[0025] like Figure 1 As shown, the system architecture 100 according to this embodiment may include a control terminal 10, multiple node devices, and a remote file system 30. The node devices may include node A 21 and node B 22. The node devices and the remote file system 30 can be connected via wired and / or wireless communication links.
[0026] Users can initiate creation requests for PVCs (Persistent Volume Claims) and Pods (container groups) to the control terminal 10. The control terminal 10 determines the storage space and storage type required by the Pod based on the PVC. The control terminal 10 schedules the Pod to a suitable node device and allocates storage space from the remote file system 30 to the Pod based on the required storage type, resource usage, and other information. The remote file system 30 can be, for example, an NFS (Network File System). The remote file system 30 can be set on a different device or server than the multiple node devices, and the multiple node devices can remotely access and read / write the data stored in the remote file system 30 by mounting it.
[0027] Taking scheduling a Pod to node A21 as an example, node A21 uses the CSI (Container Storage Interface) component to mount the mount directory corresponding to the storage space of the remote file system 30 to the local directory in the created Pod. The Pod can run one or more containers, and the containers can read and write data stored in the remote file system 30 through the local directory.
[0028] The data update method for container file systems provided in this disclosure can generally be executed by the control terminal 10 and multiple node devices. Accordingly, the data update device for container file systems provided in this disclosure can be located in the control terminal 10 and multiple node devices.
[0029] Figure 2 This is a flowchart of a data update method according to an embodiment of the present disclosure.
[0030] like Figure 2 As shown, the data update method 200 includes operations S210 to S240.
[0031] In operation S210, in response to receiving a creation instruction for instructing the creation of a target container group on a node device, a target storage declaration for the target container group is obtained, the target container group including at least one container.
[0032] A target container group can refer to a container group that a user requests to be created from the control terminal. A target storage declaration (PVC) can be a storage declaration (PVC) created in advance by the user for the target container group, or a storage declaration pre-stored by the control terminal. Node devices need to create the target container group based on references to the target storage declaration. The target storage declaration specifies the required storage space, storage type, access method, and other information for the target container group.
[0033] When operating S220, the preset directory of the remote file system is mounted to the node device according to the target storage declaration.
[0034] By referencing the target storage declaration, the default directory on the remote file system corresponding to the target storage declaration can be determined. After creating the target container group, the default directory can be mounted to the temporary directory of the node device using the CSI component.
[0035] For example, a target storage declaration can describe that the target container group requires 5GB of storage space, the access method (read / write, read-only, write-only, etc.), and access speed information. When creating a target container group, referencing the target storage declaration allows you to request the corresponding storage space for the target container group in a remote file system.
[0036] In operation S230, in response to the existence of an image file corresponding to the target container group in the preset directory, the image file is mounted to the file system of each container in the target container group.
[0037] The image file corresponding to the target container group can be an img (Image) format file storing the runtime data of each container within the target container group. This runtime data can include persistent data such as database files and message queue data, as well as temporary data such as temporary tools installed within the container and modified system configuration data. If an image file corresponding to the target container group exists in the preset directory, it indicates that the target container group was run on another node device and subsequently destroyed before its creation. To synchronize the runtime status of each container within the target container group, the preset directory can be mounted to the local directory of the target container group. Multiple containers running within the target container group can access the image file in the remote file system and other files in the storage space through the mounted preset directory.
[0038] When operating S240, the file system state of each container is updated based on the image file.
[0039] When starting a container in the target container group, if the image file contains the file data corresponding to the container, the file system state of the container is updated based on the image file, so that the container can be restored to the running state before the destruction of other node devices.
[0040] According to embodiments of this disclosure, the runtime data of the container is stored on a remote file system, and the original runtime state can be reproduced when the container group is restarted or migrated, or when the container is destroyed and rebuilt, thus realizing cross-node persistence of the full data of the container.
[0041] According to embodiments of this disclosure, in response to the absence of an image file corresponding to the target container group in a preset directory, an image file is created in the preset directory; the created image file is mounted to the file system of each container in the target container group.
[0042] If the image file corresponding to the target container group does not exist in the preset directory, it indicates that the target container group being created is a completely new container group, rather than a container group that was created on another node and migrated to the current node, or a container group that was restarted on the current node. The image file corresponding to the target container group can be created in the preset directory and mounted to a directory under the file system of each container in the target container group. This image file is used to write persistent and non-persistent data generated by each container within the target container group.
[0043] According to embodiments of this disclosure, mounting a preset directory of a remote file system to a node device based on a target storage declaration includes: determining the storage space of the target container group in the remote file system based on the target storage declaration; and mounting the preset directory corresponding to the storage space to the node device.
[0044] Based on the target storage declaration, a PV (Persistent Volume) that meets the requirements of the target storage declaration can be identified in the remote file system as the storage space for the target container group's data. A preset directory is created within this storage space for subsequent mount operations. After creating the target container group based on the target storage declaration, the preset directory corresponding to the target storage declaration can be mounted to the temporary directory of the node device, so that it can be further mounted to the local directory of the target container group. Each container can access the image files under the preset directory through the local directory.
[0045] According to embodiments of this disclosure, creating an image file includes: determining the file specifications of the image file based on a target storage declaration; using an image management tool to create the image file in a storage space corresponding to the preset directory based on the file specifications, the image file including a file identifier corresponding to the storage space; and formatting the image file.
[0046] The target storage declaration can characterize the storage requirements of the target container group. Based on the target storage declaration, information such as the file specifications and storage location of the image file can be determined. According to the file specifications, an empty image file of a specified size can be created in the storage space using the image management tool (qemu-img). The created empty image file can be formatted using the mkfs (Make File System) tool of the file system. The metadata structure of the file system is written into the empty image file to obtain a formatted space that can be mounted by node devices and written with data.
[0047] For example, the target storage declaration determines that the image file size is 5GB. The qemu-img tool is used to create a 5GB empty image file in a preset directory on the remote file system, and the mkfs tool is used to format the empty image file, resulting in an image file that can be mounted.
[0048] According to embodiments of this disclosure, the method further includes: determining a storage space and a corresponding file identifier based on a target storage declaration; and detecting whether an image file corresponding to a target container group exists in the storage space based on the file identifier.
[0049] Each PV in the remote file system has a unique name, determined by the target storage declaration. The PV's name can be used to identify the file identifier corresponding to the image file, and this file identifier can be used to locate the image file corresponding to the target container group.
[0050] In the embodiments of this disclosure, when creating an image file, the image file can be named based on the name of the PV, and there is a correspondence between the image file and the PV. When creating a target container group based on a target storage declaration, the PV corresponding to the target storage declaration is assigned to the target container group, and the image file corresponding to the PV is mounted to the local directory of the target container group. The running data of each container within the target container group is written to the image file. When the container and the target container group are destroyed, the image file corresponding to the target container group is still stored in the PV corresponding to the target storage declaration. When recreating the target container group based on the target storage declaration, the image file can be accessed again through the original mount path, and the file system state of each container can be updated based on the image file.
[0051] For example, if the PV determined by the target storage declaration is named pv1, the image file corresponding to the target container group is named pv1data when creating the image file. When a new node explicitly recreates the target container group based on the target storage declaration, it can check whether the corresponding image file exists under pv1 corresponding to the target storage declaration.
[0052] According to the embodiments of this disclosure, without modifying the business code, full data persistence of the container is achieved based on the standard NFS protocol. All operations performed by the developers within the container can be recorded, and the original data can be restored when a container group is established across nodes, reducing the complexity of operation and maintenance and improving the user experience of the container.
[0053] Figure 3 This is a schematic diagram of the structure of a node device and a remote file system according to an embodiment of the present disclosure.
[0054] like Figure 3 As shown, the user-visual interface 310 includes a visual file system, which allows users to perform data access, data writing, and other operations. The file system 320 of each container in the target container group includes a read-only directory and a writable directory. The union mount directory is the combined directory of the read-only and writable directories. The visual file system that users can directly interact with is determined based on the union mount directory. The node environment 330 may include a circular device for synchronizing data between the target container group and the remote file system, and a file system mount point for mounting image files to the target container group. The remote file system 340 may include the image files stored within it.
[0055] According to embodiments of this disclosure, mounting an image file to the file system of each container in a target container group includes: associating the image file with a circular device; and mounting the image file to the container's file system as a virtual storage module based on the circular device, such that operations performed by the container on the file system are converted into operations on the image file.
[0056] A loop device is a type of virtual device in the Node.js operating system. By associating a loop device with a file, the file can be simulated as a virtual storage module, allowing read and write operations to be performed on the file in the same manner as reading and writing to a disk. A virtual storage module can be, for example, a block device.
[0057] For example, after mounting a preset directory of the remote file system 340 to the target container group, an image file is created on the remote file system 340. By executing a loop instruction, the loop device in the node environment 330 can be associated with the image file, virtualizing the image file as a file system mount point in the node environment 330. Intermediate data generated by the user during operations inside the container is synchronously written to the image file by the loop device through the file system mount point. This stores the intermediate data generated by the container during runtime in the image file of the remote file system 340, and the operations performed by the container on the file system are converted into operations on the image file.
[0058] According to embodiments of this disclosure, the file system 320 includes a read-only directory and a writable directory. Mounting the image file to the container's file system in the form of a virtual storage module includes mounting the image file to the writable directory in the form of a virtual storage module.
[0059] In the embodiments of this disclosure, the read-only directory can refer to the lowerdir (lower-level directory) in the file system, where lowerdir is a read-only image layer. The writable directory can refer to the upperdir (upper-level directory) in the file system, where upperdir is a writable layer. When a user performs data write operations on the visible file system 310, the data is written to the writable directory of the file system and synchronously written to the image file through the file system mount point via a circular device, thereby storing the intermediate data generated by the container during runtime in the image file of the remote file system 340.
[0060] According to embodiments of this disclosure, by implementing container data persistence at the container group definition layer and container runtime layer, the application layer will not be aware of the underlying storage switch. Users can achieve cross-node updates of all container data without modifying business code when migrating container groups, thereby reducing performance overhead and optimizing the user experience.
[0061] Figure 4 This is a flowchart of a data update method according to another embodiment of the present disclosure.
[0062] like Figure 4 As shown, the data update method 400 includes operations S410 to S420.
[0063] In operation S410, in response to the target container group of the first node device meeting the scheduling conditions, the target container group on the first node device is deleted. The target container group is created on the first node device based on the target storage declaration.
[0064] The first node device can be a worker node device in the Kubernetes cluster, such as a physical machine, virtual machine, or cloud server. The target container group can be a container group created on the first node device based on a target storage declaration. The control terminal in the Kubernetes cluster can determine in real time whether the target container group on the first node device meets the scheduling conditions. If the scheduling conditions are met, the target container group needs to be migrated from the first node device to another node device and then restarted. During the migration, the target container group on the first node device needs to be deleted, and all containers within the target container group will also be destroyed.
[0065] In operation S420, a creation instruction for the target container group is sent to the second node device, so that the second node device mounts the preset directory of the remote file system to the second node device based on the target storage declaration, and updates the file system status of at least one container in the target container group based on the image file under the preset directory.
[0066] The second node device can be a worker node device in a Kubernetes cluster, such as a physical machine, virtual machine, or cloud server. The second node device can be a node device that meets the operational requirements of the target container group, determined based on scheduling conditions. After the target container group is deleted from the first node device, a new target container group with the same system configuration and container group size will be created on the second node device based on the target storage declaration. When mounting the same preset directory in the remote file system to the second node device based on the target storage declaration, it can check whether the image file corresponding to the target container group exists in the preset directory. If the image file corresponding to the target container group is detected in the preset directory, each container in the target container group can read and write data based on the image file, updating the file system state of at least one container in the target container group.
[0067] According to embodiments of this disclosure, in a large-scale container environment, the performance overhead of mounting and unmounting operations can be reduced, and container groups can be freely scheduled and state-following in a Kubernetes cluster, thus optimizing the user experience.
[0068] According to embodiments of this disclosure, the scheduling conditions include: the operating resources of the target container group are greater than the available node resources of the first node device; or the first node device is faulty.
[0069] If the operating resources of the target container group exceed the available node resources of the first node device or the first node device fails, it means that the current first node device cannot continue to run the target container group and a migration operation is required for the target container group.
[0070] In the embodiments of this disclosure, the first node device and the second node device can be different node devices or the same node device. When a version update is required for a node device or container group, the target container group on the node device can be deleted and recreated. By remounting the preset directory, the data in the image file can be read and written to restore the file system state of each container in the target container group.
[0071] Figure 5 This is a flowchart of a data update method according to another embodiment of the present disclosure.
[0072] like Figure 5 As shown, the data update method includes operations S501 to S507.
[0073] During operation S501, node device A 21 writes operation data to the image file of remote file system 30.
[0074] During operation S502, the control terminal 10 sends a scheduling command to node device A 21 to delete the target container group in node device A.
[0075] During operation S503, node device A 21 unmounts the previously mounted preset directory and deletes data in the file system.
[0076] During operation S504, the control terminal 10 sends a creation command for the target container group to the node device B 22.
[0077] When operating S505, node device B 22 remounts the preset directory of remote file system 30 and checks whether the corresponding image file exists.
[0078] When operating S506, node device B 22 mounts the image file to the file system of each container in the target container group.
[0079] When operating S507, node device B 22 will convert modification operations generated in the writable directory into modification operations on the image file.
[0080] According to embodiments of this disclosure, this disclosure also provides a data update apparatus for a container file system.
[0081] Figure 6 This is a block diagram of a data update method according to an embodiment of the present disclosure.
[0082] like Figure 6 As shown, the data update device 600 includes an acquisition module 610, a first mounting module 620, a second mounting module 630, and an update module 640.
[0083] The acquisition module 610 is used to acquire the target storage declaration of the target container group, which includes at least one container, in response to receiving a creation instruction that instructs the creation of a target container group on a node device.
[0084] The first mount module 620 is used to mount a preset directory of the remote file system to the node device according to the target storage declaration.
[0085] The second mount module 630 is used to mount the image file to the file system of each container in the target container group in response to the existence of the image file corresponding to the target container group in the preset directory.
[0086] Update module 640 is used to update the file system state of each container based on the image file.
[0087] According to embodiments of this disclosure, the second mounting module 630 includes an association submodule and a first mounting submodule. The association submodule is used to associate the image file with a loop device; the first mounting submodule is used to mount the image file to the container's file system in the form of a virtual storage module based on the loop device, so that operations performed by the container on the file system are converted into operations on the image file.
[0088] According to embodiments of this disclosure, the file system includes a read-only directory and a writable directory, and the first mount submodule includes a mount unit for mounting the image file to the writable directory in the form of a virtual storage module.
[0089] According to embodiments of this disclosure, the first mount module 620 includes a space determination submodule and a second mount submodule. The space determination submodule is used to determine the storage space of the target container group in the remote file system based on the target storage declaration; the second mount submodule is used to mount the preset directory corresponding to the storage space to the node device.
[0090] According to embodiments of this disclosure, the data update device 600 further includes a file creation module and a third mounting module. The file creation module is used to create an image file in the preset directory in response to the absence of an image file corresponding to the target container group in the preset directory; the third mounting module is used to mount the created image file to the file system of each container in the target container group.
[0091] According to embodiments of this disclosure, the file creation module includes a specification determination submodule, a creation submodule, and a processing submodule. The specification determination submodule is used to determine the file specifications of the image file based on the target storage declaration; the second creation submodule is used to create the image file in the storage space corresponding to the preset directory using an image management tool based on the file specifications, the image file including a file identifier corresponding to the storage space; the processing submodule is used to format the image file.
[0092] According to embodiments of this disclosure, the data update apparatus 600 further includes an identifier determination module and a detection module. The identifier determination module is used to determine the storage space and the corresponding file identifier based on the target storage declaration; the detection module is used to detect whether an image file corresponding to the target container group exists in the storage space based on the file identifier.
[0093] Figure 7 This is a block diagram of a data update method according to another embodiment of the present disclosure.
[0094] like Figure 7 As shown, the data update device 700 includes a deletion module 710 and an instruction sending module 720.
[0095] The deletion module 710 is used to delete the target container group on the first node in response to the target container group of the first node device meeting the scheduling conditions. The target container group is created on the first node device based on the target storage declaration.
[0096] The instruction sending module 720 is used to send a creation instruction for the target container group to the second node device, so that the second node device can mount the preset directory of the remote file system to the second node device based on the target storage declaration, and update the file system status of at least one container in the target container group based on the image file under the preset directory.
[0097] According to embodiments of this disclosure, the scheduling conditions include: the operating resources of the target container group are greater than the available node resources of the first node device; or the first node device is faulty.
[0098] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0099] Figure 8 A schematic block diagram of an example electronic device 800 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0100] like Figure 8 As shown, device 800 includes a computing unit 801, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 802 or a computer program loaded from storage unit 808 into random access memory (RAM) 803. RAM 803 may also store various programs and data required for the operation of device 800. The computing unit 801, ROM 802, and RAM 803 are interconnected via bus 804. Input / output (I / O) interface 805 is also connected to bus 804.
[0101] Multiple components in device 800 are connected to I / O interface 805, including: input unit 806, such as keyboard, mouse, etc.; output unit 807, such as various types of monitors, speakers, etc.; storage unit 808, such as disk, optical disk, etc.; and communication unit 809, such as network card, modem, wireless transceiver, etc. Communication unit 809 allows device 800 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0102] The computing unit 801 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 801 performs the various methods and processes described above, such as a data update method for a container file system. For example, in some embodiments, the data update method for a container file system may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 808. In some embodiments, part or all of the computer program may be loaded and / or installed on device 800 via ROM 802 and / or communication unit 809. When the computer program is loaded into RAM 803 and executed by the computing unit 801, one or more steps of the data update method for a container file system described above may be performed. Alternatively, in other embodiments, the computing unit 801 may be configured to perform the data update method for a container file system by any other suitable means (e.g., by means of firmware).
[0103] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0104] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0105] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0106] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0107] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0108] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other.
[0109] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0110] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A method for updating data in a container file system, comprising: In response to receiving a creation instruction for instructing the creation of a target container group on a node device, a target storage declaration for the target container group is obtained, the target container group comprising at least one container; Mount the preset directory of the remote file system to the node device according to the target storage declaration; In response to the existence of an image file corresponding to the target container group in the preset directory, the image file is mounted to the file system of each container in the target container group; The file system state of each container is updated based on the image file.
2. The method according to claim 1, wherein, The step of mounting the image file to the file system of each container in the target container group includes: Associate the image file with the loop device; Based on the loop device, the image file is mounted to the container's file system in the form of a virtual storage module, so that the operations performed by the container on the file system are converted into operations on the image file.
3. The method according to claim 2, wherein, The file system includes a read-only directory and a writable directory, and the process of mounting the image file to the container's file system in the form of a virtual storage module includes: The image file is mounted to the writable directory as a virtual storage module.
4. The method according to claim 1, wherein, The step of mounting a preset directory of the remote file system to the node device according to the target storage declaration includes: The storage space of the target container group in the remote file system is determined based on the target storage declaration; Mount the preset directory corresponding to the storage space to the node device.
5. The method according to claim 1, further comprising: If the image file corresponding to the target container group does not exist in the preset directory, an image file is created in the preset directory; The created image file is mounted to the file system of each container in the target container group.
6. The method according to claim 5, wherein, Creating the image file in the preset directory includes: The file specifications of the image file are determined based on the target storage declaration; Using an image management tool, the image file is created in the storage space corresponding to the preset directory based on the file specifications. The image file includes a file identifier corresponding to the storage space. The image file is then formatted.
7. The method according to claim 6, further comprising: The storage space and the corresponding file identifier are determined based on the target storage declaration; Based on the file identifier, the system checks whether an image file corresponding to the target container group exists in the storage space.
8. A method for updating data in a container file system, comprising: In response to the target container group on the first node device meeting the scheduling conditions, the target container group on the first node device is deleted, the target container group being created on the first node device based on the target storage declaration; Send a creation instruction for the target container group to the second node device, so that the second node device can mount a preset directory of the remote file system to the second node device based on the target storage declaration, and update the file system status of at least one container in the target container group based on the image file under the preset directory.
9. The method according to claim 8, wherein, The scheduling conditions include: The target container group has greater operating resources than the available node resources of the first node device; or The first node device is faulty.
10. A data update apparatus for a container file system, comprising: The acquisition module is configured to, in response to receiving a creation instruction for a target container group, acquire a target storage declaration for the target container group, wherein the target container group includes at least one container; The first mounting module is used to mount a preset directory of the remote file system to the node device according to the target storage declaration; The second mounting module is used to mount the image file to the file system of each container in the target container group in response to the existence of the image file corresponding to the target container group in the preset directory. The update module is used to update the file system state of each container based on the image file.
11. A data update apparatus for a container file system, comprising: The deletion module is used to delete the target container group on the first node device in response to the target container group on the first node device meeting the scheduling conditions. The target container group is created on the first node device based on the target storage declaration. The instruction sending module is used to send a creation instruction for the target container group to the second node device, so that the second node device can mount a preset directory of the remote file system to the second node device based on the target storage declaration, and update the file system status of at least one container in the target container group based on the image file under the preset directory.
12. An electronic device, comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 9.
13. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1 to 9.
14. A computer program product comprising a computer program stored on at least one of a readable storage medium and an electronic device, the computer program implementing the method according to any one of claims 1 to 9 when executed by a processor.