CN112379828A - Container creation method and device based on dynamic file system - Google Patents

Container creation method and device based on dynamic file system Download PDF

Info

Publication number
CN112379828A
CN112379828A CN202011165855.1A CN202011165855A CN112379828A CN 112379828 A CN112379828 A CN 112379828A CN 202011165855 A CN202011165855 A CN 202011165855A CN 112379828 A CN112379828 A CN 112379828A
Authority
CN
China
Prior art keywords
data
container
directory
target
file system
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
CN202011165855.1A
Other languages
Chinese (zh)
Other versions
CN112379828B (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.)
Huayun Data Holding Group Co Ltd
Original Assignee
Huayun Data Holding Group 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 Huayun Data Holding Group Co Ltd filed Critical Huayun Data Holding Group Co Ltd
Priority to CN202011165855.1A priority Critical patent/CN112379828B/en
Publication of CN112379828A publication Critical patent/CN112379828A/en
Application granted granted Critical
Publication of CN112379828B publication Critical patent/CN112379828B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0604Improving or facilitating administration, e.g. storage management
    • G06F3/0607Improving or facilitating administration, e.g. storage management by facilitating the process of upgrading existing storage systems, e.g. for improving compatibility between host and storage device
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/11File system administration, e.g. details of archiving or snapshots
    • G06F16/113Details of archiving
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0643Management of files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0662Virtualisation aspects
    • G06F3/0667Virtualisation aspects at data level, e.g. file, record or object virtualisation

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to the technical field of containers, in particular to a container creating method and a device based on a dynamic file system, wherein the method comprises the steps of obtaining a target container directory and creating a data directory under the target container directory; searching at least one target object which can be used for creating a dynamic file system; creating a storage pool based on at least one target object and mounting the storage pool onto the data directory; and creating a target container by using the mounted data directory. By using the function of the storage pool in the dynamic file system, at least one target object which can be used for creating the dynamic file system forms the storage pool, the storage pool is mounted to the data directory, and then the creation of the target container is performed, so that the data of the created target container is stored according to the data directory, and the storage pool formed by at least one object is mounted to the data directory, therefore, the final container data is stored in the target object, namely, the persistent storage of the container data is realized.

Description

Container creation method and device based on dynamic file system
Technical Field
The invention relates to the technical field of containers, in particular to a container creation method and device based on a dynamic file system.
Background
As containerization technology matures and becomes more prevalent, more and more servers are beginning to migrate from bare machines to containers. Mainstream containers themselves use a hierarchical file system and do not use persistent data, such as databases. After containerization, the server typically stores persistent data by creating a data volume, wherein the persistent data of the container, i.e., the data does not end with the end of the container, exists on the host.
Taking the Docker container technology as an example, there are two main schemes used by the Docker container to create a persistent data Volume, one is a Bind Mount, and the other is a Volume. The Bind Mount and the Volume are both file systems bypassing the container, and directly write data to the host, wherein the Bind Mount is realized by mounting the directory of the host to the container, and the Volume is realized by mounting the directory created by the Docker to the container.
Whether the above-mentioned Bind Mount or Volume, the persistent storage performance of the container has a great relationship with the file system of the host, and if the storage performance of the file system of the host is poor, the storage performance of the above-mentioned running container is also directly affected. How to ensure satisfactory permanent storage properties of the container.
Because the dynamic file system (ZFS for short) is a revolutionary new file system, it is robust, reliable, scalable, and easy to manage, and the ZFS file system also has strong performance and cost performance. Then, after determining to adopt the ZFS file system, how to use the ZFS file system to store container data is an urgent problem to be solved.
Disclosure of Invention
In view of this, embodiments of the present invention provide a container creation method and apparatus based on a dynamic file system, so as to solve the problem of using a ZFS file system to store container data.
According to a first aspect, an embodiment of the present invention provides a container creation method based on a dynamic file system, including:
acquiring a target container directory and creating a data directory under the target container directory;
searching at least one target object which can be used for creating a dynamic file system;
creating a storage pool based on the at least one target object and mounting the storage pool onto the data directory;
and creating a target container by using the mounted data directory.
In the container creation method based on the dynamic file system provided by the embodiment of the present invention, at least one target object that can be used for creating the dynamic file system is formed into a storage pool by using the function of the storage pool in the dynamic file system, and the storage pool is mounted in the data directory, and then the creation of the target container is performed, so that the data of the created target container is stored according to the data directory, and the storage pool formed by at least one object is mounted in the data directory, so that the final container data is stored in the target object, that is, the persistent storage of the container data is realized.
With reference to the first aspect, in a first implementation manner of the first aspect, the creating a storage pool based on the at least one target object and mounting the storage pool on the data directory includes:
responding to a creation command of the dynamic file system;
based on the create command and the at least one target object, a storage pool is created and mounted to the data directory.
The container creation method based on the dynamic file system provided by the embodiment of the invention creates the storage pool and the mount of the storage pool by using the creation command of the dynamic file system, simplifies the data processing process, and can be realized by directly using the command of the dynamic file system.
With reference to the first implementation manner of the first aspect, in a second implementation manner of the first aspect, the creating a storage pool and mounting the storage pool onto the data directory based on the creation command and the at least one target object includes:
building the at least one target object into the storage pool using the create command;
and mounting the storage pool on the data directory.
The container creating method based on the dynamic file system provided by the embodiment of the invention has the advantages that the storage pool is built by at least one target object, and then the storage pool is mounted on the data directory, so that at least one target object is used for persistent storage of data in the data directory.
With reference to the first aspect, in a third implementation manner of the first aspect, the target object includes at least one of a disk, a file, and an image, and the finding may be used to create a target object of a dynamic file system, and includes:
and traversing all the objects, and screening all the objects according to preset conditions to obtain a target object which can be used for creating a dynamic file system.
According to the container creation method based on the dynamic file system, provided by the embodiment of the invention, all objects are screened, so that the screened target objects can meet the requirements, and the normal storage of subsequent data is ensured.
With reference to the first aspect, in a fourth implementation manner of the first aspect, the creating a data directory under the target container directory includes:
responding to the container command;
and creating a storage disk in the form of a data volume under the target container directory based on the container command to obtain the data directory.
According to the container creation method based on the dynamic file system, provided by the embodiment of the invention, the storage disk in the form of the data volume is created under the target container target, so that the storage performance of the container data is improved.
With reference to the first aspect, or any one of the first to fourth embodiments of the first aspect, in a fifth embodiment of the first aspect, the method further comprises:
setting a storage data path of the target container as the data directory;
acquiring data to be stored;
and storing the data to be stored based on the data directory.
In the container creation method based on the dynamic file system provided by the embodiment of the invention, the storage path of the target container is set as the data directory, the storage pool is hung under the data directory, the storage pool is formed by at least one target object, and finally the data to be stored is stored in the target object, so that the persistent storage of the container data is realized.
With reference to the fifth implementation manner of the first aspect, in a sixth implementation manner of the first aspect, the storing the data to be stored based on the data directory includes:
storing the data to be stored into the storage pool;
determining a target storage object based on the load of each target object in the storage pool;
and storing the data to be stored by utilizing the target storage object.
According to a second aspect, an embodiment of the present invention further provides a container creating apparatus based on a dynamic file system, including:
the acquisition module is used for acquiring a target container directory and creating a data directory under the target container directory;
the searching module is used for searching at least one target object which can be used for creating a dynamic file system;
a mounting module, configured to form a storage pool based on the at least one target object, and mount the storage pool to the data directory;
and the creating module is used for creating a target container by using the mounted data directory.
The container creation apparatus based on a dynamic file system according to an embodiment of the present invention forms at least one target object that can be used to create the dynamic file system into a storage pool by using a storage pool function in the dynamic file system, mounts the storage pool to a data directory, and subsequently creates a target container, so that data of the created target container is stored according to the data directory, and the data directory is mounted with the storage pool formed by at least one object, so that the final container data is stored in the target object, that is, persistent storage of the container data is achieved.
According to a third aspect, an embodiment of the present invention provides an electronic device, including: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing therein computer instructions, and the processor executing the computer instructions to perform the method for storing container data based on a dynamic file system according to the first aspect or any one of the embodiments of the first aspect.
According to a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, which stores computer instructions for causing a computer to execute the dynamic file system based container data storage method described in the first aspect or any one implementation manner of the first aspect.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
FIG. 1 is a flow diagram of a dynamic file system based container creation method according to an embodiment of the present invention;
FIG. 2 is a flow diagram of a dynamic file system based container creation method according to an embodiment of the present invention;
FIG. 3 is a flow diagram of a dynamic file system based container creation method according to an embodiment of the present invention;
FIG. 4 is a block diagram of a dynamic file system based container creation apparatus according to an embodiment of the present invention;
fig. 5 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of container creation and container data storage according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
For convenience of the following description, the terms referred to herein are to be construed as follows:
(1) ZFS Pool: the ZFS storage pool, which is a device aggregate, provides physical storage of data in the ZFS file system.
(2) vdev: the virtual device describes a single device or a device set organized according to specific performance and fault characteristics, and the vdev may be multiple implementations such as disk, file, mirror, and the like (in this patent, a host disk is used as the vdev). A ZFS pool may be configured with any number of virtual devices, with data dynamically distributed across all devices to balance data across devices. When a new virtual device is added, the ZFS automatically puts the data on the newly available device.
(3) /dev/sda …/dev/sdx: host disk (disk) name in the system.
(4) Docker Container: a Docker vessel.
(5) Docker Volume: docker persisted storage Volume implemented by Volume.
(6) ZFS Mount: in the embodiment of the invention, an actual bottom storage is provided for container persistent storage, namely, data stored in a Docker Volume by a container is actually stored in the ZFS Pool.
The embodiment of the invention provides a server containerization scheme for providing container persistent storage by using a ZFS (zero-forcing system) file system on a host, which can effectively ensure that a server can still use high-performance persistent storage after containerization. Therefore, the container creation method based on the dynamic file system can solve the problem of how to use high-performance storage after containerization by the server.
In accordance with an embodiment of the present invention, there is provided a dynamic file system based container creation method embodiment, it is noted that the steps illustrated in the flowchart of the drawings may be performed in a computer system such as a set of computer executable instructions and that while a logical order is illustrated in the flowchart, in some cases the steps illustrated or described may be performed in an order different than here.
In this embodiment, a container creating method based on a dynamic file system is provided, which may be used in an electronic device, such as a server, and fig. 1 is a flowchart of a container creating method based on a dynamic file system according to an embodiment of the present invention, and as shown in fig. 1, the flowchart includes the following steps:
and S11, acquiring the target container directory and creating a data directory under the target container directory.
Before containerization, the electronic device needs to determine a directory of the target container, that is, a storage directory corresponding to the target container. After querying the target container directory, the electronic device creates a data directory under the target container directory, and the data directory is used for storing subsequent container data.
The creation of the data directory may be a storage disk in a mode of creating a data Volume (Volume), or a storage disk in another mode, where a specific form of the data directory is not limited at all, and may be set according to an actual situation.
For example, after creating a Volume-based storage disk, the electronic device sets the storage disk in a target container directory; the creation of the storage disk and the like can also be directly performed under the target container directory.
S12, at least one target object that can be used to create a dynamic file system is located.
The target object may be a file, a disk, or the like in the electronic device. The electronic device may determine the target objects that may be used to create the dynamic file system by querying each local object that may be used to store data. The determination of the target object may be to set a preset condition to filter the object for storing data, for example, the preset condition may be an available storage capacity of the object, a directory of the object, and the like. The specific screening method is not limited at all, and may be set according to actual conditions.
The target object may be one, two, or more, and the like, and may be set according to actual situations.
S13, a storage pool is created based on the at least one target object and the storage pool is mounted to the data directory.
After finding at least one target object in S12, the electronic device may combine the at least one target object into a storage pool, that is, combine the at least one target object into an aggregate, which may be represented in the form of a storage pool. Of course, the electronic device may also directly create the storage pool and mount the storage pool using the command of the dynamic file system.
Wherein, the storage pool is mounted on the data directory, which can also be understood as establishing the mapping between the data directory and the storage pool; alternatively, the name of the storage pool is set on a data directory, and so on.
And S14, creating a target container by using the mounted data directory.
After S13, the electronic device may obtain the data directory on which the storage pool is mounted. The data directory is created under the target container directory, and the storage pool is hung under the data directory and formed by at least one target object screened locally. Therefore, after the electronic device creates the target container by using the data directory, the container data of the target container can realize high-performance persistent data storage. This is because the container data is ultimately stored in the target object.
In the container creation method based on the dynamic file system provided by this embodiment, at least one target object that can be used to create the dynamic file system is formed into a storage pool by using the function of the storage pool in the dynamic file system, and the storage pool is mounted in the data directory, and then the creation of the target container is performed, so that the data of the created target container is stored according to the data directory, and the storage pool formed by at least one object is mounted in the data directory, so that the container data is finally stored in the target object, that is, the persistent storage of the container data is realized.
In this embodiment, a container creating method based on a dynamic file system is provided, which can be used in the above-mentioned electronic device, such as a server, etc., fig. 2 is a flowchart of a container creating method based on a dynamic file system according to an embodiment of the present invention, and as shown in fig. 2, the flowchart includes the following steps:
and S21, acquiring the target container directory and creating a data directory under the target container directory.
Specifically, the step S21 includes the following steps:
s211, acquiring a target container directory.
For example, taking the created container as a Docker container as an example, the electronic device checks that the target container corresponds to a storage directory set on the host, and assumes/path/to/volume-01.
For the rest, please refer to the related description in S11 of the embodiment shown in fig. 1, which is not repeated herein.
S212, responding to the container command.
The user enters a container command in the electronic device, which the electronic device will respond to. The container command is used to create a storage disk in the form of a data volume under a specified directory.
For example, the Docker command may be: the docker volume create volume-name.
And S213, creating a storage disk in the form of a data volume under the target container directory based on the container command to obtain the data directory.
The electronic device, in response to the container command, creates a storage disk in the form of a data volume under the target container target. Following the above example, after the electronic device responds to the container command, a corresponding volume directory is newly created under the Docker directory of the electronic device, and the volume is the data directory. For example, a Volume-style persistent storage disk is created using the Docker command, assuming the disk name is Volume-01.
And a storage disk in a data volume form is created under the target container target, so that the storage performance of the container data is improved.
S22, at least one target object that can be used to create a dynamic file system is located.
The target object comprises at least one of a disk, a file and an image.
Specifically, the electronic device obtains a target object that can be used for creating a dynamic file system by traversing all local objects that can be used for storing data and screening all the objects according to preset conditions.
For example, the user can set the conditions for searching for available disks according to the needs of the user, for example, only disks greater than 100G are used, so that the performance and the function can be ensured.
After finding the target object, the electronic device may record a path of the target object and use the path as a condition for creating a subsequent storage pool. For example, the disks available to create the ZFS file system are looked up at the host, assuming/dev/sdb,/dev/sdc, and/dev/sde.
All the objects are screened, so that the screened target objects can meet the requirements, and the normal storage of subsequent data is ensured.
S23, a storage pool is created based on the at least one target object and the storage pool is mounted to the data directory.
Specifically, the step S23 includes the following steps:
s231, responding to the creation command of the dynamic file system.
The user enters a create command of the dynamic file system, i.e., inputs ZFS command, in the electronic device to instruct the electronic device to create the storage pool.
S232, based on the creation command and at least one target object, creating the storage pool and mounting the storage pool on the data directory.
As described above, the storage pool is composed of all the target objects queried in S22 above, and the electronic device creates the storage pool based on the creation command of the dynamic file system in S231 above and mounts the storage pool to the data directory.
In an optional implementation manner of this embodiment, the step S232 includes the following steps:
(1) the at least one target object is assembled into the storage pool using the create command.
The electronic device, upon receiving a create command for the dynamic file system, groups all of the target objects into a storage pool. For example, all target objects may be represented in the storage pool using the path of each target object.
(2) The storage pool is mounted to the data directory.
After the electronic device forms the storage pool, the storage pool is mounted on the data directory, so that the corresponding relation between the storage pool and the data directory is realized.
For example, pool is created using ZFS command (assuming the pool name is set to zpool-01) and mounted onto the Docker volume. Wherein, the ZFS command may be: zpool create-m/path/to/volume-01zpool-01/dev/sdb/dev/sdc/dev/sde
The storage pool is built by at least one target object, and then the storage pool is mounted on the data directory, so that the at least one target object is used for the persistent storage of the data under the data directory.
And S24, creating a target container by using the mounted data directory.
For example, a container is created using volume-01 as persistent storage using a Docker command.
For the rest, please refer to S14 in the embodiment shown in fig. 1, which is not described herein again.
The container creation method based on the dynamic file system provided by this embodiment creates the storage pool and mounts the storage pool by using the creation command of the dynamic file system, simplifies the data processing process, and can be implemented by directly using the command of the dynamic file system.
As a specific implementation manner of this embodiment, this embodiment mainly describes a creation process of a target container. Taking the created container as a Docker container as an example, as shown in fig. 6, the method for creating a container based on a dynamic file system includes the following steps:
(1) firstly, creating a Volume-mode persistent storage disk by using a Docker command, and assuming that the disk name is Volume-01;
(2) acquiring a storage directory set by a Docker on a host corresponding to volume-01, and assuming that the storage directory is/path/to/volume-01;
(3) finding a disk on the host that can be used to create a ZFS file system, assuming/dev/sdb,/dev/sdc, and/dev/sde;
(4) the pool is created using ZFS commands (assuming the pool name is set to zpool-01) and mounted onto the Docker volume. Wherein, the ZFS command may be: zpool create-m/path/to/volume-01 zpool-01/dev/sdb/dev/sdc/dev/sde;
(5) the container is created using the Docker command using volume-01 as persistent storage.
In this embodiment, a container creating method based on a dynamic file system is provided, which can be used in the above-mentioned electronic device, such as a server, etc., fig. 3 is a flowchart of a container creating method based on a dynamic file system according to an embodiment of the present invention, and as shown in fig. 3, the flowchart includes the following steps:
and S31, acquiring the target container directory and creating a data directory under the target container directory.
Please refer to S21 in fig. 2 for details, which are not described herein.
S32, at least one target object that can be used to create a dynamic file system is located.
Please refer to S22 in fig. 2 for details, which are not described herein.
S33, a storage pool is created based on the at least one target object and the storage pool is mounted to the data directory.
Please refer to S23 in fig. 2 for details, which are not described herein.
And S34, creating a target container by using the mounted data directory.
Please refer to S24 in fig. 2 for details, which are not described herein.
S35, the storage data path of the target container is set as the data directory.
After the target container is created, the electronic device may set the storage data path of the target container to the data directory.
For example, after the creation of the above mentioned Docker container is completed, the volume-01 maps the directory in the container to be/path/to/date _ dir, and then the electronic device sets the path of the relevant service (e.g. mysql) storing the persistent data in the target container to be/path/to/date _ dir.
And S36, acquiring the data to be stored.
The target container of the electronic device will generate data to be stored during operation.
And S37, storing the data to be stored based on the data directory.
Since the electronic device has set the path of the storage data of the target container as the data directory in S35 described above, the electronic device stores the data to be stored using the data target.
In the container operation process, the electronic device stores the data in the/path/to/date _ dir directory, and since the/path/to/date _ dir is mapped with the volume-01, the electronic device actually stores the data in the volume-01.
In an optional implementation manner of this embodiment, the step S37 may include the following steps:
and S371, storing the data to be stored in the storage pool.
Wherein, because the storage pool is mounted in the data directory, the electronic device stores the data to be stored in the storage pool.
For example, since the ZFS pool-01 has been mounted under volume-01, the persistent data of the container may instead be stored into the pool-01 pool.
S372, determining the target storage objects based on the load of each target object in the storage pool.
Further, since the storage pool is formed of at least one target object, data to be stored is eventually stored in each target object. Meanwhile, when the electronic equipment stores data, the data to be stored is stored based on the load balancing principle. Thus, the electronic device may determine the target storage object from the storage pools based on the load of each target object in the storage pools.
And S373, storing the data to be stored by using the target storage object.
After the electronic device determines the target storage object, the electronic device can store the data to be stored by using the target storage object. Finally, the persistent data of the container will be stored on the vdev by the ZFS file system, and in this embodiment, the data to be stored will be finally stored on a disk (disk) of the host.
In the container creation method based on the dynamic file system provided by this embodiment, the storage path of the target container is set as the data directory, and since the storage pool is mounted under the data directory and is formed by at least one target object, the data to be stored is finally stored in the target object, thereby implementing persistent storage of the container data.
As a specific implementation manner of this embodiment, the foregoing S35-S37 mainly describe persistent storage of container data, and specifically, continuing to take the foregoing Docker container as an example, as shown in fig. 6, the foregoing S35-S37 may include the following steps:
(1) after the Docker container is created, assuming that the directory mapped by volume-01 in the container is/path/to/date _ dir;
(2) setting a path of storing persistent data of a related service (such as mysql) in the container to be/path/to/date _ dir;
(3) in the container operation process, the program stores the data in the/path/to/date _ dir directory, and because the/path/to/date _ dir is mapped with the volume-01, the program actually stores the data in the volume-01;
(4) since the pool-01 in the ZFS pool is already mounted under the volume-01, the persistent data of the container can be stored into the pool-01 pool instead;
(5) finally, the persistent data of the container will be stored on vdev by the ZFS file system, and in this patent, will be finally stored on the disk of the host.
Due to the powerful performance and robustness of the ZFS file system, the whole storage process can be very fast and reliable.
In this embodiment, a container creating apparatus based on a dynamic file system is further provided, and the apparatus is used to implement the foregoing embodiments and preferred embodiments, and the description already made is not repeated. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.
The present embodiment provides a container creating apparatus based on a dynamic file system, as shown in fig. 4, including:
an obtaining module 41, configured to obtain a target container directory and create a data directory under the target container directory;
a search module 42 for searching for at least one target object that can be used to create a dynamic file system;
a mounting module 43, configured to form a storage pool based on the at least one target object, and mount the storage pool to the data directory;
and the creating module 44 is used for creating a target container by using the mounted data directory.
The container creating apparatus based on the dynamic file system according to this embodiment forms at least one target object that can be used to create the dynamic file system into a storage pool by using a function of the storage pool in the dynamic file system, mounts the storage pool to a data directory, and then creates a target container, so that data of the created target container is stored according to the data directory, and the data directory is mounted with the storage pool formed by at least one object, so that the final container data is stored in the target object, that is, persistent storage of the container data is achieved.
The dynamic file system based container creation means in this embodiment is presented in the form of functional units, where a unit refers to an ASIC circuit, a processor and a memory executing one or more software or fixed programs, and/or other devices that may provide the above-described functionality.
Further functional descriptions of the modules are the same as those of the corresponding embodiments, and are not repeated herein.
An embodiment of the present invention further provides an electronic device, which has the container creating apparatus based on the dynamic file system shown in fig. 4.
Referring to fig. 5, fig. 5 is a schematic structural diagram of an electronic device according to an alternative embodiment of the present invention, and as shown in fig. 5, the electronic device may include: at least one processor 51, such as a CPU (Central Processing Unit), at least one communication interface 53, memory 54, at least one communication bus 52. Wherein a communication bus 52 is used to enable the connection communication between these components. The communication interface 53 may include a Display (Display) and a Keyboard (Keyboard), and the optional communication interface 53 may also include a standard wired interface and a standard wireless interface. The Memory 54 may be a high-speed RAM Memory (volatile Random Access Memory) or a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. The memory 54 may alternatively be at least one memory device located remotely from the processor 51. Wherein the processor 51 may be in connection with the apparatus described in fig. 4, the memory 54 stores an application program, and the processor 51 calls the program code stored in the memory 54 for performing any of the above-mentioned method steps.
The communication bus 52 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The communication bus 52 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown in FIG. 5, but this is not intended to represent only one bus or type of bus.
The memory 54 may include a volatile memory (RAM), such as a random-access memory (RAM); the memory may also include a non-volatile memory (english: non-volatile memory), such as a flash memory (english: flash memory), a hard disk (english: hard disk drive, abbreviated: HDD) or a solid-state drive (english: SSD); the memory 54 may also comprise a combination of the above types of memories.
The processor 51 may be a Central Processing Unit (CPU), a Network Processor (NP), or a combination of a CPU and an NP.
The processor 51 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a Programmable Logic Device (PLD), or a combination thereof. The PLD may be a Complex Programmable Logic Device (CPLD), a field-programmable gate array (FPGA), a General Array Logic (GAL), or any combination thereof.
Optionally, the memory 54 is also used to store program instructions. The processor 51 may call program instructions to implement a dynamic file system based container creation method as shown in the embodiments of fig. 1 to 3 of the present application.
Embodiments of the present invention further provide a non-transitory computer storage medium, where computer-executable instructions are stored in the computer storage medium, and the computer-executable instructions may execute the container creation method based on a dynamic file system in any of the above method embodiments. The storage medium may be a magnetic Disk, an optical Disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a Flash Memory (Flash Memory), a Hard Disk (Hard Disk Drive, abbreviated as HDD), a Solid State Drive (SSD), or the like; the storage medium may also comprise a combination of memories of the kind described above.
Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the invention, and such modifications and variations fall within the scope defined by the appended claims.

Claims (10)

1. A container creation method based on a dynamic file system is characterized by comprising the following steps:
acquiring a target container directory and creating a data directory under the target container directory;
searching at least one target object which can be used for creating a dynamic file system;
creating a storage pool based on the at least one target object and mounting the storage pool onto the data directory;
and creating a target container by using the mounted data directory.
2. The method of claim 1, wherein creating a storage pool based on the at least one target object and mounting the storage pool on the data directory comprises:
responding to a creation command of the dynamic file system;
based on the create command and the at least one target object, a storage pool is created and mounted to the data directory.
3. The method of claim 2, wherein creating a storage pool and mounting the storage pool on the data directory based on the create command and the at least one target object comprises:
building the at least one target object into the storage pool using the create command;
and mounting the storage pool on the data directory.
4. The method of claim 1, wherein the target object comprises at least one of a disk, a file, and an image, and wherein finding the target object that can be used to create the dynamic file system comprises:
and traversing all the objects, and screening all the objects according to preset conditions to obtain a target object which can be used for creating a dynamic file system.
5. The method of claim 1, wherein creating a data directory under the target container directory comprises:
responding to the container command;
and creating a storage disk in the form of a data volume under the target container directory based on the container command to obtain the data directory.
6. The method according to any one of claims 1-5, further comprising:
setting a storage data path of the target container as the data directory;
acquiring data to be stored;
and storing the data to be stored based on the data directory.
7. The method of claim 6, wherein the storing the data to be stored based on the data directory comprises:
storing the data to be stored into the storage pool;
determining a target storage object based on the load of each target object in the storage pool;
and storing the data to be stored by utilizing the target storage object.
8. A container creation apparatus based on a dynamic file system, comprising:
the acquisition module is used for acquiring a target container directory and creating a data directory under the target container directory;
the searching module is used for searching at least one target object which can be used for creating a dynamic file system;
a mounting module, configured to form a storage pool based on the at least one target object, and mount the storage pool to the data directory;
and the creating module is used for creating a target container by using the mounted data directory.
9. An electronic device, comprising:
a memory and a processor, the memory and the processor being communicatively connected to each other, the memory having stored therein computer instructions, the processor executing the computer instructions to perform the method of storing container data based on a dynamic file system as claimed in any one of claims 1 to 7.
10. A computer-readable storage medium storing computer instructions for causing a computer to perform the method for dynamic file system based container data storage according to any one of claims 1 to 7.
CN202011165855.1A 2020-10-27 2020-10-27 Container creation method and device based on dynamic file system Active CN112379828B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011165855.1A CN112379828B (en) 2020-10-27 2020-10-27 Container creation method and device based on dynamic file system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011165855.1A CN112379828B (en) 2020-10-27 2020-10-27 Container creation method and device based on dynamic file system

Publications (2)

Publication Number Publication Date
CN112379828A true CN112379828A (en) 2021-02-19
CN112379828B CN112379828B (en) 2024-03-19

Family

ID=74576817

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011165855.1A Active CN112379828B (en) 2020-10-27 2020-10-27 Container creation method and device based on dynamic file system

Country Status (1)

Country Link
CN (1) CN112379828B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112905537A (en) * 2021-02-20 2021-06-04 北京百度网讯科技有限公司 File processing method and device, electronic equipment and storage medium
CN114064594A (en) * 2021-11-22 2022-02-18 马上消费金融股份有限公司 Data processing method and device
CN115629772A (en) * 2022-09-05 2023-01-20 摩尔线程智能科技(北京)有限责任公司 Kubernetes software installation method and device and electronic equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100306269A1 (en) * 2009-05-26 2010-12-02 Roger Frederick Osmond Method and apparatus for large scale data storage
CN105637487A (en) * 2013-06-13 2016-06-01 数据引力公司 Live restore for a data intelligent storage system
CN107291386A (en) * 2017-06-14 2017-10-24 湖北第二师范学院 A kind of cache management system and method for blue light VTL gateways
CN111782339A (en) * 2020-06-28 2020-10-16 京东数字科技控股有限公司 Container creation method and device, electronic equipment and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100306269A1 (en) * 2009-05-26 2010-12-02 Roger Frederick Osmond Method and apparatus for large scale data storage
CN105637487A (en) * 2013-06-13 2016-06-01 数据引力公司 Live restore for a data intelligent storage system
CN107291386A (en) * 2017-06-14 2017-10-24 湖北第二师范学院 A kind of cache management system and method for blue light VTL gateways
CN111782339A (en) * 2020-06-28 2020-10-16 京东数字科技控股有限公司 Container creation method and device, electronic equipment and storage medium

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112905537A (en) * 2021-02-20 2021-06-04 北京百度网讯科技有限公司 File processing method and device, electronic equipment and storage medium
CN112905537B (en) * 2021-02-20 2022-09-02 北京百度网讯科技有限公司 File processing method and device, electronic equipment and storage medium
CN114064594A (en) * 2021-11-22 2022-02-18 马上消费金融股份有限公司 Data processing method and device
CN114064594B (en) * 2021-11-22 2023-09-22 马上消费金融股份有限公司 Data processing method and device
CN115629772A (en) * 2022-09-05 2023-01-20 摩尔线程智能科技(北京)有限责任公司 Kubernetes software installation method and device and electronic equipment
CN115629772B (en) * 2022-09-05 2023-09-19 摩尔线程智能科技(北京)有限责任公司 Kubernetes software installation method and device and electronic equipment

Also Published As

Publication number Publication date
CN112379828B (en) 2024-03-19

Similar Documents

Publication Publication Date Title
CN112379828A (en) Container creation method and device based on dynamic file system
CN112148678B (en) File access method, system, device and medium
CN107666493B (en) Database configuration method and equipment thereof
CN110941393A (en) Logical volume management-based LV supply method, device, equipment and medium
US11461031B1 (en) Non-disruptive storage volume migration between storage controllers
CN113179670B (en) Method, system, and medium for document storage and management
CN105095103A (en) Storage device management method and device used for cloud environment
CN111787036A (en) Solution method, device, storage medium and equipment for front-end private cloud deployment
CN111399760B (en) NAS cluster metadata processing method and device, NAS gateway and medium
CN112988062B (en) Metadata reading limiting method and device, electronic equipment and medium
CN112199176B (en) Service processing method, device and related equipment
US11210347B2 (en) Object search with pagination and non-duplicates support
US11301436B2 (en) File storage method and storage apparatus
CN113127258A (en) Data backup method, device, equipment and medium
CN115510016A (en) Client response method, device and medium based on directory fragmentation
CN115454617A (en) Processor performance adjusting method and device, electronic equipment and storage medium
CN114861003A (en) Object enumeration method, device and medium under specified directory
CN115391277A (en) Method, device, equipment and medium for detecting directory capacity quota
EP3798859A1 (en) File system using approximate membership filters
CN114020214A (en) Storage cluster capacity expansion method and device, electronic equipment and readable storage medium
CN114567641A (en) Super-fusion cluster deployment method, device, equipment and readable storage medium
CN113504872A (en) Method, system, equipment and medium for mounting virtual disk on cloud physical machine
CN111625192B (en) Metadata object access method, device, equipment and medium
TWI537750B (en) Method for supporting file management for physical file systems and file server using such method
CN114257505B (en) Server node configuration method, device, equipment and storage medium

Legal Events

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