Disclosure of Invention
The invention aims to overcome the defects and shortcomings of the prior art and provides a cloud-edge application-oriented collaborative container mirror image updating method and system, which relieve the concurrency pressure of a cloud end.
In order to achieve the above purpose, the present invention adopts the following technical scheme:
the cloud edge application collaboration-oriented container mirror image updating method is characterized by comprising the following steps of:
mounting a release version container mirror image through a container mirror image management server, mounting a history version container mirror image of the release version container mirror image, and acquiring a file index of the history version container mirror image;
Performing hash operation on all files of the release version container mirror image to obtain a first hash value, constructing a release version container mirror image file index based on the obtained first hash value, performing file deduplication operation on the release version container mirror image by combining the history version container mirror image file index, and replacing the release version container mirror image duplicate file with a file identifier;
Obtaining byte stream data blocks of missed files in the historical version container mirror image through a blocking algorithm, carrying out hash operation on the byte stream data blocks to obtain a second hash value, constructing a historical version container mirror image data block index based on the obtained second hash value, obtaining byte stream data blocks of files which are not replaced by the file identifiers in the release version container mirror image through the blocking algorithm, carrying out hash operation on the byte stream data blocks to obtain a third hash value, and carrying out data block deduplication operation on the release version container mirror image based on the obtained third hash value;
The container mirror image management server updates a history version container mirror image library and updates a history version container mirror image file index library;
Performing redundancy elimination operation on the historical version container mirror image file index and the historical version container mirror image data block index, packaging the historical version container mirror image file index and the published version container mirror image, and transmitting the packaged historical version container mirror image file index and the published version container mirror image data block index to an edge host;
The edge host receives the release version container mirror image, mounts the release version container mirror image, and mounts the history version container mirror image of the release version container mirror image;
The edge host checks whether the file identifier exists in the published version container mirror image, if so, the file corresponding to the historical version container mirror image is used for replacing, and checks whether the data block identifier exists in the published version container mirror image, if so, the data block corresponding to the historical version container mirror image is used for replacing;
and verifying the published version container mirror image, deploying the mirror image into a container running environment, deleting the local historical version container mirror image, and updating a local historical version container mirror image library.
Preferably, the cloud-edge application-oriented collaborative container image updating method is characterized in that a historical version container image of the published version container image is mounted, and a file index of the historical version container image is obtained, specifically:
And inquiring and mounting a corresponding historical version container mirror image in a historical version container mirror image library based on the published version container mirror image element identification, and extracting a corresponding historical version container mirror image file index in a historical version container mirror image file index library.
Preferably, the cloud-edge application-oriented collaborative container image updating method is characterized in that the file deduplication operation is performed on the published version container image by combining the historical version container image file index, and specifically comprises the following steps:
And inquiring the first hash value in the file index of the historical version container image, if the first hash value is hit, replacing the file corresponding to the release version container image with a file identifier, and marking the file identifier as hit in the file index of the historical version container image.
Preferably, the cloud-edge application-oriented collaborative container image updating method is characterized in that the data block deduplication operation is performed on the release version container image based on the obtained third hash value, and specifically comprises the following steps:
And inquiring the third hash value in the historical version container mirror image data block index, if the third hash value is hit, replacing the byte stream data block corresponding to the issuing version container mirror image with a data block identifier, and marking the data block identifier as hit in the historical version container mirror image data block index.
Preferably, the cloud-edge application-oriented collaborative container mirror image updating method is characterized in that a historical version container mirror image library is updated, and a historical version container mirror image file index library is updated, specifically:
And replacing the historical version container mirror image with the release version container mirror image in the historical version container mirror image library, and replacing the historical version container mirror image file index with the release version container mirror image file index in the historical version container mirror image file index library.
Preferably, the cloud-edge application-oriented collaborative container image updating method is characterized in that performing redundancy elimination operation on the historical version container image file index and the historical version container image data block index comprises the following steps:
Deleting the missed file index in the historical version container mirror image file index, and deleting the missed data block index in the historical version container mirror image data block index.
Preferably, the cloud-edge application-oriented collaborative container image updating method is characterized in that a historical version container image of the release version container image is locally mounted, specifically:
and the edge host queries and mounts the corresponding historical version container mirror image in a local historical version container mirror image library based on the meta identification of the release version container mirror image.
Preferably, the cloud-edge application-oriented collaborative container mirror image updating method is characterized in that if the cloud-edge application-oriented collaborative container mirror image updating method exists, file replacement corresponding to the historical version container mirror image is used, specifically, the file index of the historical version container mirror image is queried based on the file identification, the file corresponding to the file identification is obtained from the historical version container mirror image, and the file identification is replaced;
And if so, replacing the data block corresponding to the historical version container mirror image by using the data block corresponding to the data block identifier, namely inquiring the historical version container mirror image data block index based on the data block identifier, and acquiring the data block corresponding to the data block identifier from the historical version container mirror image to replace the data block identifier.
Preferably, the cloud-edge application-oriented collaborative container mirror image updating method is characterized by updating a local historical version container mirror image library, and particularly replacing the historical version container mirror image with the release version container mirror image in the local historical version container mirror image library.
The cloud edge application collaboration-oriented container mirror image updating system is characterized by comprising the following modules:
The server container mirror image processing module is used for mounting the release version container mirror image through the container mirror image management server, mounting the history version container mirror image of the release version container mirror image, and acquiring the file index of the history version container mirror image;
the server file processing module is used for carrying out hash operation on all files of the release version container mirror image to obtain a first hash value, constructing a release version container mirror image file index based on the obtained first hash value, carrying out file deduplication operation on the release version container mirror image by combining the history version container mirror image file index, and replacing the release version container mirror image duplicate file with a file identifier;
The server data block processing module is used for obtaining byte stream data blocks of missed files in the historical version container mirror image through a blocking algorithm, carrying out hash operation on the byte stream data blocks to obtain a second hash value, constructing a historical version container mirror image data block index based on the obtained second hash value, obtaining byte stream data blocks of files which are not replaced by the file identification in the release version container mirror image through the blocking algorithm, carrying out hash operation on the byte stream data blocks to obtain a third hash value, and carrying out data block deduplication operation on the release version container mirror image based on the obtained third hash value;
The server history version management module is used for updating the history version container mirror image library and updating the history version container mirror image file index library;
The edge host machine container mirror image processing module is used for receiving the release version container mirror image, mounting the release version container mirror image, checking the release version container mirror image and deploying the mirror image into a container running environment;
the file processing module of the edge host is used for judging whether the file identifier exists in the published version container mirror image or not, and if so, replacing the file corresponding to the historical version container mirror image;
the edge host data management module is used for checking whether the published version container mirror image has the data block identifier or not, and if so, replacing the data block corresponding to the historical version container mirror image;
And the edge host history version management module is used for extracting a corresponding history version container mirror image from the local history version container mirror image library according to the issued version container mirror image element identifier, deleting the local history version container mirror image and updating the local history version container mirror image library.
Compared with the prior art, the invention has the following advantages and beneficial effects:
(1) According to the invention, repeated data are repeated aiming at the multi-version edge container mirror image, the repeated operation is performed not only on the file level, but also on the byte stream data block level, so that the data quantity required to be transmitted by the release container mirror image can be compressed to a great extent, cloud edge network resources are saved, and the concurrency pressure of an edge container management server in the cloud is relieved;
(2) According to the invention, the edge host can reconstruct the published version container mirror image by combining the published version container mirror image obtained by file index, data block index and file deduplication and data block deduplication with the local historical version container mirror image, and the missing file is not required to be acquired through multiple interactions with the mirror image management server, so that the container starting efficiency is high;
(3) According to the invention, the edge device does not need to maintain a local metafile library, so that the storage resource of the edge device is saved to a great extent, and the historical version container mirror image is searched only through an index in the process of reconstructing the release version mirror image, so that the computing resource of the edge device is saved to a great extent.
In summary, the method only exchanges the computing, storage and network resource costs of the mass edge devices for one-time computing costs through the container mirror image management server, and relieves the concurrency pressure of the cloud.
Detailed Description
In order that those skilled in the art will better understand the technical solutions of the present application, the following description will further describe the technical solutions of the embodiments of the present application in detail with reference to the attached drawings and figures of the embodiments, but the embodiments of the present application are not limited thereto. All other embodiments, based on the embodiments of the application, which are obtained by a person skilled in the art without the innovative teachings are intended to be within the scope of the application.
Reference in the specification to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the application. The appearances of such phrases in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those of skill in the art will explicitly and implicitly appreciate that the described embodiments of the application may be combined with other embodiments.
As shown in fig. 1, the method for updating a container image for cloud edge application collaboration in this embodiment includes the following steps:
S1, a user issues a container mirror image through a container mirror image management server, the container mirror image management server mounts the container mirror image of the issued version, mounts the container mirror image of the history version of the container mirror image of the issued version, and acquires a file index of the container mirror image of the history version.
Further, the historical version container mirror image of the release version container mirror image is mounted, and a file index of the historical version container mirror image is obtained, specifically:
And inquiring and mounting a corresponding historical version container mirror image in a historical version container mirror image library based on the published version container mirror image element identification, and extracting a corresponding historical version container mirror image file index in a historical version container mirror image file index library.
It can be understood that a user can issue a Docker mirror image to a plurality of raspberry pies, an edge gateway and an intelligent terminal through a container mirror image management server, after the container mirror image management server receives a request for updating the container mirror image issued by the user, a container mirror image processing module in the container mirror image management server can locally mount a release version Docker mirror image sent by the user, and call a server history version management module to extract a history version Docker mirror image corresponding to the local mount in a history version container mirror image library through a meta identifier, and extract a history version Docker mirror image file index in a history version container mirror image file index library.
S2, carrying out hash operation on all files of the release version container mirror image to obtain a first hash value, constructing a release version container mirror image file index based on the obtained first hash value, carrying out file deduplication operation on the release version container mirror image by combining the history version container mirror image file index, and replacing the release version container mirror image duplicate file with a file identifier.
Further, the file deduplication operation is performed on the published version container image by combining the historical version container image file index, specifically:
And inquiring the first hash value in the file index of the historical version container image, if the first hash value is hit, replacing the file corresponding to the release version container image with a file identifier, and marking the file identifier as hit in the file index of the historical version container image.
Furthermore, the container image management service file processing module calculates a first hash value of the published version Docker image file through an SHA-1 algorithm, namely, the first hash value is used for providing the integrity protection of the information, and constructs a published version container image file index based on the obtained first hash value, the purpose of constructing the index is that hash operation is not needed to be carried out on the version container image file again when the next container version is published, after the file index is constructed, the first hash value is queried in a historical version container image file index, if the file index is hit, the corresponding file of the published version container image is replaced by a file identifier, the file identifier comprises an SHA-1 abstract, and meanwhile, the file is marked as hit in the historical version container image file index.
S3, obtaining byte stream data blocks of missed files in the historical version container mirror image through a blocking algorithm, carrying out hash operation on the byte stream data blocks to obtain a second hash value, constructing a historical version container mirror image data block index based on the obtained second hash value, obtaining byte stream data blocks of files which are not replaced by the file identification in the release version container mirror image through the blocking algorithm, carrying out hash operation on the byte stream data blocks to obtain a third hash value, and carrying out data block deduplication operation on the release version container mirror image based on the obtained third hash value.
Further, performing data block deduplication operation on the release version container image based on the obtained third hash value, specifically:
And inquiring the third hash value in the historical version container mirror image data block index, if the third hash value is hit, replacing the byte stream data block corresponding to the issuing version container mirror image with a data block identifier, and marking the data block identifier as hit in the historical version container mirror image data block index.
Specifically, the server data block processing module performs blocking on a missed file in the historical version Docker image through an AE blocking algorithm, the blocking algorithm generates a variable-length content block based on a byte stream data blocking extremum, byte drift problems caused by adding, deleting and modifying the file content can be effectively solved, the data block is subjected to SHA-1 operation to obtain a second hash value, a historical version container image data block index is constructed based on the obtained second hash value, byte stream data blocks are obtained on a file which is not replaced by the file identifier in the published version Docker image through an AE blocking algorithm, the byte stream data blocks are subjected to hash operation to obtain a third hash value, the data block deduplication operation is performed on the published version container image based on the obtained third hash value, the hit data block is replaced by the data block identifier in the published version container image, and the historical version container image data block index is marked.
And S4, the container mirror image management server updates a history version container mirror image library and updates a history version container mirror image file index library.
Further, the historical version container mirror image library is updated, and the historical version container mirror image file index library is updated, specifically:
And replacing the historical version container mirror image with the release version container mirror image in the historical version container mirror image library, and replacing the historical version container mirror image file index with the release version container mirror image file index in the historical version container mirror image file index library.
Further, the server history version management module updates a history version container mirror image library and a history version container mirror image file index library, replaces the history version container mirror image with a release version container mirror image in the history version container mirror image library, and replaces the history version container mirror image file index with a release version container mirror image file index in the history version container mirror image file index library.
S5, performing redundancy elimination operation on the historical version container image file index and the historical version container image data block index, packaging the historical version container image file index and the published version container image, and transmitting the packaged historical version container image file index and the published version container image data block index to an edge host.
Further, performing redundancy elimination operation on the historical version container image file index and the historical version container image data block index, including:
Deleting the missed file index in the historical version container mirror image file index, and deleting the missed data block index in the historical version container mirror image data block index.
Further, the server container mirror image processing module performs redundancy elimination operation on the historical version container mirror image file index and the historical version container mirror image data block index, and includes deleting the missed file index in the historical version container mirror image file index, deleting the missed data block index in the historical version container mirror image data block index, and packaging and publishing the version mirror image to transmit to each raspberry group, edge gateway and intelligent terminal, as shown in fig. 3.
S6, the edge host receives the release version container mirror image, mounts the release version container mirror image, and mounts the history version container mirror image of the release version container mirror image.
Further, the history version container mirror image of the release version container mirror image is locally mounted, specifically:
and the edge host queries and mounts the corresponding historical version container mirror image in a local historical version container mirror image library based on the meta identification of the release version container mirror image.
Furthermore, in each raspberry group, the edge gateway and the intelligent terminal, the edge host machine container mirror image processing module receives and locally mounts the historical version container mirror image of the release version container mirror image, and the edge host machine queries and mounts the corresponding historical version container mirror image in the local historical version container mirror image library based on the release version container mirror image element identification.
S7, the edge host checks whether the file identification exists in the published version container mirror image, if so, the file corresponding to the historical version container mirror image is used for replacing, and checks whether the data block identification exists in the published version container mirror image, and if so, the data block corresponding to the historical version container mirror image is used for replacing.
Further, if the file exists, replacing the file corresponding to the historical version container mirror image, specifically, inquiring the file index of the historical version container mirror image based on the file identification, and acquiring the file corresponding to the file identification from the historical version container mirror image to replace the file identification.
And if so, replacing the data block corresponding to the historical version container mirror image by using the data block corresponding to the data block identifier, namely inquiring the historical version container mirror image data block index based on the data block identifier, and acquiring the data block corresponding to the data block identifier from the historical version container mirror image to replace the data block identifier.
Further, the file processing module of the edge host queries the file index of the historical version container image based on the file identification, acquires the file corresponding to the file identification from the historical version container image, and replaces the file identification; and if so, using the data block corresponding to the historical version container mirror image to replace, specifically, inquiring the data block index of the historical version container mirror image based on the data block identification, acquiring the data block corresponding to the data block identification from the historical version container mirror image, replacing the data block identification, and checking whether the data block identification exists in the published version container mirror image by using the data block processing module of the edge host machine, and if so, using the data block corresponding to the historical version container mirror image to replace.
S8, verifying the published version container mirror image, deploying the mirror image into a container running environment, deleting the local historical version container mirror image, and updating a local historical version container mirror image library.
Further, the local history version container mirror library is updated, specifically:
and replacing the historical version container image with the release version container image in the local historical version container image library.
Furthermore, the edge host machine mirror image processing module checks the mirror image of the release version container to ensure the integrity and the accuracy of the mirror image of the release version container, deploys the mirror image to the container running environment, deletes the mirror image of the local history version container, and finally replaces the mirror image of the history version container with the mirror image of the release version container in the mirror image library of the local history version container and updates the mirror image library of the local history version container.
Based on the analysis, the updating of the container mirror image not only carries out the duplication removal on the file level, but also carries out the duplication removal operation on the byte stream data block, thereby compressing the data quantity required to be transmitted for releasing the container mirror image, saving cloud network resources, and simultaneously, only needing to exchange the once calculation cost of the container mirror image management server for the calculation, storage and network resource cost of mass edge equipment, and relieving the concurrency pressure of the cloud.
As shown in fig. 2, in another embodiment of the present invention, a cloud-edge application-oriented collaborative container image update system is further provided, where the system may be configured to execute the above-mentioned cloud-edge application-oriented collaborative container image update method, and the system includes the following modules:
The server container mirror image processing module is used for mounting the release version container mirror image through the container mirror image management server, mounting the history version container mirror image of the release version container mirror image, and acquiring the file index of the history version container mirror image;
the server file processing module is used for carrying out hash operation on all files of the release version container mirror image to obtain a first hash value, constructing a release version container mirror image file index based on the obtained first hash value, carrying out file deduplication operation on the release version container mirror image by combining the history version container mirror image file index, and replacing the release version container mirror image duplicate file with a file identifier;
The server data block processing module is used for obtaining byte stream data blocks of missed files in the historical version container mirror image through a blocking algorithm, carrying out hash operation on the byte stream data blocks to obtain a second hash value, constructing a historical version container mirror image data block index based on the obtained second hash value, obtaining byte stream data blocks of files which are not replaced by the file identification in the release version container mirror image through the blocking algorithm, carrying out hash operation on the byte stream data blocks to obtain a third hash value, and carrying out data block deduplication operation on the release version container mirror image based on the obtained third hash value;
The server history version management module is used for updating the history version container mirror image library and updating the history version container mirror image file index library;
The edge host machine container mirror image processing module is used for receiving the release version container mirror image, mounting the release version container mirror image, checking the release version container mirror image and deploying the mirror image into a container running environment;
the file processing module of the edge host is used for judging whether the file identifier exists in the published version container mirror image or not, and if so, replacing the file corresponding to the historical version container mirror image;
the edge host data management module is used for checking whether the published version container mirror image has the data block identifier or not, and if so, replacing the data block corresponding to the historical version container mirror image;
And the edge host machine history version management module extracts a corresponding history version container mirror image from a local history version container mirror image library according to the published version container mirror image element identifier, deletes the local history version container mirror image and updates the local history version container mirror image library.
It should be noted that, the above technical features and beneficial effects described in the embodiments of the cloud edge application-oriented collaborative container mirror image updating method are applicable to the embodiments of the cloud edge application-oriented collaborative container mirror image updating system, and specific content may be referred to the description of the embodiments of the method of the present invention, which is not repeated herein, so that it is stated here.
In addition, in the embodiment of the above-mentioned cloud-edge application-oriented collaborative container mirror update system, the logic division of each module is merely illustrative, and in practical application, the above-mentioned function allocation may be performed by different modules according to needs, for example, in view of configuration requirements of corresponding hardware or convenience of implementation of software, that is, the internal structure of the above-mentioned cloud-edge application-oriented collaborative container mirror update system is divided into different modules, so as to perform all or part of the above-mentioned functions.
Those skilled in the art will appreciate that all or part of the processes in the methods of the above embodiments may be implemented by a computer program for instructing relevant hardware, where the program may be stored in a non-volatile computer readable storage medium, and where the program, when executed, may include processes in the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in embodiments provided herein may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (SYNCHLINK) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples are preferred embodiments of the present invention, but the embodiments of the present invention are not limited to the above examples, and any other changes, modifications, substitutions, combinations, and simplifications that do not depart from the spirit and principle of the present invention should be made in the equivalent manner, and the embodiments are included in the protection scope of the present invention.